MathML is used by the system for both the display of complicated math expressions as well as for content in math expressions (mathematical meaning).
For small expressions, you can use the mathml(f) function to create inline MathML expressions, in effect, to force the system to render an expression defined in calculator syntax as a typeset math expression.
Example
qu.1.8.mode=Formula@
qu.1.8.name=Fractions@
qu.1.8.editing=useHTML@
qu.1.8.algorithm=
$a=range(1,8);
$num=$mathml("(x/2)=$a");
$ans=$a*2;
@
qu.1.8.question=
Solve for x:
<br> $num@
qu.1.8.answer=$ans@
For larger expressions, you can include the MathML code for the expressions directly in questions, answers, comments, hints, and solutions in your question bank.
Example
The following is an example of MathML code used to create an expression inside a question script:
qu.1.5.mode=Equation@
qu.1.5.name=<b>Equations with algorithmic MathML feedback</b>@
qu.1.5.comment=
Use the slope/intercept form of the line to find the equation as
<math>
<mo>(</mo><mi>y</mi>
<mo>-</mo>
<mn>$yone</mn><mo>)</mo>
<mo>=</mo>
<mfrac>
<mrow><mn>$ytwo</mn>
<mo>-</mo>
<mn>$yone</mn></mrow>
<mrow><mn>$xtwo</mn>
<mo>-</mo>
<mn>$xone</mn></mrow>
</mfrac>
<mo>(</mo><mi>x</mi>
<mo>-</mo>
<mn>$xone</mn><mo>)</mo>
</math>
@
qu.1.5.editing=useHTML@
qu.1.5.algorithm=
$xone=decimal(1, rand(0,10));
$xtwo=decimal(1, rand(0,10));
condition: ne($xone,
$xtwo);
$yone=decimal(1, rand(0,10));
$ytwo=decimal(1, rand(0,10));
$m=($ytwo
- $yone)/($xtwo-$xone);
$b=-$m*$xone
+ $yone;
@
qu.1.5.question=
What is the equation of the straight line passing through the points
($xone,
$yone) and
($xtwo, $ytwo)?
<br>
@
qu.1.5.answer=
y = $m
x + $b
@
You can also generate MathML using Maple.
qu.1.5.mode=Equation@
qu.1.5.name=<b>Equations with algorithmic MathML feedback</b>@
qu.1.5.comment=
Use the slope/intercept form of the line to find the equation as
$Solution.
@
qu.1.5.editing=useHTML@
qu.1.5.algorithm=
$xone=decimal(1, rand(0,10));
$xtwo=decimal(1, rand(0,10));
condition: ne($xone,
$xtwo);
$yone=decimal(1, rand(0,10));
$ytwo=decimal(1, rand(0,10));
$m=($ytwo
- $yone)/($xtwo-$xone);
$b=-$m*$xone
+ $yone;
$Solution=maple("fprint(MathML:-ExportPresentation(y=$m*x
+ $b))");
@
qu.1.5.question=
What is the equation of the straight line passing through the points
($xone,
$yone) and
($xtwo, $ytwo)?
<br>
@
qu.1.5.answer=
y = $m
x + $b
@
See Also: