[npl] / trunk / NationalProblemLibrary / Rochester / setIntegrals25RationalFunctions / ur_in_25_12.pg Repository:
ViewVC logotype

View of /trunk/NationalProblemLibrary/Rochester/setIntegrals25RationalFunctions/ur_in_25_12.pg

Parent Directory Parent Directory | Revision Log Revision Log


Revision 588 - (download) (annotate)
Mon Oct 15 20:50:45 2007 UTC (5 years, 7 months ago) by jj
File size: 2351 byte(s)
Fixed bug 1359, missing +C.  Also updated to math objects for better
display.

    1 ## DESCRIPTION
    2 ## Calculus
    3 ## ENDDESCRIPTION
    4 
    5 ## KEYWORDS('integral' 'partial fraction')
    6 ## Tagged by tda2d
    7 
    8 ## DBsubject('Calculus')
    9 ## DBchapter('Techniques of Integration')
   10 ## DBsection('Integration by Partial Fractions')
   11 ## Date('')
   12 ## Author('')
   13 ## Institution('Rochester')
   14 ## TitleText1('')
   15 ## EditionText1('')
   16 ## AuthorText1('')
   17 ## Section1('')
   18 ## Problem1('')
   19 ## TitleText2('Calculus: Early Transcendentals')
   20 ## EditionText2('1')
   21 ## AuthorText2('Rogawski')
   22 ## Section2('7.6')
   23 ## Problem2('3')
   24 
   25 DOCUMENT();        # This should be the first executable line in the problem.
   26 
   27 loadMacros(
   28 "PG.pl",
   29 "PGbasicmacros.pl",
   30 "PGanswermacros.pl",
   31 "Parser.pl"
   32 );
   33 
   34 TEXT(beginproblem());
   35 $showPartialCorrectAnswers = 1;
   36 
   37 $a = non_zero_random(-5,5,1);
   38 $av = abs($a);
   39 $bs = random(2,3,1);
   40 $b = $bs * $bs;
   41 while ($b==$av) {
   42    $bs = random(2,3,1);
   43    $b = $bs * $bs;
   44    };
   45 
   46 $generator = random(0,1,1);
   47 
   48 if ($generator == 0) {
   49    $A = non_zero_random(-5,6,1);
   50    $B = non_zero_random(-5,6,1);
   51    $C = 0;
   52    while($A == -$B) {$B = non_zero_random(-5,5,1)};
   53 
   54    $soln = "$A*ln(abs(x+$a))+$B*ln(x**2+$b)/2";
   55 
   56    $x2_coeff = $A+$B;
   57    $x_coeff  = $a * $B;
   58    $const    = $A * $b;
   59     }
   60 
   61 if ($generator == 1) {
   62    $A = non_zero_random(-5,5,1);
   63    $B = 0;
   64    $C = non_zero_random(-5,5,1);
   65    $temp1 = -$A*$b;
   66    $temp2 = $a*$C;
   67    while($temp1 == $temp2) {
   68       $C = non_zero_random(-5,5,1);
   69       $temp2 = $a*$C;
   70       };
   71 
   72    $soln = "$A*ln(abs(x+$a))+$C*arctan(x/$bs)/$bs";
   73 
   74    $x2_coeff = $A;
   75    $x_coeff  = $C;
   76    $const    = $A*$b + $a*$C;
   77    }
   78 
   79 Context('Numeric');
   80 $num = Compute("$x2_coeff x^2 + $x_coeff x + $const")->reduce();
   81 $d1 = Compute("x+$a")->reduce();
   82 $d2 = Compute("x^2+$b")->reduce();
   83 Context()->texStrings();
   84 
   85 BEGIN_TEXT
   86 The form of the partial fraction decomposition of a rational function is given below.
   87 $BR
   88 $BR
   89 \[ \frac{$num}{($d1)($d2)}
   90         = \frac{A}{$d1} + \frac{B x + C}{$d2} \]
   91 $BR
   92 \( A = \) \{ ans_rule(10) \}
   93 \( B = \) \{ ans_rule(10) \}
   94 \( C = \) \{ ans_rule(10) \}
   95 $PAR
   96 Now evaluate the indefinite integral.
   97 $BR
   98 $BR
   99 $BCENTER
  100 \( \displaystyle\int \frac{$num}{($d1)($d2)}\, dx =\)
  101  \{ ans_rule(40) \} \(+C\)
  102 $ECENTER
  103 END_TEXT
  104 
  105 ANS(num_cmp($A));
  106 ANS(num_cmp($B));
  107 ANS(num_cmp($C));
  108 ANS(fun_cmp($soln, limits=>[-10,6], mode=>"antider", vars=>'x'));
  109 
  110 ENDDOCUMENT();        # This should be the last executable line in the problem.
  111 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9