version 1.31, 2001/07/19 21:26:22
|
version 1.33, 2001/07/27 18:15:04
|
Line 25 sub caparesponse_check {
|
Line 25 sub caparesponse_check {
|
my $calc=''; |
my $calc=''; |
my ($response,$expr)=@_; |
my ($response,$expr)=@_; |
|
|
|
|
($answer,$type,$tol,$sig,$ans_fmt, |
($answer,$type,$tol,$sig,$ans_fmt, |
$unit,$calc) = eval $expr.';return ($answer,$type,$tol,$sig,$ans_fmt,$unit,$calc);'; |
$unit,$calc) = eval $expr.';return ($answer,$type,$tol,$sig,$ans_fmt,$unit,$calc);'; |
#type's definitons come from capaParser.h |
#type's definitons come from capaParser.h |
my $message=''; |
my $message=''; |
|
#remove leading and trailing whitespace |
|
if ($response=~ /^\s|\s$/) { |
|
$response=~ s:^\s+|\s+$::g; |
|
$message .="Removed ws now :$response:<br />"; |
|
} else { |
|
$message .="no ws in :$response:<br />"; |
|
} |
|
|
if ($type eq '' ) { |
if ($type eq '' ) { |
$message .= "Didn't find a type :$type:$expr: defaulting<br />"; |
$message .= "Didn't find a type :$type:$expr: defaulting<br />"; |
if ( $answer eq ($answer *1.0)) { $type = 2; |
if ( $answer eq ($answer *1.0)) { $type = 2; |
Line 99 sub caparesponse_check_list {
|
Line 108 sub caparesponse_check_list {
|
my $current_answer; |
my $current_answer; |
$result.="Got response :$CAPARESPONSE_CHECK_LIST_answer:$list[0]:<br />"; |
$result.="Got response :$CAPARESPONSE_CHECK_LIST_answer:$list[0]:<br />"; |
my @responselist; |
my @responselist; |
|
my $type =eval $expr.';return $answer;'; |
if ($type ne '' && $#list > 0) { |
if ($type ne '' && $#list > 0) { |
(@responselist)=split /,/,$response; |
(@responselist)=split /,/,$response; |
} else { |
} else { |
Line 258 sub random_noncentral_f {
|
Line 268 sub random_noncentral_f {
|
} |
} |
|
|
sub random_multivariate_normal { |
sub random_multivariate_normal { |
my ($item_cnt,$seed,@mean) = @_; |
my ($item_cnt,$seed,$mean,$covar) = @_; |
return "Number of deviates must be greater than 0" if $item_cnt <= 0; |
|
my (@covar,@retArray); |
|
my $ind = 0; |
|
while ($ind<$item_cnt) { |
|
push @covar, pop (@mean); |
|
$ind++; |
|
} |
|
&random_set_seed_from_phrase($seed); |
&random_set_seed_from_phrase($seed); |
@retArray=&math_random_multivariate_normal($item_cnt,@mean,@covar); |
@retArray=&math_random_multivariate_normal($item_cnt,@$mean,@$covar); |
return @retArray; |
return @retArray; |
} |
} |
|
|