## Forum archive 2000-2006

### Lars Jensen - Problem coding

by Arnold Pizer -
Number of replies: 0
 Problem coding topic started 6/2/2004; 2:43:52 AMlast post 6/2/2004; 2:14:10 PM
 Lars Jensen - Problem coding  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.What  macro packages should generally be loaded for simple numerial and/or function answer problems?What answer evaluators should be used for standard numerical and function problems? num_cmp or std_num_cmp? fun_cmp or function_cmp?Some problems have complicated beginproblem statements with lots of arguments, including $BR, rtc. Is this necessary?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?"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 |>  Michael Gage - Re: Problem coding 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. What macro packages should generally be loaded for simple numerial and/or function answer problems?----- 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.) What answer evaluators should be used for standard numerical and function problems? num_cmp or std_num_cmp? fun_cmp or function_cmp? --- 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. Some problems have complicated beginproblem statements with lots of arguments, including$BR, rtc. Is this necessary? No. 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?" 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. 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_TEXTProblem text here

 Lars Jensen - Re: Problem coding  6/2/2004; 12:09:09 PM (reads: 1052, responses: 0) Hi Mike, Thanks so much for the response. Lars.<| Post or View Comments |>

 Thomas R. Shemanske - Re: Problem coding  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 ishttp://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 |>