[npl] / trunk / NationalProblemLibrary / ASU-topics / setSequenceandSeries / factorial2.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/ASU-topics/setSequenceandSeries/factorial2.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 61 - (download) (annotate)
Sat Jan 14 02:13:08 2006 UTC (7 years, 4 months ago) by jj
File size: 1045 byte(s)
New problems for the library.

    1 ##DESCRIPTION
    2 ##   Simplify factorials
    3 ##ENDDESCRIPTION
    4 
    5 ##KEYWORDS('factorials')
    6 
    7 #
    8 # First comes some stuff that appears at the beginning of every problem
    9 #
   10 
   11 DOCUMENT();        # This should be the first executable line in the problem.
   12 
   13 loadMacros(
   14 "PG.pl",
   15 "PGbasicmacros.pl",
   16 "PGchoicemacros.pl",
   17 "PGanswermacros.pl",
   18 "PGauxiliaryFunctions.pl",
   19 "PGasu.pl"
   20 );
   21 
   22 TEXT(&beginproblem);
   23 
   24 #
   25 # Choose the denominator
   26 #
   27 
   28 $b = random(1,30);
   29 
   30 #Pick how many more the numerator will be
   31 $c = random(1,5);
   32 
   33 #Calculate the numerator
   34 $a = $b + $c;
   35 
   36 #calculate the answer
   37 $ans = $a;
   38 for($j=$b+1; $j<$a; $j++) {
   39   $ans *= $j;
   40 }
   41 
   42 #Now the problem
   43 
   44 
   45 BEGIN_TEXT
   46 Evaluate \[\frac{$a !}{$b !}\]
   47   $PAR
   48   \(\frac{$a !}{$b !}\) =\{ans_rule(40)\}
   49 END_TEXT
   50 
   51 #
   52 # Tell WeBWork how to test if answers are right.  These should come in the
   53 # same order as the answer blanks above.  You tell WeBWork both the type of
   54 # "answer evaluator" to use, and the correct answer.
   55 #
   56 
   57 &ANS(num_cmp($ans));
   58 
   59 ENDDOCUMENT();        # This should be the last executable line in the problem.
   60 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9