>  >  >   
> http://www.geogebra.org/en/examples/poly_deriv_exercise/poly_deriv.html
>  >  >
>  >
>  >  Hey that's a neat example.  Can anybody figure out how to see the source 
> code
>  >  that was written "in Geogebra" to create it?  I tried for a while but
>  >  was stumped.
>  >
>  I think the closest GeoGebra gets to "source code" is what they call
>  the "construction protocol" (it's attached).
>  Here's what I did:
>  - I got the .ggb from 
> http://www.geogebra.org/en/examples/poly_deriv_exercise/
>  - Opened it with GeoGebra
>  - View / Construction protocol
>  - Print

You also need the javascript that communicates from the form to the
applet.  You can read that from html file on the same website where the ggb file
was downloaded.

Here is the relevant code.

<script type="text/javascript">
function check() { var applet = document.ggbApplet;
applet.evalCommand("g = Polynomial[" +
document.inputform.textfield.value + "]");
// check function diff(x) which is the
// difference between derivative and entered function
var diff = applet.getValueString("diff").substring(10); if (diff == "0") {
alert("Good job! That's correct!");
applet.setVisible("h", false);
} else {
applet.setVisible("h", true);
alert("Your solution is not correct. Compare your solution with\nthe
red graph of the derivative and try again."); } }
</script>

....

<form style="margin-left: 40px;" name="inputform" action=""
onsubmit="check();return false;">Derivative
: <span style="font-weight: bold;">f'(x) =</span> <input
name="textfield" size="50" type="text"> <input value="Check"
onclick="check();" type="button">
</form>

There is an interface that lets a web page control and read from
embedded GeoGebra applets. It is documented at
http://www.geogebra.org/source/program/applet/geogebra_applet_javascript.html
A description of the creation of the given applet and a couple others
similar ones is given in the document.
http://www.maa.org/joma/Volume7/Hohenwarter2/2007_joma_mathlets.pdf

Jacob

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to