## Forum archive 2000-2006

### Arnold K. Pizer - bug in setDiffEQ3Separable/jas7_4_5b.pg

by Arnold Pizer -
Number of replies: 0
 bug in setDiffEQ3Separable/jas7_4_5b.pg topic started 12/5/2003; 12:07:06 PMlast post 12/8/2003; 5:24:02 PM
 Arnold K. Pizer - bug in setDiffEQ3Separable/jas7_4_5b.pg  12/5/2003; 12:07:06 PM (reads: 715, responses: 2) This is a transscript of email with  David Gilliam gilliam@koch.math.ttu.edu Dear  Arnie In case it helps, I am using webwork 1.9. I think I have figured out the problem in some of the  cases.  I also saw some discussion of this kind of issue in your online discussion groups (found by a search).  Sometimes the range of values that are used to test to check whether the solution is correct require taking a square root or log of a negative number. As an example, the exact answer (according to webwork) of   setDiffEQ3Separable/jas7_4_5b.pg,1 with seed 370 is -ln(e^(2*4) + (4/10) - (4/10)*e^(10*t))/4  But when this answer is entered the following message occurs: %%%%%%%%%%%%%%%%%%%%% error: Can't take log of -3480.73. Error detected evaluating student input at (0.9689999062 )  There is an error in WeBWorK's answer to this problem, please alert your instructor. error: Can't take log of -3480.73. Error detected evaluating correct adapted answer  at (0.9689999062 ) There is an error in WeBWorK's answer to this problem, please alert your instructor. error: Can't take log of -3480.73. Error detected evaluating instructor answer  at (0.9689999062 ) The above answer is NOT correct. %%%%%%%%%%%%%%%%%%%%%%%%%% I am quite certain that it is a problem with the evaluator which I know nothing about. %%%%%%%%%% On my assignment the exercises with difficulties are: setDiffEQ3Separable/ur_de_3_15.pg,1 setDiffEQ3Separable/ur_de_3_13.pg,1 setDiffEQ3Separable/jas7_4_5b.pg,1 %%%%%%%%%%%%%%%  On the problem   ur_de_3_15.pg, I looked at the pg file and, while I know almost nothing about perl, I believe the problem was the following One of the parameters is generated using $a = random(-0.9,-0.1,1); I am guessing that it should be something like$a = random(-0.9,-0.1,.1); The last number is something like a step size. All I know is that for some values of the parameters it works fine but for others it won't accept the correct answer according to the formula in webwork. %%%%%%%%%%%%%%%%% Well anyway, I certainly would appreciate any advice you can give. Thanks in advance. Dave Gilliam Professor of Mathematics Department of Math and Stat Texas Tech University Lubbock, TX 79409   <| Post or View Comments |>

 Arnold K. Pizer - Re: bug in setDiffEQ3Separable/jas7_4_5b.pg  12/5/2003; 12:09:59 PM (reads: 899, responses: 0) Thanks  David.  These are indeed bugs.  See below.Dear  Arnie In case it helps, I am using webwork 1.9. I think I have figured out the problem in some of the  cases.  I also saw some discussion of this kind of issue in your online discussion groups (found by a search).  Sometimes the range of values that are used to test to check whether the solution is correct require taking a square root or log of a negative number. As an example, the exact answer (according to webwork) of   setDiffEQ3Separable/jas7_4_5b.pg,1 with seed 370 is -ln(e^(2*4) + (4/10) - (4/10)*e^(10*t))/4  But when this answer is entered the following message occurs: %%%%%%%%%%%%%%%%%%%%% error: Can't take log of -3480.73. Error detected evaluating student input at (0.9689999062 )  There is an error in WeBWorK's answer to this problem, please alert your instructor. error: Can't take log of -3480.73. Error detected evaluating correct adapted answer  at (0.9689999062 ) There is an error in WeBWorK's answer to this problem, please alert your instructor. error: Can't take log of -3480.73. Error detected evaluating instructor answer  at (0.9689999062 ) In checking if a student's function f(x) is equal to the expected answer $ans = g(x) using the function_cmp answer evaluator WeBWorK evaluates both functions at random points and sees if they agree. By default function_cmp checks points in the interval (0,1). It remarkable that most functions that appear in problems are defined there so that a statement like &ANS(function_cmp($ans, "t")); usually works (the "t" is listed because by default the variable is "x").  Probably for this reason some problem authors are unaware that sometimes they have to tell function_cmp where the function is defined.  That's the case with this problem.Here is my correction for this problem:################## cut here #####################################DESCRIPTION##  Seperable Differential Equation##ENDDESCRIPTION##KEYWORDS('Differential Equation', 'Seperable')DOCUMENT();        # This should be the first executable line in the problem.loadMacros(PG.pl,PGbasicmacros.pl,PGchoicemacros.pl,PGanswermacros.pl,PGauxiliaryFunctions.pl);TEXT(&beginproblem);$showPartialCorrectAnswers = 1;$a = random(2,10,1);$b = random(2,6,1);$d = random(2,17,1);BEGIN_TEXTSolve the separable differential equation for (u)  [  frac{du}{dt} = e^{$b u +$a t}. ] Use the following initial condition: ( u(0) = - $d ).$BR(u =) { ans_rule(45) }.END_TEXT$ans = "-ln(e^($d*$b) + ($b/$a) - ($b/$a)*e^($a*t))/$b";$upper_lim = (1/$a)*(ln($a) + $b*$d - ln($b)); ##$ans is defined on (0, upper_lim)&ANS(function_cmp($ans, "t", 0,$upper_lim));ENDDOCUMENT();        # This should be the last executable line in the problem.########################## cut here ###########################Notes: (1) Since WeBWorK knows what e is, I removed $e = exp(1) and used e rather than$e in $ans. The original author used both e and$e in $ans which is strange. Not a bug but now the "correct answer" looks better.(2) Hopefully I calculated$upper_lim correctly. I assumed but didn't check that $ans is the solution to the diff. eqt, since you said some students got the problem correct. I only checked that$ans is defined on (0, $upper_lim). (3) Instead of function_cmp($ans, "t", 0, $upper_lim) you could also use func_cmp($ans, var => 't', limits => [0, $upper_lim]) which our more modern way of writing things. [the corrected problem is now in the CVS --- akp]random (a,b,c) is a WeBWorK macro (so even a perl expert would not be familiar with it) and you are correct that c is the step size. Thus$a = random(-0.9,-0.1,1); is obviously wrong.  However I think the "random" $a would always be -0.9 in this case so I'm not sure this is why ur_de_3_15.pg won't accept correct answers. If you know a seed that fails, it would help us correct the problem.It looks like some of these problems haven't been used that much. Sorry for the bugs but we appreciate the bug reports.Arnie The above answer is NOT correct. %%%%%%%%%%%%%%%%%%%%%%%%%% I am quite certain that it is a problem with the evaluator which I know nothing about. %%%%%%%%%% On my assignment the exercises with difficulties are: setDiffEQ3Separable/ur_de_3_15.pg,1 setDiffEQ3Separable/ur_de_3_13.pg,1 setDiffEQ3Separable/jas7_4_5b.pg,1 %%%%%%%%%%%%%%% On the problem ur_de_3_15.pg, I looked at the pg file and, while I know almost nothing about perl, I believe the problem was the following One of the parameters is generated using$a = random(-0.9,-0.1,1); I  am guessing that it should be something like \$a = random(-0.9,-0.1,.1); The last number is something like a step size. All I know is that for some values of the parameters it works fine but for others it won't accept the correct answer according to the formula in webwork. %%%%%%%%%%%%%%%%% Well anyway, I certainly would appreciate any advice you can give. Thanks in advance. Dave Gilliam <| Post or View Comments |>

 Arnold K. Pizer - Re: bug in setDiffEQ3Separable/jas7_4_5b.pg  12/8/2003; 5:24:02 PM (reads: 904, responses: 0) Hi, The three buggy problems David reports setDiffEQ3Separable/ur_de_3_15.pg,1 setDiffEQ3Separable/ur_de_3_13.pg,1 setDiffEQ3Separable/jas7_4_5b.pg,1 have now all been corrected in the CVS.   All the bugs were similar in that the correct answer wasn't alwayed defined on (0,1) so that one has to be more careful and give a domain on which the answer is defined. The two ur_de... problems were written this summer and thus this is the first semester anyone is using them.  The jas... problem is older but somehow the bug has escaped notice until now. Arnie <| Post or View Comments |>