[npl] / trunk / NationalProblemLibrary / Rochester / setSeries5IntegralTest / ns8_3_24eva.pg Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# View of /trunk/NationalProblemLibrary/Rochester/setSeries5IntegralTest/ns8_3_24eva.pg

Mon May 8 17:05:32 2006 UTC (7 years ago) by jjholt
File size: 2226 byte(s)
Added tags.


    1 ## DESCRIPTION
2 ##   Infinite Series with the Integral Test
3 ## ENDDESCRIPTION
4
5 ## KEYWORDS('Series', 'Converge', 'Diverge', Integral Test', 'Partial Sum', 'Estimate', 'Error')
6 ## Tagged by nhamblet
7
8 ## DBsubject('Calculus')
9 ## DBchapter('Infinite Sequences and Series')
10 ## DBsection('The Integral Test and Estimates of Sums')
11 ## Date('')
12 ## Author('')
13 ## Institution('Rochester')
14 ## TitleText1('')
15 ## EditionText1('')
16 ## AuthorText1('')
17 ## Section1('')
18 ## Problem1('')
19
20 DOCUMENT();        # This should be the first executable line in the problem.
21
23 "PG.pl",
24 "PGbasicmacros.pl",
25 "PGchoicemacros.pl",
27 "PGauxiliaryFunctions.pl"
28 );
29
30 TEXT(beginproblem());
31 $showPartialCorrectAnswers = 1; 32 33$a = random(1,10,1);
34 $b = random(1,10,1); 35$c = random(3,8,1);
36 #$accuracy = random(0,.000001,.00000001); 37$d = random(3,6,1);
38 $c1 =$c - 1 ;
39
40 if ($d==3) { 41$nth = '3rd';
42 } elsif ($d==4) { 43$nth = '4th';
44 } elsif ($d==5) { 45$nth = '5th';
46 } else {
47   $nth = '6th'; 48 } 49 50 51 BEGIN_TEXT 52 53 $$(a)$$ Compute $$s_{d}$$ (the$nth partial sum) of
54   $$\displaystyle s=\sum_{n=1}^{\infty}\frac{a}{b n^c}$$$BR 55 \{ans_rule(45)\}$BR
56 $$(b)$$ Estimate the error in using $$s_{d}$$ as an approximation of the sum
57   of the series. (i.e. use $$\displaystyle \int_{d}^{\infty} f(x)dx \geq R_{d}$$ ) $BR 58 \{ans_rule(30)\}$BR
59 $$(c)$$ Use n = $d and 60 $s_n + \int_{n+1}^{\infty} f(x)dx \leq s \leq s_n + \int_{n}^{\infty}f(x)dx$ 61 to find a better estimate of the sum.$BR
62   \{ans_rule(35)\} $$\leq s \leq$$  \{ans_rule(35)\}
63 END_TEXT
64
65 # a simple code to perform a summation. (for A)
66   $i = 1; 67$sum = 0;
68   while ($i <=$d ) {
69                 $fofi =$a/($b*$i**$c); 70$sum = $sum +$fofi;
71     $i =$i +1 ;
72   }
73 #to make sure that the answer is always an integer (for D)
74 # $terms = (1/(3*$accuracy))**(1/3);
75 # if ($terms != int($terms)) {
76 #   $terms =$terms +1 ;
77 #   }
78 #@ans=();
79 $ans0 =$sum ;
80 $ans1 =$a/($b*$c1*$d**$c1);
81 $ans2 =$sum + $a/($b*$c1*($d+1)**$c1); 82$ans3 = $sum +$a/($b*$c1*$d**$c1);
83
84 #ANS(num_cmp(relTol=>@ans));
85 #ANS(ordered_num_cmp_list(@ans) );
86 ANS(num_cmp($ans0)); 87 ANS(num_cmp($ans1));
88 ANS(num_cmp($ans2)); 89 ANS(num_cmp($ans3));
90
91 ENDDOCUMENT();        # This should be the last executable line in the problem.


 aubreyja at gmail dot com ViewVC Help Powered by ViewVC 1.0.9