[LON-CAPA-users] math rendering engine

Justin Gray lon-capa-users@mail.lon-capa.org
Tue, 19 Jan 2010 00:59:50 -0800


--0016e68e8acd74b0ee047d80b272
Content-Type: text/plain; charset=ISO-8859-1

When displaying equations, setting the display attribute within the <m> tag
to "jsMath" is generally discouraged as it requires users to have
installed jsmath software on their computer and will override their
preferences on how math equations are displayed.

I have tried viewing the problem below on several computers and jsMath seems
to be the only math rendering engine that lets me view the equations
properly. (With tth the equations do not show up at all and with mimetex the
equations are incomprehensible.) I am reluctant to force users to jsMath for
this problem. Perhaps there is another way to remedy this problem?

Any suggestions are appreciated.

Thanks,
Justin

Justin Gray | Senior Lecturer
Department of Mathematics | Simon Fraser University
8888 University Drive, Burnaby | V5A 1S6 | Canada
Tel: +1 778.782.4237

<problem>
<script type="loncapa/perl">
$function1 = "(x^2 - 1)^2";
$function2 = "sqrt(x^2 - 1)";
$function3 = "3/(2 + x^2)";
$function4 = "2/(3 + sqrt(1 + x))";
$displayfunction1 = &xmlparse('<m>$(x^2 - 1)^2$</m>');
$displayfunction2 = &xmlparse('<m>$\sqrt{x^2 - 1}$</m>');
$displayfunction3 = &xmlparse('<m>$\displaystyle \frac{3}{2 + x^2}$</m>');
$displayfunction4 = &xmlparse('<m>$\displaystyle \frac{2}{3 + \sqrt{1 +
x}}$</m>');
$example1=&xmlparse('Many answers are possible. One example would be
<m>$f(x) = x^2, \quad g(x) = x^2 - 1$</m>');
$example2=&xmlparse('Many answers are possible. One example would be
<m>$f(x) = \sqrt{x}, \quad g(x) = x^2 - 1$</m>');
$example3=&xmlparse('Many answers are possible. One example would be
<m>$f(x) = 3/x, \quad g(x) = 2 + x^2$</m>');
$example4=&xmlparse('Many answers are possible. One example would be
<m>$f(x) = 2/(3 + x), \quad g(x) = \sqrt{1 + x}$</m>');
$n = &random(1,4,1);
$function = &choose($n,"$function1","$function2","$function3","$function4");
$displayfunction =
&choose($n,"$displayfunction1","$displayfunction2","$displayfunction3","$displayfunction4");
$example = &choose($n,"$example1","$example2","$example3","$example4");
</script>

<startouttext /><p>Give an example of two nontrivial functions <m>$f$</m>
and <m>$g$</m> such that <m eval="on">$(f \circ g)(x) = $displayfunction
$</m>.</p>Enter your answer in the form
<p><b>expression1,expression2</b></p> where <m>$f(x) = $</m>
<b>expression1</b> and <m>$g(x) = $</m>
<b>expression2</b>.<p></p><endouttext />

<mathresponse answerdisplay="$example" cas="maxima" args="$function"
id="11">
    <answer>f(x) := RESPONSE[1];
g(x) := RESPONSE[2];
h(x) := LONCAPALIST[1];
composition:is(trigsimp(f(g(x)) - h(x)) = 0);
fnottrivial:is(not(f(x) = x));
gnottrivial:is(not(g(x) = x));
composition and fnottrivial and gnottrivial;</answer>
    <textline readonly="no" size="20" />
    <hintgroup showoncorrect="no">
        <mathhint name="composition not equal" cas="maxima" args="$function"
id="12">
            <answer>f(x) := RESPONSE[1];
g(x) := RESPONSE[2];
h(x) := LONCAPALIST[1];
is(not(f(g(x)) = h(x)));</answer>
        </mathhint>
<hintpart on="composition not equal">
    <startouttext /><p>Your example does not satisfy <m eval="on">$(f \circ
g)(x) = f(g(x)) = $displayfunction $</m>.</p><endouttext />
</hintpart>
    </hintgroup>
    <hintgroup showoncorrect="no">
        <mathhint name="f trivial" cas="maxima" id="13">
            <answer>f(x) := RESPONSE[1];
is(f(x) = x);</answer>
        </mathhint>
<hintpart on="f trivial">
    <startouttext /><p>The question asks for nontrivial functions, and so
you cannot use <m>$f(x) = x$</m>.</p><endouttext />
</hintpart>
    </hintgroup>
    <hintgroup showoncorrect="no">
        <mathhint name="g trivial" cas="maxima" id="14">
            <answer>g(x) := RESPONSE[2];
is(g(x) = x);</answer>
        </mathhint>
<hintpart on="g trivial">
    <startouttext /><p>The question asks for nontrivial functions, and so
you cannot use <m>$g(x) = x$</m>.</p><endouttext />
</hintpart>
    </hintgroup>
</mathresponse>
</problem>

--0016e68e8acd74b0ee047d80b272
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

When displaying equations, setting the display attribute within the &lt;m&g=
t; tag to &quot;jsMath&quot; is generally discouraged as it requires users =
to have<br>installed jsmath software on their computer and will override th=
eir preferences on how math equations are displayed. <br>

<br>I have tried viewing the problem below on several computers and jsMath =
seems to be the only math rendering engine that lets me view the equations =
properly. (With tth the equations do not show up at all and with mimetex th=
e equations are incomprehensible.) I am reluctant to force users to jsMath =
for this problem. Perhaps there is another way to remedy this problem?<br>

<br>Any suggestions are appreciated. <br><br>Thanks,<br>Justin<br><br clear=
=3D"all">Justin Gray | Senior Lecturer<br>Department of Mathematics | Simon=
 Fraser University<br>8888 University Drive, Burnaby | V5A 1S6 | Canada<br>

Tel: +1 778.782.4237<br><br>&lt;problem&gt;<br>&lt;script type=3D&quot;lonc=
apa/perl&quot;&gt;<br>$function1 =3D &quot;(x^2 - 1)^2&quot;;<br>$function2=
 =3D &quot;sqrt(x^2 - 1)&quot;;<br>$function3 =3D &quot;3/(2 + x^2)&quot;;<=
br>
$function4 =3D &quot;2/(3 + sqrt(1 + x))&quot;;<br>
$displayfunction1 =3D &amp;xmlparse(&#39;&lt;m&gt;$(x^2 - 1)^2$&lt;/m&gt;&#=
39;);<br>$displayfunction2 =3D &amp;xmlparse(&#39;&lt;m&gt;$\sqrt{x^2 - 1}$=
&lt;/m&gt;&#39;);<br>$displayfunction3 =3D &amp;xmlparse(&#39;&lt;m&gt;$\di=
splaystyle \frac{3}{2 + x^2}$&lt;/m&gt;&#39;);<br>

$displayfunction4 =3D &amp;xmlparse(&#39;&lt;m&gt;$\displaystyle \frac{2}{3=
 + \sqrt{1 + x}}$&lt;/m&gt;&#39;);<br>$example1=3D&amp;xmlparse(&#39;Many a=
nswers are possible. One example would be &lt;m&gt;$f(x) =3D x^2, \quad g(x=
) =3D x^2 - 1$&lt;/m&gt;&#39;);<br>

$example2=3D&amp;xmlparse(&#39;Many answers are possible. One example would=
 be &lt;m&gt;$f(x) =3D \sqrt{x}, \quad g(x) =3D x^2 - 1$&lt;/m&gt;&#39;);<b=
r>$example3=3D&amp;xmlparse(&#39;Many answers are possible. One example wou=
ld be &lt;m&gt;$f(x) =3D 3/x, \quad g(x) =3D 2 + x^2$&lt;/m&gt;&#39;);<br>

$example4=3D&amp;xmlparse(&#39;Many answers are possible. One example would=
 be &lt;m&gt;$f(x) =3D 2/(3 + x), \quad g(x) =3D \sqrt{1 + x}$&lt;/m&gt;&#3=
9;);<br>$n =3D &amp;random(1,4,1);<br>$function =3D &amp;choose($n,&quot;$f=
unction1&quot;,&quot;$function2&quot;,&quot;$function3&quot;,&quot;$functio=
n4&quot;);<br>

$displayfunction =3D &amp;choose($n,&quot;$displayfunction1&quot;,&quot;$di=
splayfunction2&quot;,&quot;$displayfunction3&quot;,&quot;$displayfunction4&=
quot;);<br>$example =3D &amp;choose($n,&quot;$example1&quot;,&quot;$example=
2&quot;,&quot;$example3&quot;,&quot;$example4&quot;);<br>

&lt;/script&gt;<br><br>&lt;startouttext /&gt;&lt;p&gt;Give an example of tw=
o nontrivial functions &lt;m&gt;$f$&lt;/m&gt; and &lt;m&gt;$g$&lt;/m&gt; su=
ch that &lt;m eval=3D&quot;on&quot;&gt;$(f \circ g)(x) =3D $displayfunction=
 $&lt;/m&gt;.&lt;/p&gt;Enter your answer in the form &lt;p&gt;&lt;b&gt;expr=
ession1,expression2&lt;/b&gt;&lt;/p&gt; where &lt;m&gt;$f(x) =3D $&lt;/m&gt=
; &lt;b&gt;expression1&lt;/b&gt; and &lt;m&gt;$g(x) =3D $&lt;/m&gt; &lt;b&g=
t;expression2&lt;/b&gt;.&lt;p&gt;&lt;/p&gt;&lt;endouttext /&gt;<br>

<br>&lt;mathresponse answerdisplay=3D&quot;$example&quot; cas=3D&quot;maxim=
a&quot; args=3D&quot;$function&quot; id=3D&quot;11&quot;&gt;<br>=A0=A0=A0 &=
lt;answer&gt;f(x) :=3D RESPONSE[1];<br>g(x) :=3D RESPONSE[2];<br>h(x) :=3D =
LONCAPALIST[1];<br>

composition:is(trigsimp(f(g(x)) - h(x)) =3D 0);<br>fnottrivial:is(not(f(x) =
=3D x));<br>gnottrivial:is(not(g(x) =3D x));<br>composition and fnottrivial=
 and gnottrivial;&lt;/answer&gt;<br>=A0=A0=A0 &lt;textline readonly=3D&quot=
;no&quot; size=3D&quot;20&quot; /&gt;<br>

=A0=A0=A0 &lt;hintgroup showoncorrect=3D&quot;no&quot;&gt;<br>=A0=A0=A0=A0=
=A0=A0=A0 &lt;mathhint name=3D&quot;composition not equal&quot; cas=3D&quot=
;maxima&quot; args=3D&quot;$function&quot; id=3D&quot;12&quot;&gt;<br>=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &lt;answer&gt;f(x) :=3D RESPONSE[1];<br>

g(x) :=3D RESPONSE[2];<br>h(x) :=3D LONCAPALIST[1];<br>is(not(f(g(x)) =3D h=
(x)));&lt;/answer&gt;<br>=A0=A0=A0=A0=A0=A0=A0 &lt;/mathhint&gt;<br>&lt;hin=
tpart on=3D&quot;composition not equal&quot;&gt;<br>=A0=A0=A0 &lt;startoutt=
ext /&gt;&lt;p&gt;Your example does not satisfy &lt;m eval=3D&quot;on&quot;=
&gt;$(f \circ g)(x) =3D f(g(x)) =3D $displayfunction $&lt;/m&gt;.&lt;/p&gt;=
&lt;endouttext /&gt;<br>

&lt;/hintpart&gt;<br>=A0=A0=A0 &lt;/hintgroup&gt;<br>=A0=A0=A0 &lt;hintgrou=
p showoncorrect=3D&quot;no&quot;&gt;<br>=A0=A0=A0=A0=A0=A0=A0 &lt;mathhint =
name=3D&quot;f trivial&quot; cas=3D&quot;maxima&quot; id=3D&quot;13&quot;&g=
t;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &lt;answer&gt;f(x) :=3D RESPONSE[1]=
;<br>

is(f(x) =3D x);&lt;/answer&gt;<br>=A0=A0=A0=A0=A0=A0=A0 &lt;/mathhint&gt;<b=
r>&lt;hintpart on=3D&quot;f trivial&quot;&gt;<br>=A0=A0=A0 &lt;startouttext=
 /&gt;&lt;p&gt;The question asks for nontrivial functions, and so you canno=
t use &lt;m&gt;$f(x) =3D x$&lt;/m&gt;.&lt;/p&gt;&lt;endouttext /&gt;<br>

&lt;/hintpart&gt;<br>=A0=A0=A0 &lt;/hintgroup&gt;<br>=A0=A0=A0 &lt;hintgrou=
p showoncorrect=3D&quot;no&quot;&gt;<br>=A0=A0=A0=A0=A0=A0=A0 &lt;mathhint =
name=3D&quot;g trivial&quot; cas=3D&quot;maxima&quot; id=3D&quot;14&quot;&g=
t;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &lt;answer&gt;g(x) :=3D RESPONSE[2]=
;<br>

is(g(x) =3D x);&lt;/answer&gt;<br>=A0=A0=A0=A0=A0=A0=A0 &lt;/mathhint&gt;<b=
r>&lt;hintpart on=3D&quot;g trivial&quot;&gt;<br>=A0=A0=A0 &lt;startouttext=
 /&gt;&lt;p&gt;The question asks for nontrivial functions, and so you canno=
t use &lt;m&gt;$g(x) =3D x$&lt;/m&gt;.&lt;/p&gt;&lt;endouttext /&gt;<br>

&lt;/hintpart&gt;<br>=A0=A0=A0 &lt;/hintgroup&gt;<br>&lt;/mathresponse&gt;<=
br>&lt;/problem&gt;<br><br><br><br>

--0016e68e8acd74b0ee047d80b272--