## WeBWorK Main Forum

### Re: Request for help with GeoGebra and WeBWorK

by Michael Gage -
Number of replies: 0
Hi Mike and Alex,

I put this problem up

and then expanded it with a good deal of debugging code so that you can see
(kind of) what is going on. Some of the behavior of when the applet actually evaluates its functions puzzles me.

First though -- if you would like the problem to be different for each student but repeatable everytime they log in then you should create

$A1_fudgefactor = random(-2,2,1); in the webwork section and then use applet.evalCommand("A1=(1,5+$A1_fudgefactor");

applet.evalCommand("A1=(1,5+RandomBetween[-2,2])");

webwork will remember the fudge factor from one invocation of
the problem to the next because webwork's random has a fixed seed
(different for each student) that
is reset every time the problem is revisited.

What you really want for your current problem is to be able to retrieve the calculations
from geogebra when the problem is initially evaluated (before the submit
button is pressed). This would allow you to use standard answer evaluators

(Of course if you allow students to manipulate the data before they submit
then you do need to use multianswer evaluators.)

I've added code that _should_ retrieve the calculated value when
the problem is first rendered and it does this the first time the
problem is rendered, but it fails to do this when the problem is
rerendered upon submit. I don't understand why. Some timing issue
I'm missing? An actual bug?, if so is it a bug in webwork or geogebra?

You only notice this because geogebra is constantly changing the data with every
rendering. You would not notice this is webwork controlled the randomization.

You can see the code on that problem even if you are logged in as guest.

Take care,
Mike