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

Justin Gray jgray at math.sfu.ca
Mon May 25 21:49:42 EDT 2015

```I would appreciate it if someone could assist me with coding the following
problem.

Give an example of an idempotent matrix.

Ideally, I would like students to input their answer using the format
(row_1,...,row_m) using a matrix of any size, so that ([1,1],[0,0]) and
([2,-2,-4],[-1,3,4],[1,-2,-3]) would both be acceptable answers.
(A matrix *A* is *idempotent* if *A*^2=*A*.)

If I understand correctly, using a mathresponse problem is problematic in
this case because there is some preprocessing of the students submission
that makes it difficult to use in the answer algorithm, but one way around
this is to use customresponse combined with the &cas() function.

In order that Maxima understands the students submission, the expression
'matrix' needs to be appended to the front. Also, matrix exponentiation is
denoted by A^^n in Maxima. If it is easier to test a numerical condition,
one could verify that rank(A^^2 - A) = 0.

Thanks,
Justin

P.S. Ideally, I would like to stipulate that students provide a nontrivial
example (excluding the zero matrix and the identity matrix) but that is the
topic of another discussion.

Justin Gray | Senior Lecturer
Department of Mathematics | Simon Fraser University
8888 University Drive, Burnaby | V5A 1S6 | Canada
Tel: +1 778.782.4237
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20150525/79032cae/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SFU_2012_email_sig.jpg
Type: image/jpeg
Size: 8910 bytes
Desc: not available
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20150525/79032cae/attachment.jpg>
```