Diff for /loncom/homework/default_homework.lcpm between versions 1.20 and 1.23

version 1.20, 2001/05/25 21:20:19 version 1.23, 2001/05/30 21:49:13
Line 3 Line 3
 #   # 
 #  #
 #init some globals  #init some globals
 #use Math::Trig;  
 #  #
 # Guy Albertelli  # Guy Albertelli
 #  #
Line 11 Line 10
 #  #
 $RANDOMINIT=0;  $RANDOMINIT=0;
 $pi=atan2(1,1)*4;  $pi=atan2(1,1)*4;
   $rad2deg=180.0/$pi;
   $deg2rad=$pi/180.0;
   
 sub caparesponse_check {  sub caparesponse_check {
   my $answer='';  #done    my $answer='';  #done
Line 150  sub random { Line 151  sub random {
   return $result;    return $result;
 }  }
   
   sub abs { abs(shift) }
   sub sin { sin(shift) }
   sub cos { cos(shift) }
   sub exp { exp(shift) }
   sub int { int(shift) }
   sub log { log(shift) }
   sub atan2 { atan2($_[0],$_[1]) }
   sub sqrt { sqrt(shift) }
   
 sub tan  { sin($_[0]) / cos($_[0]) }  sub tan  { sin($_[0]) / cos($_[0]) }
 sub atan { atan2($_[0], 1); }  #sub atan { atan2($_[0], 1); }
 sub acos { atan2(sqrt(1 - $_[0] * $_[0]), $_[0] ); }  #sub acos { atan2(sqrt(1 - $_[0] * $_[0]), $_[0] ); }
 sub asin { atan2($_[0], sqrt(1- $_[0] * $_[0]) );  }  #sub asin { atan2($_[0], sqrt(1- $_[0] * $_[0]) );  }
   
 sub log10 { log($_[0])/log(10); }  sub log10 { log($_[0])/log(10); }
   
 sub factorial {  sub factorial {
     my $input = int(shift);      my $input = int(shift);
     return "Error - unable to take factorial of an negative number ($input)" if $input < 0;      return "Error - unable to take factorial of an negative number ($input)" if $input < 0;
Line 230  sub map { Line 242  sub map {
   }    }
 }  }
   
   sub capa_id { return }
   
   sub problem { return }
   
   sub name{
     my $fullname = &EXT('environment.lastname').', '.&EXT('environment.firstname').' '.&EXT('environment.middlename');
     $fullname = "" if $fullname eq ",  ";
     $fullname =~ s/\%2d/-/;
     return $fullname;
   }
   
   sub student_number { 
     my $id = &EXT('environment.id');
     $id = '' if $id eq "";
     return $id;
   }
   
   sub class {
     my $course = &EXT('course.description');
     $course = '' if $course eq "";
     return $course;
   }
   
   sub sec { 
     my $sec = &EXT('request.course.sec');
     $sec = '' if $sec eq "";
     return $sec;
   }
   
   sub open_date { 
     my @dc = split(/\s+/,localtime(&EXT('resource.0.opendate')));
     return $dc[0].', '.$dc[1].' '.$dc[2].', '.$dc[4].' at '.$dc[3];
   }
   
   sub due_date { 
     my @dc = split(/\s+/,localtime(&EXT('resource.0.duedate')));
     return $dc[0].', '.$dc[1].' '.$dc[2].', '.$dc[4].' at '.$dc[3];
   }
   
   sub answer_date { 
     my @dc = split(/\s+/,localtime(&EXT('resource.0.answerdate')));
     return $dc[0].', '.$dc[1].' '.$dc[2].', '.$dc[4].' at '.$dc[3];
    }
   
 sub choose {  sub choose {
   my $num = $_[0];    my $num = $_[0];
   return $_[$num];    return $_[$num];
 }  }
   
 #$external::randomseed=time;  #$external::randomseed=time;
 #$a=2;  #$a=2;
 #$b=2;  #$b=2;
 #$c=2;  #$c=2;
 #&map(1,\$a,\$b,\$c,3,4,5);  #&map(1,\$a,\$b,\$c,3,4,5);
 #print $a."\n".$b."\n";  #print $a."\n".$b."\n";
   
   
   
   
   
   

Removed from v.1.20  
changed lines
  Added in v.1.23


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