WeBWorK Problems


Re: perlFunction and plots

by Dick Lane -
Number of replies: 0
Nandor's 24-Jan-2009 example uses init_graph which probably needs PGgraphmacros.pl to be loaded.  I do like having the student answer plotted.  I would add the following:
    Note: the ${BBOLD}Preview Answer${EBOLD} button
    will show a figure with original curve (in blue) together
    with your function (plotted in green).

My experiments with Davide's first revision, 26-Jan-2009, often had an incorrect plot of the student answer.  E.g., with problem having 2^x as correct answer, I answered 3^x - 2 and viewed a green curve corresponding to 2 + 2^(-x) = 2 + (1/2)^x.  Some earlier malfunctions had led me to guess $h retained the value from first student attempt, but this particular experiment had result inconsistent with that conjecture.

Davide's second version is even more instructive, thanks.