[LON-CAPA-users] catching maxima errors
Peter Dencker
dencker at math.uni-luebeck.de
Mon Nov 26 11:41:47 EST 2012
Hi Gerd,
below I give a simple example. The input of 'x)' (an example, the
parentheses are not balanced) causes the 'Internal error ...'.
Thanks.
- Peter
<problem>
<script type="loncapa/perl">
$result = 'x';
</script>
<startouttext />
Type a maxima formula equivalent to 'x'.
<endouttext />
<customresponse id="p0r0">
<answer type="loncapa/perl">
$bool = &cas('maxima',"is(ratexpand($submission = $result))") ;
if ( $bool eq 'true') {return 'EXACT_ANS';};
if ( $bool eq 'false') {return 'INCORRECT';};
return 'BAD_FORMULA';
</answer>
<startouttext />
<br /> <textline readonly="no" /> <br />
<endouttext />
</customresponse>
</problem>
Gerd Kortemeyer schrieb:
> Hi,
>
> On Nov 26, 2012, at 10:00 AM, Peter Dencker <dencker at math.uni-luebeck.de> wrote:
>>
>> executing a syntactically incorrect answer with maxima using
>> customresponse causes a crash remark 'Internal error ...' and a 'bomb'
>> in the construction space of the author. In comparison, mathresponse
>> returns 'BAD_FORMULA'.
>
> Something else must be wrong inside <customresponse>. A call to &cas() inside <customresponse> will always just return whatever the last output of MAXIMA was, which is either the result or a MAXIMA error message; no possibility of an internal error, unless there is an error inside the surrounding Perl code or an invalid value is returned from <customresponse> answer script.
>
> - Gerd.
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>
More information about the LON-CAPA-users
mailing list