[LON-CAPA-users] coding a customresponse problem using &cas()
Peter Riegler
p.riegler at ostfalia.de
Tue May 26 10:45:54 EDT 2015
Hi Justin,
maybe
/res/fhwf/riegler/Mathematik/Lineare
Algebra/Matrizen/matrix_mit_rang_angeben.problem
could serve as a template.
I agree, the code looks horrible. Essentially it does
1. read out the matrix values from the html textfields
2. make a maxima-formatted matrix out of that
3. compute the rank of that matrix
Steps 2 und 3 are done by getMatrixRang in the library
/res/fhwf/riegler/Mathematik/Lineare Algebra/Libraries/matrix.library
sub getMatrixRang {
my ($mat) = @_;
my @matrix = @$mat;
my $str = "matrix(";
foreach my $ref_zeile (@matrix) {
my $zeile = join( ',', @$ref_zeile );
$str .= "[$zeile],";
}
$str =~ s/,$/)/g;
$str = "rank($str);";
$rank = &main::cas('maxima',"$str");
return $rank;
}
I suppose it should suffice to change the last three lines to
$checkifidempotent = "is($str . $str = $str);"; # $str is the
student provided matrix formatted in maxima
$isidempotent = &main::cas('maxima',"$checkifidempotent");
and then check whether $isidempotent is "true" or "false".
Sorry that I don't test the code myself. Other obligations are calling...
One final comment, though:
On 26.05.2015 03:49, Justin Gray wrote:
> 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.
>
I had similar concerns when I specified the "give me an example of a
matrix of given rank"-problem on which the above is based. Based on
occasional checks it seems that at least in my linear algebra class
almost no student comes up with trivial solutions (echelon forms in this
case). I guess it takes some familiarity with a concept and some time to
be able to come up with trivial solutions.
Peter
>
> Justin Gray | Senior Lecturer
> Department of Mathematics | Simon Fraser University
> 8888 University Drive, Burnaby | V5A 1S6 | Canada
> Tel: +1 778.782.4237
>
>
>
>
> _______________________________________________
> LON-CAPA-users mailing list
> LON-CAPA-users at mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>
--
Peter Riegler
Ostfalia Hochschule für angewandte Wissenschaften
Hochschule Braunschweig/Wolfenbüttel
Salzdahlumer Str. 46/48
38302 Wolfenbüttel
Fakultät Informatik
Fon: ++49 5331 939 31540
http://ostfalia.de/pws/riegler
Zentrum für erfolgreiches Lehren und Lernen
Fon: ++49 5331 939 17200
http://www.ostfalia.de/zell
More information about the LON-CAPA-users
mailing list