## WeBWorK Main Forum

### Request for help with GeoGebra and WeBWorK

by Mike May -
Number of replies: 6

I am trying to see if I can use GeoGebra and WeBWorK together to meet my needs. I am doing an open source business calculus book and want to WeBWorK the questions. I would like to do questions that involve modeling, starting with randomized data. I am having trouble figuring out how to get data back and forth between GeoGebra and WeBWorK.

Let me give a bare bones problem that includes the functionality I want.

In WeBWorK, create two random points A and B.

Send the two points to GeoGebra.

Have GeoGebra add the two points so C=A+B.

Send C back to WeBWorK, and have it show up in the answer when showing correct answers.

Some reasons for my construction:

I want to keep WeBWorKâ€™s ability to randomize for students, but keep a constant value on mutilple logins.

While adding two points is trivial, WeBWorK has lots of nice commands I can use for more complicated constructions. There are commands for best fitting lines, polynomials, and exponential functions, Riemann sums, and symbolic derivatives and integrals. There is also a lot of help available for finding that one more command.

This is for a course taught by teaching assistants and adjuncts. I want the instructors to be able to show the correct answer.

Can I do this in GeoGebra, or do I have to go to Sage or R for this?

************************

Further background note- One of the hidden features of GeoGebra is that it has lots of statistics functionality. I see a lot of functionality here if I can get the basic data passing to work.

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

by Michael Gage -
While adding two points is trivial, WeBWorK has lots of nice commands I can use for more complicated constructions. There are commands for best fitting lines, polynomials, and exponential functions, Riemann sums, and symbolic derivatives and integrals. There is also a lot of help available for finding that one more command.

Hi Mike,

Is this a typo? Did you mean Geogebra in the paragraph above? In particular WeBWorK doesn't have symbolic integration although the other functions are available. Ease of finding new commands is not one of WW's strongest points at the moment. :-( More work is needed in this regard.

Take care,

Mike

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

by Mike May -
Yes, I meant GeoGebra has lots of nice commands.

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

by Alex Jordan -
Hi Mike,

Yes, you can do this with GGB. Before I answer more, is your book using PreTeXt? I ask because I am in the middle of relevant developments with PreTeXt, WeBWorK, and GeoGebra. I'll elaborate if your answer is yes.

There is more than one approach to getting a WW inside a GGB. The wiki has several GGB pages, which is a bit of a problem. The pages are not necessarily aware of each other, and if any one of them has become out of date, that may not be clear.

http://webwork.maa.org/wiki/GeoGebraApplets
http://webwork.maa.org/wiki/GeoGebraWeb1
http://webwork.maa.org/wiki/GeoGebra

Alex

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

by Mike May -
Thanks.

Short answer, yes it is in PreTeXt.
http://math.slu.edu/~may/ExcelCalculus/

The project started with the premise that business students should be taught math using spreadsheets, that that is the platform they will work on the rest of their lives. The change in tach changes the math that is accessible. In turn, that changes the homework I want them to do.

I am only gradually adding in the bells and whistles available in PreTeXt.

Mike

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

by Alex Jordan -
OK, a few things might interest you.
1. With a PTX eBook you can now enable a generic GeoGebra calculator. You can see one flavor here (https://pretextbook.org/examples/sample-article/html/) by pushing the Calc button. If there was a request, I think we would make a generic GeoGebra spreadsheet one of the avialable options.
2. GeoGebra applets can be inserted in PTX already in a variety of ways, not counting inside WeBWorK. Some examples here (https://pretextbook.org/examples/sample-article/html/section-interactive-authored.html#subsection-46).
3. I am working on a PG macro file, "parserGeoGebra.pl". It makes a GeoGebra Math Object. I won't explain how it all works here, but it will make it as easy as I can imagine to integrate GeoGebra inside WW problems. I essentially have a mid-June deadline for this, since there is a PTX workshop that week and this should be done by then.
4. Once that exists, the normal way for using a GGB inside PTX will also work for a GGB inside a WW inside PTX.
This is just information, most of which you can't act on right now. Right now if you have time to work on making GGB applets inside WW problems, those links I gave earlier are the best I know of. Mike G recently taught people about this at JMM, so maybe he has some more resources to point to. But after June, I will have something up that walks through the whole PreTeXt point of view on this.

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

by Michael Gage -
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