Forum archive 2000-2006

Lars Jensen - Problem coding

Lars Jensen - Problem coding

by Arnold Pizer -
Number of replies: 0
inactiveTopicProblem coding topic started 6/2/2004; 2:43:52 AM
last post 6/2/2004; 2:14:10 PM
userLars Jensen - Problem coding  blueArrow
6/2/2004; 2:43:52 AM (reads: 871, responses: 3)
We've just started to write some problems for the first time, and  we have some questions where to find the best and most up-to-date problem templates. There seem to be an abundance of different styles used when looking at a cross section of problems from the CVS. Below are some questions we have. Thanks for any answers.
  1. What  macro packages should generally be loaded for simple numerial and/or function answer problems?
  2. What answer evaluators should be used for standard numerical and function problems? num_cmp or std_num_cmp? fun_cmp or function_cmp?
  3. Some problems have complicated beginproblem statements with lots of arguments, including $BR, rtc. Is this necessary?
  4. Are there some "clean," recently coded problems in CVS I can use as prototypes? -Or do the exaples on http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/tutorial/
    represent "best coding practices?"
  5. Is this the correct layout for a basic numerical problem?

    DOCUMENT();
    loadMacros(
    PGbasicmacros.pl,
    PGchoicemacros.pl,
    PGanswermacros.pl"
    );
    TEXT(&beginproblem());
    $showPartialCorrectAnswers = 1;

    $var1 = &random(50,90,1);
    more variables defined here
    $ans = ... ;

    BEGIN_TEXT
    Problem text here
    Answer: {ans_rule(8)}.
    END_TEXT
    ANS(num_cmp($ans));
    ENDDOCUMENT();

 

Thanks,
Lars.

<| Post or View Comments |>


userMichael Gage - Re: Problem coding  blueArrow
6/2/2004; 8:18:12 AM (reads: 1044, responses: 0)
Hi Lars,

We've just started to write some problems for the first time, and  we have some questions where to find the best and most up-to-date problem templates. There seem to be an abundance of different styles used when looking at a cross section of problems from the CVS. Below are some questions we have. Thanks for any answers.

-- There are many styles, some of the disparity occurs because many of the simplest problems were written first and we have since developed more sophisticated, easier to maintain (but perhaps less intuitive) ways to write problems. Unfortunately, the tutorial problems are NOT the best model. I hope that we'll be able to update them this summer. Jeff Holt is working on cleaning up many of the existing problems. I hope that he will be able to post some of the guidelines he is using, along with some example problems that the rest of us can follow.

  1. What  macro packages should generally be loaded for simple numerial and/or function answer problems?
  2. ----- PGbasicmacros.pl, PGanswermacros.pl and PGauxiliaryFunctions.pl (PGchoicemacros.pl and PGgraphmacros.pl are needed for multiple choice type questions and questions using graphs, respectively. Other packages may be needed for specialized answer evaluators.)
  3. What answer evaluators should be used for standard numerical and function problems? num_cmp or std_num_cmp? fun_cmp or function_cmp?
  4. --- Use num_cmp and fun_cmp. They are easier to maintain since they use key/value pairs for options, rather than position. See the manpages for options (http://webwork.math.rochester.edu/docs/docs/pglanguage/manpages/). The manpages are useful, but not yet complete.
  5. Some problems have complicated beginproblem statements with lots of arguments, including $BR, rtc. Is this necessary?
  6. No.
  7. Are there some "clean," recently coded problems in CVS I can use as prototypes? -Or do the exaples on http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/tutorial/
    represent "best coding practices?"
  8. Unfortunately the tutorials are often NOT current best practices, although they work and represent the original style in which problems were written. The tutorial manual by Tom Shemanske (new: http://webwork.dartmouth.edu/webwork_local/newbie-1.7/WeBWorK_newbie.pdf ) is much better, but also somewhat out of date.
  9. Is this the correct layout for a basic numerical problem?
    (I've made some corrections.)
    DOCUMENT(); 
    loadMacros(

    PGbasicmacros.pl,
    PGanswermacros.pl,
    PGchoicemacros.pl,
    );
    TEXT(beginproblem());
    $showPartialCorrectAnswers = 1;

    $var1 = random(50,90,1);
    more variables defined here
    $ans = ... ;


    BEGIN_TEXT
    Problem text here<
    Answer: \{ans_rule(8)\}
    END_TEXT
    ANS(num_cmp($ans));
    ENDDOCUMENT();

    Notice that ampersands are generally not needed (they were originally required in Perl 4 to denote subroutines/functions, but function() is more consistent with other languages than &function and probably more intuitive for most mathematicians as well. One still uses &function to pass a reference to a function, but that would occur seldom if at all when writing problems.

Thanks,
Lars.

<| Post or View Comments |>


userLars Jensen - Re: Problem coding  blueArrow
6/2/2004; 12:09:09 PM (reads: 1052, responses: 0)
Hi Mike,

Thanks so much for the response.

Lars.

<| Post or View Comments |>


userThomas R. Shemanske - Re: Problem coding  blueArrow
6/2/2004; 2:14:10 PM (reads: 1041, responses: 0)
The URL Mike gave for the Newbie guide is out of date.  The correct one is

http://webwork.dartmouth.edu/webwork_local/newbie-1.7/WeBWorK_newbie.pdf

The last revision of the guide was July 2002

T

<| Post or View Comments |>