## Forum archive 2000-2006

### Gavin LaRose - odd fun_cmp grading error ### Gavin LaRose - odd fun_cmp grading error

by Arnold Pizer -
Number of replies: 0 odd fun_cmp grading error topic started 9/13/2002; 12:52:31 AMlast post 9/14/2002; 4:28:15 PM Gavin LaRose - odd fun_cmp grading error 9/13/2002; 12:52:31 AM (reads: 950, responses: 2) Hi all, We're getting a nice lot of posts here recently, so here's another one. In our new differential equations homework set, I have the problem solve $$eqn$$, where $whichQ = random(1,2,1); # we write the equation two different ways$m = random(1,9,1); # to fool people into thinking they $y1 = random(1,5,1); # have different problems. if ($whichQ == 1 ) { $eqn = "x y' = -3 y +$m x^5; y(1) = $y1"; } elsif ($whichQ == 2 ) { $eqn = "{1\over x} y' + 3 {y\over x^2} =$m x^3; y(1) = $y1"; } if ($m == 8*$y1 ) { # why is this necessary? without the if$ans2 = "$m*x^5/(8)"; # m==8y1, the correct answer y=x^5 } else { # (when y(0)=1 and m=8) wrong.$ans2 = "(-$m +$m*x^8 + 8*$y1)/(8*x^3)"; } which is graded with a simple ANS( fun_cmp($ans2 ) );. As noted in the comment, without putting in the if to check whether the first and last terms in the answer cancel, in at least one case where they did the correct answer was marked wrong. My first thought would be that the correct answer was being evaluated and returned something like 1.003E-08, so that the comparison in fun_cmp didn't work, but when I pass the answer to fun_cmp as a string I expect it to do the evaluation correctly. I (obviously) haven't done any experiments with this to figure out what's happening, but if someone can give me an answer off the top of their head I'd be interested in knowing what it is. Thanks, Gavin <| Post or View Comments |> Thomas R. Shemanske - Re: odd fun_cmp grading error 9/13/2002; 6:05:07 AM (reads: 1190, responses: 0) Hi Gavin I had some problems with fun_cmp a year or two ago; I found it necessary to tweak the following values in the GLobal.pm file $functZeroLevelDefault = 1E-12;$functZeroLevelTolDefault = 1E-12; Cheers, Tom <| Post or View Comments |> Michael Gage - Re: odd fun_cmp grading error 9/14/2002; 4:28:15 PM (reads: 1199, responses: 0) Two more comments: You might want to explicitly set the domain so that you don't get division by 0 (or even values very close to 0).You can get further information about how fun_cmp is working by setting the obtion debug => 1. This makes each filter in fun_cmp print out (as a warning) the value of the ans_hash after it operates on it and allows you to check the internal workings of fun_cmp. It is not yet as useful as it might be, but following the printouts and using the code for fun_cmp as a guide you can easily tell if some numerical round off error is causing trouble. Hope this helps. --Mike <| Post or View Comments |>