[LON-CAPA-users] coding a customresponse problem using &cas()

Damien Guillaume damieng at msu.edu
Tue May 26 22:36:37 EDT 2015

> This seems to work as expected for square matrices. However, the example
> below accepts ([2,-2,-4],[-1,3,4]) as an answer, even though
> &cas('maxima','rank(matrix'.$submission.'^^2-matrix'.$submission.')')
> should generate an error in MAXIMA:
> (%i1) A:matrix([2,-2,-4],[-1,3,4]);                               [  2
>    - 2  - 4 ]
> (%o1)                          [               ]
>                                 [ - 1   3    4  ]
> (%i2) rank(A^^2 - A);
> MULTIPLYMATRICES: attempt to multiply nonconformable matrices.
>   -- an error. To debug this try: debugmode(true);

It looks like maximareply() in lonmaxima.pm does not recognize this 
error message as an error message (it is only checking if there is 
"incorrect" in the reply). I guess the best solution would be to fix 
that, but maybe there is a way to tell if the result of the cas call 
makes sense or not (like testing if it is an integer), as a workaround.


More information about the LON-CAPA-users mailing list