# DBsubject('Calculus') ## DBchapter('Infinite Sequences and Series') # DBsection('Alternating Series') # KEYWORDS('calculus', 'series', 'sequences', 'alternating series', 'convergence') # TitleText1('Calculus: Early Transcendentals') # EditionText1('2') # AuthorText1('Rogawski') # Section1('10.4') # Problem1('13') # Author('LA Danielson') # Institution('The College of Idaho') DOCUMENT(); #Load Necessary Macros loadMacros("PG.pl", "PGbasicmacros.pl", "PGchoicemacros.pl", "PGanswermacros.pl", ); loadMacros("Parser.pl"); loadMacros("freemanMacros.pl"); Context()->variables->add(n=>'Real'); #Book Values #$series = \sum (-1)^(n+1)/n^4$errorp = random(4,5,1); $plus = random(1,2,1);$exponent = $errorp +$plus; $tolerance =10**(-$errorp); $terms = Formula("(-1)^(n+1)/(n^($exponent))"); #$error = 10**($errorp/$exponent)-1;$error = sprintf "%.2f",10**($errorp/$exponent)-1; $N = Real(int($error) + 1); $answer=0;$sum = "1"; @sign = ("-","+"); for($i=1;$i<=$N;$i++){ $answer+=$terms->eval(n=>$i); if($i>1){ $sum.="$sign[$i%2]\frac{1}{$i^{$exponent}}"; } } Context()->texStrings; BEGIN_TEXT \{ beginproblem() \} \{ textbook_ref_exact("Rogawski ET 2e", "10.4", "13") \}$PAR Approximate the value of the series to within an error of at most $$10^{-errorp}$$. $\sum_{n=1}^{\infty} \frac{ (-1)^{n+1}}{n^{exponent}}$ According to Equation (2): $\left| S_N-S \right|\le a_{N+1}$ what is the smallest value of $$N$$ that approximates $$S$$ to within an error of at most $$10^{-errorp}$$? $BR $$N =$$ \{ ans_rule() \}$PAR $$S\approx$$ \{ ans_rule() \} END_TEXT Context()->normalStrings; Context()->flags->set(tolerance=>$tolerance); #Answer Check Time! ANS($N->cmp); ANS(Real("$answer")->cmp); Context()->texStrings; SOLUTION(EV3(<<'END_SOLUTION'));$PAR \$SOL Let $$S = \sum _{n=1}^{\infty} \frac{ (-1)^{n+1}}{n^{exponent}}$$, so that $$a_n = \frac{1}{n^{exponent}}$$. By Equation (2), $| S_N - S | \le a_{N+1} = \frac{1}{(N+1)^{exponent}}.$ To make the error less than $$10^{-errorp}$$, we must choose $$N$$ so that $\frac{1}{(N+1)^{exponent}} < 10^{-errorp} \qquad\textrm{or}\qquad N > 10^\frac{errorp}{exponent}-1\approx error.$ The smallest value that satisfies the required inequality is then $$N=N$$. Thus, $S \approx S_{N} = sum = answer$ END_SOLUTION ENDDOCUMENT()