<?xml version="1.0" encoding="UTF-8"?>
<Worksheet><Version major="6" minor="1"/><View-Properties><Zoom percentage="100"/></View-Properties><Styles><Layout alignment="left" bullet="none" linespacing="0.0" name="Heading 3" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="left" bullet="none" linespacing="0.0" name="Heading 2" spaceabove="8.0" spacebelow="2.0"/><Layout alignment="left" bullet="none" linespacing="0.0" name="Heading 1" spaceabove="8.0" spacebelow="4.0"/><Layout alignment="left" bullet="none" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Normal" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Font background="[0,0,0]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" name="Maple Input" opaque="false" size="12"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Text" opaque="false" size="12" underline="false"/><Font background="[0,0,0]" bold="true" family="Serif" italic="true" name="Heading 3" opaque="false" size="14"/><Font background="[0,0,0]" bold="true" family="Serif" name="Heading 2" opaque="false" size="16"/><Font background="[0,0,0]" bold="true" family="Serif" name="Heading 1" opaque="false" size="18"/></Styles><Section><Title><Text-field layout="Heading 1" style="Heading 1"><Font executable="true" foreground="[255,0,0]">Appendix A</Font></Text-field></Title><Section><Title><Text-field layout="Heading 1" style="Heading 1">Maple code for exercises in section A.1</Text-field></Title><Section><Title><Text-field layout="Heading 1" style="Heading 1">1.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">wallis := n -&gt; evalf( product( 4*k^2/(4*k^2-1),k=1..n));</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">Show that the average value of the upper and lower bounds on Pi can be computer as</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">wallisaverage := n -&gt; 2*evalf( product( 4*k^2/(4*k^2-1),k=1..n)*(1+1/(4*n)) );</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 1" style="Heading 1">7.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">evalf( binomial(1,1/2),20 );</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">evalf( 4/Pi, 20);</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 1" style="Heading 1">13.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">evalf( binomial(1,1/3),20);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">evalf(1/int((1-x^(3/2))^(1/3), x=0..1),20);</Text-field></Input></Group></Section></Section><Section><Title><Text-field layout="Heading 1" style="Heading 1">Maple code for exercises in section A.2</Text-field></Title><Section><Title><Text-field layout="Heading 1" style="Heading 1">1.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The nth Bernoulli number is stored in Maple as bernoulli(n). The following command generates a list of the first forty Bernoulli numbers</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq(bernoulli(n),n=1..40)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">We can now use the recursive formula for Bernoulli polynomials:</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">B := (n,x) -&gt; if n=1 then x-1/2 else n*int(B(n-1,t),t=0..x)+bernoulli(n) end if;</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq(B(n,x),n=1..10)];</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 1" style="Heading 1">2.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">for n from 1 to 8 do plot(B(n,x),x=-1..2) end do;</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 1" style="Heading 1">8 &amp; 9</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The command NB(n) finds the numberator of the 2nth Bernoulli number. Thus, the numerator of B_20 is NB[10]. The command DB(n) finds the denominator.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">NB := n -&gt; numer(bernoulli(2*n)); DB := n -&gt; denom(bernoulli(2*n));</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The following commands list the factorizations of the numerators and of the denoninators of the Bernoulli numbers. The first column gives the value of n (it is the Bernoulli number for 2n), the second column list the prime divisors, and the third column gives the powers of each of those prime divisors.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq([n,ifactor(NB(n))],n=1..20)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq([n,ifactor(DB(n))],n=1..20)];</Text-field></Input></Group></Section></Section><Section><Title><Text-field layout="Heading 2" style="Heading 2">Maple code for exercises in section A.3</Text-field></Title><Section><Title><Text-field layout="Heading 3" style="Heading 3">1.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The following command calculates the difference between the sum of the reciprocals of the first n perfect squares and Pi^2/6.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">df := n -&gt; evalf( sum(1/k^2,k=1..n) - Pi^2/6,10);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq( [100*n, df(100*n)],n=1..10)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The next command adds 1/n to the sum of the reciprocals of the first n squares.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">dfplus := n -&gt; evalf( 1/n + sum(1/k^2,k=1..n) - Pi^2/6,10);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq( [100*n, dfplus(100*n)],n=1..10)];</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 3" style="Heading 3">2.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The following command calculates the difference between the sum of the reciprocals of the first n fourth and sixth powers and the exact values of the infinite series.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">df4 := n -&gt; evalf( sum(1/k^4,k=1..n) - Pi^4/90,10);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq( [100*n, df4(100*n)],n=1..10)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">df6 := n -&gt; evalf( sum(1/k^6,k=1..n) - Pi^6/945,10);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq( [100*n, df6(100*n)],n=1..10)];</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 3" style="Heading 3">8.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">P := (n,x) -&gt; 1 + sum( bernoulli(k)*x^k/k!,k=1..n);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The following command superimposes the the polynomials that approximate x/(exp(x)-1).</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">plot([P(4,x),P(6,x),P(8,x),P(10,x),P(12,x),x/(exp(x)-1)],x=-8..8);</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 3" style="Heading 3">11.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The command given below will find these derivatives, but notice that the denominators are 0. Show that in the limit as x approaches 0, these all approach the correct values.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">for n from 1 to 3 do simplify(diff(x/(exp(x)-1),x$n)) end do;</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 3" style="Heading 3">14.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">Q := (n,x) -&gt; 1 + sum((-1)^k * bernoulli(2*k)*(2*x)^(2*k)/(2*k)!, k=1..n);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">plot([Q(2,x),Q(4,x),Q(6,x),Q(8,x),x+cot(x)],x=-4..4);</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 3" style="Heading 3">17.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">R := (n,z) -&gt; 1/z + 2*sum( z/(z^2-k^2*Pi^2), k=1..n);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">plot([R(3,x),R(6,x),R(9,x),R(12,x),cot(x)],x=-4..4,y=-1..1);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The following command plots the differences between the cotangent and each of thes seies. Use these graphs to give a reasonable approximation of the error function cot(x)-R(n,x)</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">for n from 1 to 4 do plot(cot(x) - R(3*n,x),x=-4..4) end do;</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 3" style="Heading 3">20.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">If we evaluate the first 1000 terms of this series, then we obtain a value that is between</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">evalf(1/(2*1001^2), 10);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">and</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">evalf(1/(2*1000^2), 10);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">below the true value of zeta(3), and therfore zeta(3) lies in the interval</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[evalf(sum(1/k^3,k=1..1000)+1/(2*1001^2),12),evalf(sum(1/k^3,k=1..1000)+1/(2*1000^2),12)];</Text-field></Input></Group></Section></Section><Section><Title><Text-field layout="Heading 2" style="Heading 2">Maple code for exercises in section A.4</Text-field></Title><Section><Title><Text-field layout="Heading 3" style="Heading 3">2.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The command StirlingTriple produces three numbers: n, n! (to 10-digit accuracy), and Stirling's formula for n with the first two terms of the asymptotic series (to 10-digit accuracy).</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">StirlingTriple := x -&gt; [x,evalf(x!,10),evalf( (x/exp(1))^x*sqrt(2*Pi*x)*exp(1/(12*x) - 1/(30*x^3)), 10)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq(StirlingTriple(x),x in [5, 10, 20, 50, 100])];</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 3" style="Heading 3">3.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The following command finds the aboluate value of the mth summand in the asymptotic series, evaluated at n.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">Summand := (m,n) -&gt; abs(bernoulli(2*m)/((2*m)*(2*m-1)*n^(2*m-1)));</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The next command lists the absolute values of the summands, taking 20 summands between 1 and 10n.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">ListSummands := n -&gt; [seq([floor(m*n/2), evalf(Summand(floor(m*n/2),n),10)],m=1..20)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">ListSummands(10);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">To refine your search, the following commmands lists all the summands in the range a to b</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">RefineSearch := (n,a,b) -&gt; [seq([m,evalf(Summand(m,n),10)],m=a..b)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">RefineSearch(10,25,40);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">This command allows to compare the value of the approximation to n! with the best asymptotic estimate (to m terms):</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">Cf := (n,m) -&gt; [n!,evalf( (n/exp(1))^n *sqrt(2*Pi*n)*exp(sum(bernoulli(2*k)/(2*k*(2*k - 1)*n^(2*k - 1)), k=1..m))),ceil(log10(n!))];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">Cf(10,3);</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 3" style="Heading 3">5.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The first command calculates 1/2 + the sum of the first n terms. The second produces a table of these values as n goes from 1 to 10. The third command gives the actual value of Euler's gamma to 10-digit accuracy for purposes of comparison.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">GammaApprox := n -&gt; evalf( 1/2 + sum(bernoulli(2*k)/(2*k), k=1..n), 10);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">[seq([n,GammaApprox(n)],n=1..10)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">evalf(gamma,10);</Text-field></Input></Group></Section><Section><Title><Text-field layout="Heading 3" style="Heading 3">6.</Text-field></Title><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The following command finds the aboluate value of the mth summand in the asymptotic series, evaluated at n.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">HarmonicSummand := (m,n) -&gt; abs( bernoulli(2*m)/(2*m*n^(2*m)) ) ;</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">The next commmand lists the absolute values of the summands, taking 20 summands between 1 and 10n.</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">ListHarmonicSummands := n -&gt; [seq( [floor(m*n/2), evalf( Summand(floor(m*n/2),n), 10)],m=1..20)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">ListHarmonicSummands(10);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">To refine your search, the following commmands lists all the summands in the range a to b</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">RefineHarmonicSearch := (n,a,b) -&gt; <Font italic="false" underline="false">[</Font>seq([m,evalf( Summand(m,n),10)],m=a..b)];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">RefineHarmonicSearch(10,25,40);</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input"><Font style="Text">This command allows you to compare the value of the approximation to the harmonic series with the best asymptotic estimate (to m terms):</Font></Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">HarmonicCf := (n,m) -&gt; [ evalf(sum((1/k),k=1..n),n), evalf( ln(n) + gamma + 1/(2*n) - sum(bernoulli(2*k)/(2*k*n^(2*k)), k=1..m) , n) ];</Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">HarmonicCf(10,3);</Text-field></Input></Group></Section></Section></Section><Text-field/></Worksheet>
