# [LON-CAPA-users] alternate notation

Peter Riegler lon-capa-users@mail.lon-capa.org
Wed, 21 Oct 2009 20:41:16 +0200

```Hi Justin,

is it something like the following that you have in mind? There
o ln(y^n)
o n*ln(y)
o log(y^n)
o n*log(y)
o and stuff like n/2*ln(y^2)

Peter

<problem>
<script type="loncapa/perl">
\$n = &random(2,5,1);
\$var = "y"; #could be randomized
\$rhs = "\$var^\$n";
\$sol = "\$n ln(\$var)"; #preferably to be determined computationally
</script>

<startouttext />
Solve for <m>\$ x \$</m>: <m eval="on">\$ \exp(x) = \$rhs \$</m><br/>
x =
<endouttext />

rhs: LONCAPALIST[1];
ln(x):= log(x);
sol: ln(rhs);
is( RESPONSE[1] = sol);

</mathresponse>

</problem>

Peter Riegler wrote:
> Hi Justin,
>
> we solve this kind of problems by telling maxima how to handle ln. This
> requires the use of mathresponse (formularesponse uses maxima, but does
> not allow you to write maxima code for grading).
>
> You could for instance define ln
>
> <mathresponse answerdisplay="\$F" cas="maxima" args="@args" id="11">
>   ln(x):= log(x);
>   is ( RESPONSE[1]=LONCAPALIST[1] );
>   ...
>
> or substitute
>
> <mathresponse answerdisplay="\$F" cas="maxima" args="@args" id="11">
>   is ( subst(log,ln,RESPONSE[1]=LONCAPALIST[1]) );
>
> In both examples \$args[0]=LONCAPALIST[1] contains the correct answer.
>
> I hope this will help
>
> Peter
>
>
> Justin Gray wrote:
>> I seem to recall that there is a way to specify an alternate notation
>> within the <script> tags of a problem, but cannot recall how to do
>> this. If a student submits an answer using natural logs with the
>> Maxima will understand it?
>>
>> Thanks,
>> Justin
>>
>> P.S. I know that I can specify a collection of answers in formula
>> response problems, but I want ln to be treated as log so that
>> equivalent answers will be recognized, such as ln(x^n) and n*ln(x).
>>
>> Justin Gray | Senior Lecturer
>> Department of Mathematics | Simon Fraser University
>> 8888 University Drive, Burnaby | V5A 1S6 | Canada
>> Tel: +1 778.782.4237 | Fax: +1 778.782.4947 | Email: jgray@math.sfu.ca
>> <mailto:jgray@math.sfu.ca>
>>
>>
>

--
Peter Riegler
Fakultät Informatik
Ostfalia Hochschule für angewandte Wissenschaften
Fachhochschule Braunschweig/Wolfenbüttel
Salzdahlumer Str. 46/48
38302 Wolfenbüttel
Fon: ++49 5331 939 31540
http://public.rz.fh-wolfenbuettel.de/~riegler

```