[LON-CAPA-users] catching maxima errors

Gerd Kortemeyer korte at lite.msu.edu
Mon Nov 26 11:58:48 EST 2012


Hi,

Weird, I copied and pasted your code, and it works for me without bombs, even if I input "x)". I can get it to do right, wrong, and "unable to understand formula."

Did you "Reset Submissions" and "New Randomization," to make sure all caches are cleared from possibly wrong edits in the past?

Just for testing, can you change the last line to

    return 'INCORRECT';

and see if it still bombs for "x)"?

Unless MAXIMA is not really running (or running in German, or something), I cannot see how this happens. Works for me …

- Gerd.


On Nov 26, 2012, at 11:41 AM, Peter Dencker <dencker at math.uni-luebeck.de> wrote:

> 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
>> 
> 
> _______________________________________________
> 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