--- loncom/homework/lonmaxima.pm 2007/05/29 20:56:39 1.15 +++ loncom/homework/lonmaxima.pm 2007/07/11 18:50:33 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Interface routines to MAXIMA CAS # -# $Id: lonmaxima.pm,v 1.15 2007/05/29 20:56:39 albertel Exp $ +# $Id: lonmaxima.pm,v 1.17 2007/07/11 18:50:33 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -121,7 +121,7 @@ sub maxima_eval { sub compareterms { my ($socket,$terma,$termb)=@_; - my $difference=$terma.'-'.$termb; + my $difference=$terma.'-('.$termb.')'; if (&blacklisted($difference)) { return 'Error: blacklisted'; } my $reply=&maximareply($socket,'trigsimp(trigreduce('.$difference.'));'); if ($reply=~/^\s*0\s*$/) { return 'true'; } @@ -134,7 +134,10 @@ sub maxima_check { my $socket=&connect(); my $reply=&compareterms($socket,$response,$answer); &disconnect($socket); + # integer to string mappings come from capaParser.h + # 1 maps to 'EXACT_ANS' if ($reply eq 'true') { return 1; } + # 7 maps to 'INCORRECT' return 7; }