MONET Examples
Introduction With a MONET query it is possible to call a Computer Algebra System (CAS) from the Mathdoxplayer. At the moment the supported CAS systems are GAP, Mathematica, Maxima and WIRIS. If the CAS is not set up or configured properly an error is given. It is possible to indicate whether to use the native language of the CAS or to use OpenMath. This can be selected for both input and output. Below are some examples. Note that WIRIS does only support OpenMath mode. It is also possible to show or update a GeoGebra with a MONET query. More information about this can be found in the section on some GeoGebra MONET queries. An example of a MONET query in <application>Mathematica</application> with <quote>native</quote> input and output. The <tag>monet</tag> namespace is <code>xmlns:monet="http://monet.nag.co.uk/monet/ns"</code>. Random[Integer,{1,2}] ]]> This MONET query returns an integer as a string. An example of a MONET query with OpenMath output that is parsed. Expand[(x+1)*(x+2)] ]]> Mathematica expands the expression and puts the resulting OpenMath output is stored in the variable expr. An example of a combined MONET query with OpenMath output that is parsed. Random[Integer,{1,2}] Random[Integer,{-1,-2}] Expand[(x-($${zero1}))*(x-($${zero2}))] ]]> This combined monet query first calculates the two zeros of an expression and then lets Mathematica calculate the expanded expression. The result is in OpenMath form so that it can be easily included at a position in the text. Note that the variables zero1 and zero2 have an attribute trim with value true. This is because space is important in several CAS systems. Especially newlines might give errors. Furthermore brackets are used around the variables to prevent problems that might arise, for example -- is not the same as - -. In the next example it is shown how to generate an image. The Jelly prefices c and x have namespaces xmlns:c="jelly:core" and xmlns:x="jelly:xml". See also the some examples with Jelly in MathDox. An example with an image. Plot[(x-($${zero1}))*(x-($${zero2})),{x,-3,3},{PlotStyle->Hue[.9],ImageSize->{320,320},GridLines->Automatic}] ]]> This example uses the expression with the zeroes from in the previous example. It returns a link for a plot using the Mathematica plot service. A problem with this service is that it is not possible to firewall this and that it uses native input (this has security risks). It is also possible to view the complete example. Note that if Mathematica and/or the Mathematica service are not installed and running then this example will give a Connection Refused error in Orbeon. An example with OpenMath input and output. 1 2 ]]> This example has both openmath input an output. It is possible to view this OpenMath example. An example of an old macro for a MONET query (as used in Mathadore). eval Native Native Random[Integer,{0,1}] ]]> The old macro for query has namespace xmlns:q="http://www.mathdox.org/MathBook/Query". Note that this namespace is not supported in the new player.