function mmldemo
% MMLDEMO is a guided tour about using MML.
disp(' ')
disp('  MMLDEMO')
disp(' ')
disp('  MMLDEMO demonstrates the capabilities of the MML function and how to use it.')
disp('  This demo guides through a number of examples showing the syntactical')
disp('  variations MML can be used with.')
disp(' ')
disp('  To run properly this demo requires:')
disp('  1.) Symbolic Math Toolbox 3.0.1 for MATLAB with Maple 8 Kernel or later.')
disp('  2.) To display the expression in MS Internet Explorer install MATHPLAYER.')
disp('      Download MATHPLAYER (freeware) at')
disp('      http://www.dessci.com/webmath/mathplayer')
disp(' ')
disp('[Press any key to continue with Example 1]')
pause
disp('  ')
disp('  Example 1: MML(TERM)')
disp('  ')
disp('  The following line in the MATLAB Command Window displays a mathematical')
disp('  expression in the system''s standard webbrowser. In this example the area')
disp('  function of a circle is entered for TERM. When the line below is executed')
disp('  the webbrowser opens and displays the term.')
disp('  ')
disp('  >>mml(pi/4*d^2)')
disp('  ')
disp('[Press any key to demonstrate]')
pause
disp('  ')
disp('  Now the webbrowser opens and displays the term.')
mml('pi/4*d^2')
disp('  ')
disp('  ')
disp('[Press any key to continue]')
pause
disp('  ')
disp('  In the example above the term was entered as a symbolic MATLAB expression.')
disp('  Using symbolic expressions is subject to certain restrictions of MATLAB syntax.')
disp('  For example it is not valid to enter equations, like')
disp('  >>mml(a=pi/4*d^2)')
disp('  To avoid some restrictions it is possible to enter the term as a character ')
disp('  string using apostrophes, like in the following example. The character string is')
disp('  passed to the Symbolic Toolbox''s Maple Kernel for interpretation. The term has ')
disp('  to be entered in valid Maple or MATLAB syntax.')
disp('  ')
disp('  >>mml(''a=pi/4*d^2'')')
disp('  ')
disp('[Press any key to demonstrate]')
pause
disp('  ')
disp('  Now the webbrowser opens and displays the term.')
mml('a=pi/4*d^2')
disp('  ')
disp('  ')
disp('[Press any key to continue with Example 2]')
pause
disp('  ')
disp('  Example 2: MML')
disp('  ')
disp('  A useful feature of MML is the possibility of displaying the current content ')
disp('  of the global variable ANS by simply typing MML.')
disp('  To demonstrate this we assume that ANS contains i.e. a symbolic matrix.')
disp('  ')
disp('  >> [x1 x2 x3; y1 y2 y3]')
disp('  ')
disp('  ans =')
disp('  ')
disp('  [ x1, x2, x3]')
disp('  [ y1, y2, y3]')
disp('  ')
disp('  >>mml')
disp('  ')
disp('[Press any key to demonstrate]')
pause
disp('  ')
disp('  Now the webbrowser opens and displays the content of ANS, here: the matrix.')
mml('[x1 x2 x3; y1 y2 y3]')
disp('  ')
disp('  ')
disp('[Press any key to continue]')
pause
disp('  ')
disp('  Example 3: Options')
disp('  ')
disp('  This example demonstrates the use of the display options ''type'' and ''nwb''.')
disp('  Both options can be used in each syntax variation of the MML function.')
disp('  If MathML code typed in the Command Window is needed in addition to displaying')
disp('  the term in the webbrowser, the option ''type'' can be used.')
disp('  ')
disp('  >>mml(sqrt(a),''type'')')
disp('  ')
disp('[Press any key to demonstrate]')
pause
disp('  ')
disp('  Now the webbrowser is opened displaying the term and the corresponding ') 
disp('  MathML code is typed in the Command Window.')
disp('  ')
disp('  ')
mml('sqrt(a)','type')
disp('  ')
disp('  ')
disp('[Press any key to continue]')
pause
disp('  ')
disp('  The following example shows the use of the ''type'' option with the syntax ')
disp('  of EXAMPLE 2: MML.')
disp('  ')
disp('  >> sqrt(a)')
disp('  ')
disp('  ans =')
disp('  ')
disp('  sqrt(a)')
disp('  ')
disp('  >>mml(''type'')')
disp('  ')
disp('[Press any key to demonstrate]')
pause
disp('  ')
disp('  Now the webbrowser is opened displaying the content of ANS ') 
disp('  and the corresponding MathML code is typed in the Command Window.')
disp('  ')
disp('  ')
mml('sqrt(a)','type')
disp('  ')
disp('  ')
disp('[Press any key to continue]')
pause
disp('  ')
disp('  If only MathML code typed in the Command Window is needed instead of displaying')
disp('  the term in the webbrowser, the option ''nwb''("No Web Browser") can be used.')
disp('  ')
disp('  >>mml(sqrt(a),''nwb'')')
disp('  ')
disp('[Press any key to demonstrate]')
disp('  ')
pause
disp('  The MathML code of the term is now typed in the Command Window.')
disp('  The webbrowser is not opened.')
disp('  ')
disp('  ')
mml('sqrt(a)','nwb')
disp('  ')
disp('  ')
disp('[Press any key to continue]')
pause
disp('  ')
disp('  The following example shows the use of the ''nwb'' option with the syntax ')
disp('  of EXAMPLE 2: MML.')
disp('  ')
disp('  >> sqrt(a)')
disp('  ')
disp('  ans =')
disp('  ')
disp('  sqrt(a)')
disp('  ')
disp('  >>mml(''nwb'')')
disp('  ')
disp('[Press any key to demonstrate]')
disp('  ')
pause
disp('  Now the MathML code of the content of ANS is typed in the Command Window.')
disp('  The webbrowser is not opened.')
disp('  ')
disp('  ')
mml('sqrt(a)','nwb')
disp('  ')
disp('  ')
disp('[Press any key to continue]')
pause
disp('  ')
disp('  Example 4: "Torture Test"')
disp('  ')
disp('  The following example demonstrates a term with higher complexity. ')
disp('  The displayed term makes no mathematical sense. It has been choosen to contain')
disp('  a number of different mathematical aspects.')
disp('  ')
disp('  >>mml(''g(x+y)<=asinh(exp(15^(1/3)*pi^factorial(x)))/(a*x^2-b*x+c)+2/3-2.5*y'')')
disp('  ')
disp('[Press any key to demonstrate]')
disp('  ')
pause
mml('g(x+y)<=asinh(exp(15^(1/3)*pi^factorial(x)))/(a*x^2-b*x+c)+2/3-2.5*y')
disp('  ')
disp('  End of MMLDEMO.')
disp('  ')
disp('  See also: help MML ')
