[LON-CAPA-cvs] cvs: loncom /imspackages imsprocessor.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Wed, 13 Jul 2005 17:42:55 -0000
raeburn Wed Jul 13 13:42:55 2005 EDT
Modified files:
/loncom/imspackages imsprocessor.pm
Log:
Additional conversions of WebCT math functions. More to follow.
Index: loncom/imspackages/imsprocessor.pm
diff -u loncom/imspackages/imsprocessor.pm:1.22 loncom/imspackages/imsprocessor.pm:1.23
--- loncom/imspackages/imsprocessor.pm:1.22 Tue Jul 12 12:05:59 2005
+++ loncom/imspackages/imsprocessor.pm Wed Jul 13 13:42:53 2005
@@ -3256,6 +3256,11 @@
|;
foreach my $numid (@{$$settings{$id}{numids}}) {
my $formula = $$settings{$id}{$numid}{formula};
+ $formula =~ s/ln/\&log/g;
+ $formula =~ s/sqrt/\&sqrt/g;
+ $formula =~ s/sin/\&sin/g;
+ $formula =~ s/cos/\&cos/g;
+ $formula =~ s/exp/\&exp/g;
foreach my $var (keys %{$$settings{$id}{$numid}{vars}}) {
my $decnum = $$settings{$id}{$numid}{vars}{$var}{dec};
my $increment = '0.';
@@ -3269,9 +3274,7 @@
}
$increment .= '1';
}
- $formula =~ s/{($var)}/\$$1/g;
- $formula =~ s/ln\(?([^\)])\)?/ &log($1) /g;
- $formula =~ s/sqrt/\&sqrt/g;
+ $formula =~ s/{($var)}/(\$$1)/g;
$scriptblock .= qq|
\$$var=&random($$settings{$id}{$numid}{vars}{$var}{min},$$settings{$id}{$numid}{vars}{$var}{max},$increment);
|;