--- loncom/homework/default_homework.lcpm 2001/05/25 21:20:19 1.20 +++ loncom/homework/default_homework.lcpm 2001/05/30 15:24:53 1.22 @@ -3,7 +3,6 @@ # # #init some globals -#use Math::Trig; # # Guy Albertelli # @@ -11,6 +10,8 @@ # $RANDOMINIT=0; $pi=atan2(1,1)*4; +$rad2deg=180.0/$pi; +$deg2rad=$pi/180.0; sub caparesponse_check { my $answer=''; #done @@ -151,10 +152,12 @@ sub random { } sub tan { sin($_[0]) / cos($_[0]) } -sub atan { atan2($_[0], 1); } -sub acos { atan2(sqrt(1 - $_[0] * $_[0]), $_[0] ); } -sub asin { atan2($_[0], sqrt(1- $_[0] * $_[0]) ); } +#sub atan { atan2($_[0], 1); } +#sub acos { atan2(sqrt(1 - $_[0] * $_[0]), $_[0] ); } +#sub asin { atan2($_[0], sqrt(1- $_[0] * $_[0]) ); } + sub log10 { log($_[0])/log(10); } + sub factorial { my $input = int(shift); return "Error - unable to take factorial of an negative number ($input)" if $input < 0; @@ -230,6 +233,34 @@ sub map { } } +sub name{ + my $fullname = &EXT('environment.lastname').', '.&EXT('environment.firstname').' '.&EXT('environment.middlename'); + $fullname = "" if $fullname eq ", "; + 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 { &EXT('resource.0.opendate') } +sub due_date { &EXT('resource.0.duedate') } +sub answer_date { &EXT('resource.0.answerdate') } + sub choose { my $num = $_[0]; return $_[$num];