[npl] / trunk / NationalProblemLibrary / ASU-topics / setExponentialFunctions / jj1.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/ASU-topics/setExponentialFunctions/jj1.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 297 - (download) (annotate)
Wed Jun 28 22:52:53 2006 UTC (6 years, 10 months ago) by jj
File size: 2495 byte(s)
Fixed some tags.

    1 ## DESCRIPTION
    2 ## Precalculus: Exponential and Logarithm Functions
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS ('precalculus','exponential function','exponential growth')
    6 ## Tagged by cmd6a 3/12/06
    7 
    8 ## DBsubject('Algebra')
    9 ## DBchapter('Exponential and Logarithmic Functions')
   10 ## DBsection('Applications of Exponential and Logarithmic Functions')
   11 ## Date('')
   12 ## Author('')
   13 ## Institution('ASU')
   14 ## TitleText1('')
   15 ## EditionText1('')
   16 ## AuthorText1('')
   17 ## Section1('')
   18 ## Problem1('')
   19 
   20 DOCUMENT();        # This should be the first executable line in the problem.
   21 
   22 loadMacros(
   23 "PG.pl",
   24 "PGbasicmacros.pl",
   25 "PGchoicemacros.pl",
   26 "PGanswermacros.pl",
   27 "PGauxiliaryFunctions.pl",
   28 "PGasu.pl"
   29 );
   30 
   31 TEXT(beginproblem());
   32 
   33 #
   34 # Now we do the randomization of variables, and other computations
   35 # as needed for this problem.  Sometimes we compute the answers here.
   36 #
   37 
   38 $a = random(2,4);
   39 $a1= $a+1;
   40 @awords = ("", "", "Two", "Three", "Four", "Five");
   41 $aw = $awords[$a];
   42 $b = random(20,50, 5);
   43 $rt = list_random(180, 190, 210, 220, 230, 240);
   44 if($a == 4) { $rt = list_random(160, 170, 180); }
   45 
   46 
   47 $fd = list_random("egg salad", "fruit salad", "potato salad",
   48 "twirly macaroni salad");
   49 
   50 
   51 #
   52 # Now the problem text itself, with ans_rule's to indicate where the
   53 # answers go.  You can stop entering text, do more computations, and then
   54 # start up again if you want.
   55 #
   56 
   57 BEGIN_TEXT
   58 Bacteria X has a relative growth rate of $rt $PERCENT (under ideal conditions).
   59 Some bacteria X are accidentally introduced into some $fd. $aw hours after
   60 contamination, there were $b,000 bacteria X in the $fd.
   61   $BR$BR
   62 Find the initial number of bacteria X introduced into the $fd:
   63 $BR$BR
   64   \{ans_rule(40)\} bacteria
   65 $BR$BR
   66 Estimate the number of bacteria in the food $a1 hours after contamination.
   67 $BR$BR
   68   \{ans_rule(40)\} bacteria
   69 END_TEXT
   70 
   71 #
   72 # Tell WeBWork how to test if answers are right.  These should come in the
   73 # same order as the answer blanks above.  You tell WeBWork both the type of
   74 # "answer evaluator" to use, and the correct answer.
   75 #
   76 
   77 ANS(num_cmp("$b*1000/e^($a*$rt/100)", tolType=>'absolute', tol=>'0.5'));
   78 
   79 $stud1 = $inputs_ref->{AnSwEr1};
   80 $stud1 = '' unless defined($stud1);
   81 $ss1 = num_cmp("$b*1000/e^($a*$rt/100)", tolType=>'absolute', tol=>'0.5')->evaluate($stud1);
   82 $score = $ss1->{score};
   83 
   84 if($score) {
   85 ANS(pc_evaluator([[num_cmp($b*1000*exp($rt/100))],
   86 [num_cmp("($stud1) * exp($rt*$a1/100)")]]) );
   87 } else {
   88 ANS(num_cmp($b*1000*exp($rt/100)));
   89 }
   90 
   91 ENDDOCUMENT();        # This should be the last executable line in the problem.
   92 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9