Diff for /loncom/homework/default_homework.lcpm between versions 1.122 and 1.123

version 1.122, 2006/12/15 21:15:42 version 1.123, 2006/12/15 22:11:43
Line 256  sub caparesponse_check { Line 256  sub caparesponse_check {
     return ($result,$reterror)      return ($result,$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)=@_;  
 # Escape scientific notation, so 3e8 does not become 3*e*8  
 # 3e8 -> 3&8; 3e-8 -> 3&-8; 3E+8 -> e&+8  
     $expression=~s/(\d+)e([\+\-]*\d+)/$1\&\($2\)/gsi;  
 # 3x10^8 -> 3&8; 3*10^-8 -> 3&-8  
     $expression=~s/(\d+)(?:x|\*)10(?:\^|\*\*)([\+\-]*\d+)/$1\&\($2\)/gsi;  
 # Fill in multiplication signs  
 # a b -> a*b;3 b -> 3*b;3 4 -> 3*4  
     $expression=~s/(\w)\s+(\w)/$1\*$2/gs;  
 # )( -> )*(; ) ( -> )*(  
     $expression=~s/\)\s*\(/\)\*\(/gs;  
 # 3a -> 3*a; 3( -> 3*(; 3 ( -> 3*(; 3A -> 3*A  
     $expression=~s/(\d)\s*([a-zA-Z\(])/$1\*$2/gs;  
 # a ( -> a*(  
     $expression=~s/(\w)\s+\(/$1\*\(/gs;  
 # )a -> )*a; )3 -> )*3; ) 3 -> )*3  
     $expression=~s/\)\s*(\w)/\)\*$1/gs;  
 # 3&8 -> 3e8; 3&-4 -> 3e-4  
     $expression=~s/(\d+)\&\(([\+\-]*\d+)\)/$1e$2/gs;  
     return $expression;  
 }  
   
 sub caparesponse_check_list {  sub caparesponse_check_list {
     my $responses=$LONCAPA::CAPAresponse_args{'response'};      my $responses=$LONCAPA::CAPAresponse_args{'response'};

Removed from v.1.122  
changed lines
  Added in v.1.123


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>