version 1.105, 2005/11/16 23:17:39
|
version 1.108, 2006/06/30 21:24:27
|
Line 117 sub caparesponse_check {
|
Line 117 sub caparesponse_check {
|
if ( $answer eq ($answer *1.0)) { $type = 2; |
if ( $answer eq ($answer *1.0)) { $type = 2; |
} else { $type = 3; } |
} else { $type = 3; } |
} else { |
} else { |
if ($type eq 'cs') { $type = 4; } |
if ($type eq 'cs') { $type = 4; } |
elsif ($type eq 'ci') { $type = 3 } |
elsif ($type eq 'ci') { $type = 3 } |
elsif ($type eq 'mc') { $type = 5; } |
elsif ($type eq 'mc') { $type = 5; } |
elsif ($type eq 'fml') { $type = 8; } |
elsif ($type eq 'fml') { $type = 8; } |
|
elsif ($type eq 'math') { $type = 9; } |
elsif ($type eq 'subj') { $type = 7; } |
elsif ($type eq 'subj') { $type = 7; } |
elsif ($type eq 'float') { $type = 2; } |
elsif ($type eq 'float') { $type = 2; } |
elsif ($type eq 'int') { $type = 1; } |
elsif ($type eq 'int') { $type = 1; } |
Line 149 sub caparesponse_check {
|
Line 150 sub caparesponse_check {
|
($sig_ubound,$sig_lbound)=&LONCAPA_INTERNAL_get_sigrange($sig); |
($sig_ubound,$sig_lbound)=&LONCAPA_INTERNAL_get_sigrange($sig); |
|
|
my $reterror=""; |
my $reterror=""; |
my $result = &caparesponse_capa_check_answer($response,$answer,$type, |
my $result; |
|
if ($type eq '9') { |
|
$result = &maxima_check(&maxima_cas_formula_fix($response),&maxima_cas_formula_fix($answer),\$reterror); |
|
} else { |
|
$result = &caparesponse_capa_check_answer(&capa_formula_fix($response),&capa_formula_fix($answer),$type, |
$tol_type,$tol, |
$tol_type,$tol, |
$sig_lbound,$sig_ubound, |
$sig_lbound,$sig_ubound, |
$ans_fmt,$unit,$calc,$id_list, |
$ans_fmt,$unit,$calc,$id_list, |
$points,$external::randomseed, |
$points,$external::randomseed, |
\$reterror); |
\$reterror); |
|
} |
if ($result == '1') { $result='EXACT_ANS'; } |
if ($result == '1') { $result='EXACT_ANS'; } |
elsif ($result == '2') { $result='APPROX_ANS'; } |
elsif ($result == '2') { $result='APPROX_ANS'; } |
elsif ($result == '3') { $result='SIG_FAIL'; } |
elsif ($result == '3') { $result='SIG_FAIL'; } |
Line 179 sub caparesponse_check {
|
Line 184 sub caparesponse_check {
|
return ("$result:\nRetError $reterror:\nAnswer $answer:\nResponse $response:\n type-$type|$tol|$tol_type|$sig:$sig_lbound:$sig_ubound|$unit|\n$message",$reterror); |
return ("$result:\nRetError $reterror:\nAnswer $answer:\nResponse $response:\n type-$type|$tol|$tol_type|$sig:$sig_lbound:$sig_ubound|$unit|\n$message",$reterror); |
} |
} |
|
|
|
sub maxima_cas_formula_fix { |
|
my ($expression)=@_; |
|
return &implicit_multiplication($expression); |
|
} |
|
|
|
sub capa_formula_fix { |
|
my ($expression)=@_; |
|
return &implicit_multiplication($expression); |
|
} |
|
|
|
sub implicit_multiplication { |
|
my ($expression)=@_; |
|
$expression=~s/\s+/\*/g; |
|
$expression=~s/(\d)([a-zA-Z\(])/$1\*$2/g; |
|
$expression=~s/\)(\w)/\)\*$1/g; |
|
return $expression; |
|
} |
|
|
sub caparesponse_check_list { |
sub caparesponse_check_list { |
my $response=$LONCAPA::CAPAresponse_args{'response'}; |
my $response=$LONCAPA::CAPAresponse_args{'response'}; |
Line 210 sub caparesponse_check_list {
|
Line 232 sub caparesponse_check_list {
|
$result.="Final final response :$responselist['-1']:$unit:\n"; |
$result.="Final final response :$responselist['-1']:$unit:\n"; |
$unit=~s/\s//; |
$unit=~s/\s//; |
|
|
my ($awards, @msgs); |
my ($awards, @msgs, $i); |
foreach my $thisanswer (@LONCAPA::CAPAresponse_answer) { |
foreach my $thisanswer (@LONCAPA::CAPAresponse_answer) { |
my ($msg,$aresult); |
my ($msg,$aresult); |
$result.="trying answer :$thisanswer:\n"; |
$result.="trying answer :$thisanswer:\n"; |
Line 231 sub caparesponse_check_list {
|
Line 253 sub caparesponse_check_list {
|
$awards.="$temp,"; |
$awards.="$temp,"; |
$result.=$aresult; |
$result.=$aresult; |
push(@msgs,$msg); |
push(@msgs,$msg); |
|
$i++; |
} |
} |
chop($awards); |
chop($awards); |
return ("$awards:\n$result",@msgs); |
return ("$awards:\n$result",@msgs); |