# [LON-CAPA-users] Code to accept multiple answers

Peter Dencker dencker at math.uni-luebeck.de
Thu Jun 18 08:54:32 EDT 2015


But it is not  completely equivalent to use
$result = 4*ln(1/2); or$result = "4*ln(1/2)";

To compare in the latter case mathematical expressions the use of
'(rat(radcan(...))' seems to be more appropriate here.

<problem>

<script type="loncapa/perl">
our $result = "4*ln(1/2)"; </script> <mathresponse answerdisplay="$result" cas="maxima" args="$result"> <answer> ln(x):= log(x); is(rat(radcan(RESPONSE-(LONCAPALIST)))=0); </answer> <textline readonly="no" size="50" /> </mathresponse> </problem> - Peter Am 06/18/2015 um 02:23 AM schrieb Justin Gray: > One could also do this using mathresponse with the same idea to define > ln(x):=log(x) > > <problem> > > <script type="loncapa/perl"> >$answer=4*log(1/2);
> </script>
>
> <startouttext />
> <p>Enter an answer equivalent to <m>$4*\ln(1/2)$</m>.</p>
> <endouttext />
>
> is ( trigsimp(trigreduce(RESPONSE - LONCAPALIST)) < 0.000001
>
>      <textline readonly="no" size="50" spellcheck="none" />
> </mathresponse>
> </problem>
>
> This accepts 4*ln(1/2), 4*log(1/2), 4*(ln(1) - ln(2)), ln(1/2^4), etc,...
>
> This problem has no randomization, but could be modified. (In this case you
> may need to pass any random parameters to Maxima using an argument array.)
> What is it that you are asking students to calculate?
>
> Justin
>
>
> Justin Gray | Senior Lecturer
> Department of Mathematics | Simon Fraser University
> 8888 University Drive, Burnaby | V5A 1S6 | Canada
> Tel: +1 778.782.4237
>

--
Dr. Peter Dencker
wissenschaftl. Mitarbeiter

UNIVERSITÄT ZU LÜBECK
INSTITUT FÜR MATHEMATIK

Ratzeburger Allee 160
23562 Lübeck

Tel +49 451 500 4254
Fax +49 451 500 3373
dencker at math.uni-luebeck.de

www.math.uni-luebeck.de