[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 101 - (download) (annotate)
Wed Feb 22 20:38:15 2006 UTC (7 years, 3 months ago) by jjholt
File size: 1371 byte(s)
Tags as of Feb 22, 2006.
--JH

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9