Chapter 4
<Text-field layout="Section" style="Section">Mathematica code for exercises in section 4.1</Text-field>
<Text-field layout="Subsection" style="Subsection">4.</Text-field>The first command defines Sum1[n] as the sum of the first n terms of the series. The second command generates a table of the values of the partial sums as n increases from 10 to 400 in multiples of 10.Sum1 := n -> evalf(1 + sum(k!/100^k, k = 1..n - 1), 10);seq([10*n, Sum1(10*n)], n=1..40);
<Text-field layout="Subsection" style="Subsection">5.</Text-field>First think about how you can use Stirling's formula to identify where this smallest summand is likely to occur. The follwing command finds all values of k!/100^k for a <= k <= b.TestSummand := (a,b) -> seq([k, evalf(k!/100^k, 20)], k=a..b);TestSummand(10,20);
<Text-field layout="Subsection" style="Subsection">8.</Text-field>After finding your candidate, you can test it with the commandTestBernoulliSummand := (a,b) -> seq([k, evalf(abs(bernoulli(2*k)/((2*k - 1)*(2*k)*10^(2*k - 1))), 20)], k=a..b);TestBernoulliSummand(10,20);
<Text-field layout="Subsection" style="Subsection">13.</Text-field>The first command defines Sum2[n] as the sum of the first n terms of the series. The second command generates a table of the values of the partial sums as n increases from 1000 to 2000 in multiples of 100.Sum2 := n -> evalf(sum(sin(k/100)/ln(k), k=2..n + 1), 10);seq([100*n, Sum2(100*n)], n=10..20);
<Text-field layout="Subsection" style="Subsection">14.</Text-field>Sum3 := n -> evalf(sum((-1)^k/ln(k),k = 2 .. n+1), 10);seq([100*n, Sum3(100*n)], n=10..20);Sum4 := n -> evalf(sum((-1)^k*ln(k)^2/k,k = 2 .. n+1), 10);seq([100*n, Sum4(100*n)], n=10..20);LSUkc3VtRzYkKiYpISIiJSJrRyIiIi0lJHNpbkc2IyokRihGJ0YpL0YoOyIiIywmJSJuR0YpRilGKQ==Sum5 := evalf(sum((-1)^k*sin(1/k), k = 2 .. n+1), 10);seq([100*n, Sum5(100*n)], n=10..20);LSUkc3VtRzYkKigpISIiJSJrRyIiIiktJSNsbkc2I0YoRitGKUYoISIjL0YoOyIiIywmJSJuR0YpRilGKQ==Sum6 := n -> evalf(sum((-1)^k*ln(k)^ln(k)/k^2, k = 2 .. n+1), 10);seq([100*n, Sum6(100*n)], n=10..20);
<Text-field layout="Subsection" style="Subsection">15.</Text-field>Sum7 := n -> evalf(sum((-1)^(k + 1 - 3*floor((k + 1)/3))/k, k=1..n), 10);seq([100*n, Sum7(100*n)], n=10..20);LSUkc3VtRzYkKiYpISIiLSUmZmxvb3JHNiMsJiUia0cjIiIiIiIjI0YnRi9GLkYuRixGJy9GLDtGLiUibkc=Sum8 := n -> evalf(sum((-1)^floor(1/2*k-1/2)/k, k = 1 .. n), 10);seq([100*n, Sum8(100*n)], n=10..20);LSUkc3VtRzYkKiYpISIiLSUmZmxvb3JHNiMqJCUia0cjIiIiIiIjRi5GLEYnL0YsO0YuJSJuRw==Sum9 := n -> evalf(sum((-1)^floor(k^(1/2))/k, k = 1 .. n), 10);seq([100*n, Sum9(100*n)], n=10..20);
<Text-field layout="Section" style="Section">Mathematica code for exercises in section 4.2</Text-field>
<Text-field layout="Subsection" style="Subsection">15.</Text-field>Sum10 := n -> evalf(sum((k/(2*k-1))^k,k = 1 .. n), 20);seq([20*n, Sum10(20*n)], n=1..10);
<Text-field layout="Subsection" style="Subsection">16.</Text-field>Sum11 := n -> evalf(sum((k/(2*k-1))^k*2^k,k = 1 .. n), 20); Sum12 := n -> evalf(sum((k/(2*k-1))^k*(-2)^k,k = 1 .. n), 20);seq([20*n, Sum11(20*n), Sum12(20*n)], n=1..10);
<Text-field layout="Subsection" style="Subsection">17.</Text-field>Sum13 := n -> evalf(sum(k^k/k!,k = 1 .. n), 10);seq([20*n, Sum13(20*n)], n=1..10);
<Text-field layout="Subsection" style="Subsection">18.</Text-field>Sum14 := n -> evalf(sum(k^k*exp(-k)/k!,k = 1 .. n), 20); Sum15 := n -> evalf(sum(k^k*(-exp(1))^(-k)/k!,k = 1 .. n), 20);seq([20*n, Sum14(20*n), Sum15(20*n)], n=1..15);
<Text-field layout="Subsection" style="Subsection">19.</Text-field>LSUkc3VtRzYkKiYpIiIjJSJrRyIiIkYoIyEiIkYnL0YoO0YpJSJuRw==Sum16 := n -> evalf(sum(2^k/k^(1/2), k = 1 .. n), 10);seq([20*n, Sum16(20*n)], n=1..10);
<Text-field layout="Subsection" style="Subsection">20.</Text-field>Sum17 := n -> evalf(sum(1/k/ln(k),k = 2 .. n), 20);seq([1000*n, Sum17(1000*n)], n=1..10);
<Text-field layout="Subsection" style="Subsection">21.</Text-field>Sum18 := n -> evalf(sum(1/k/ln(k)^(3/2),k = 2 .. n), 20);seq([1000*n, Sum18(1000*n)], n=1..10);
<Text-field layout="Subsection" style="Subsection">22.</Text-field>sum(1/k/ln(k)/ln(ln(k)),k = 10 .. n)Sum19 := n -> evalf(sum(1/k/ln(k)/ln(ln(k)),k = 10 .. n), 20);seq([1000*n, Sum19(1000*n)], n=1..10);
<Text-field layout="Section" style="Section">Mathematica code for exercises in section 4.3</Text-field>
<Text-field layout="Subsection" style="Subsection">6.</Text-field>sum((k/(2*k-1))^k*x^k,k = 1 .. n)FSum1 := (n,x) -> sum((k/(2*k-1))^k*x^k,k = 1 .. n);plots[display](plot(FSum1(3,x),x = -2.1 .. 2.1),plot(FSum1(6,x),x = -2.1 .. 2.1),plot(FSum1(9,x),x = -2.1 .. 2.1),plot(FSum1(12,x),x = -2.1 .. 2.1));
<Text-field layout="Subsection" style="Subsection">8. </Text-field>FSum2 := (n,x) -> sum(k^k/k!*x^k, k=1..n);plots[display](plot(FSum2(3,x),x = -.7 .. .7),plot(FSum2(6,x),x = -.7 .. .7),plot(FSum2(9,x),x = -.7 .. .7),plot(FSum2(12,x),x = -.7 .. .7));
<Text-field layout="Subsection" style="Subsection">10. </Text-field>FSum3 := (n,x) -> sum(2^k/Sqrt[k]*x^k, k=1..n);plots[display](plot(FSum3(3,x),x = -.7 .. .7),plot(FSum3(6,x),x = -.7 .. .7),plot(FSum3(9,x),x = -.7 .. .7),plot(FSum3(12,x),x = -.7 .. .7));
<Text-field layout="Subsection" style="Subsection">11.</Text-field>These summands can be simplified by realizing that product(2*i,i=1..n)/product(2*i+1,i=1..n) = 4^n (n!)^2\/(2*n + 1)!FSum4 := (n,x) -> sum(4^k*k!^2*x^k/(2*k+1)!,k = 1 .. n);plots[display](plot(FSum4(3,x),x = -.7 .. .7),plot(FSum4(6,x),x = -.7 .. .7),plot(FSum4(9,x),x = -.7 .. .7),plot(FSum4(12,x),x = -.7 .. .7));
<Text-field layout="Subsection" style="Subsection">14.</Text-field>FSum5 := (n,x) -> sum(2^k*k!*k^k*x^k/(2*k)!,k = 1 .. n);plots[display](plot(FSum5(3,x),x = -2 .. 2),plot(FSum5(6,x),x = -2 .. 2),plot(FSum5(9,x),x = -2 .. 2),plot(FSum5(12,x),x = -2 .. 2));
<Text-field layout="Subsection" style="Subsection">15.</Text-field>FSum6 := (n,x) -> sum(x^k/k^2,k = 1.. n);plots[display](plot(FSum6(3,x),x = -1.1 .. 1.1),plot(FSum6(6,x),x = -1.1 .. 1.1),plot(FSum6(9,x),x = -1.1 .. 1.1),plot(FSum6(12,x),x = -1.1 .. 1.1));FSum7 := (n,x) -> 1+sum((2*k)!*x^k/k!^2,k = 1 .. n);plots[display](plot(FSum7(3,x),x = -.4 .. .4),plot(FSum7(6,x),x = -.4 .. .4),plot(FSum7(9,x),x = -.4 .. .4),plot(FSum7(12,x),x = -.4 .. .4));FSum8 := (n,x) -> 1+sum(k!^3*x^k/(3*k)!,k = 1 .. n);plots[display](plot(FSum8(3,x),x = -30 .. 30),plot(FSum8(6,x),x = -30 .. 30),plot(FSum8(9,x),x = -30 .. 30),plot(FSum8(12,x),x = -30 .. 30));FSum9 := (n,x) -> 1+sum((2*k+1)!*x^k/(2^k)/k!^2,k = 1 .. n);plots[display](plot(FSum9(3,x),x = -.7 .. .7),plot(FSum9(6,x),x = -.7 .. .7),plot(FSum9(9,x),x = -.7 .. .7),plot(FSum9(12,x),x = -.7 .. .7));FSum10 := (n,x) -> sum(product(i^2-1,i = 2 .. k)*x^k/product(i^2,i = 2 .. k),k = 2 .. n);plots[display](plot(FSum10(3,x),x = -1.2 .. 1.2),plot(FSum10(6,x),x = -1.2 .. 1.2),plot(FSum10(9,x),x = -1.2 .. 1.2),plot(FSum10(12,x),x = -1.2 .. 1.2));FSum11 := (n,x) -> 1+sum((2*k)!^2*x^k/(4^k)/k!^4,k = 1 .. n);plots[display](plot(FSum11(3,x),x = -.3 .. .3),plot(FSum11(6,x),x = -.3 .. .3),plot(FSum11(9,x),x = -.3 .. .3),plot(FSum11(12,x),x = -.3 .. .3));FSum12 := (n,x) -> 1+sum((3*k)!*x^k/k!/(2*k)!,k = 1 .. n);plots[display](plot(FSum12(3,x),x = -.2 .. .2),plot(FSum12(6,x),x = -.2 .. .2),plot(FSum12(9,x),x = -.2 .. .2),plot(FSum12(12,x),x = -.2 .. .2));
<Text-field layout="Subsection" style="Subsection">27.</Text-field>HyperSum1 := (n,m) -> evalf(sum((product(3*i-1,i = 1 .. k)/product(3*i,i = 1 .. k))^m,k = 1 .. n), 10);seq([100*n, HyperSum1(100*n, 1)], n=1..10);seq([100*n, HyperSum1(100*n, 2)], n=1..10);seq([100*n, HyperSum1(100*n, 3)], n=1..10);seq([100*n, HyperSum1(100*n, 4)], n=1..10);
<Text-field layout="Subsection" style="Subsection">28.</Text-field>HyperSum2 := (n,m) -> evalf(sum((product(3*i-2,i = 1 .. k)/product(3*i,i = 1 .. k))^m,k = 1 .. n), 10);seq([100*n, HyperSum2(100*n, 1)], n=1..10);seq([100*n, HyperSum2(100*n, 2)], n=1..10);seq([100*n, HyperSum2(100*n, 3)], n=1..10);seq([100*n, HyperSum2(100*n, 4)], n=1..10);
<Text-field layout="Section" style="Section">Mathematica code for exercises in section 4.4</Text-field>
<Text-field layout="Subsection" style="Subsection">1.</Text-field>FSum13 := (n,x) -> evalf(sum((-1)^(k-1)*cos(1/2*(2*k-1)*Pi*x),k = 1 .. n),10);The first command plots the partial sums; the second lists them.plots[listplot]([seq([n, FSum13(n,1/2)],n = 1 .. 20)],style = POINT,symbol = CIRCLE);seq([n, FSum13(n, 1/2)], n=1..20);plots[listplot]([seq([n, FSum13(n,2/3)],n = 1 .. 20)],style = POINT,symbol = CIRCLE);seq([n, FSum13(n, 2/3)], n=1..20);plots[listplot]([seq([n, FSum13(n,3/5)],n = 1 .. 20)],style = POINT,symbol = CIRCLE);seq([n, FSum13(n, 3/5)], n=1..20);plots[listplot]([seq([n, FSum13(n,5/18)],n = 1 .. 20)],style = POINT,symbol = CIRCLE);seq([n, FSum13(n, 5/18)], n=1..20);
<Text-field layout="Subsection" style="Subsection">3.</Text-field>FSum14 := (n,x) -> evalf(sum((-1)^(k-1)*cos(1/2*(2*k-1)*Pi*x)/(2*k-1),k = 1 .. n), 10);The first command plots the partial sums for 1 <= n <= 200; the second lists the last 20 values.plots[listplot]([seq([n, FSum14(n,1/2)],n = 1 .. 200)],style = POINT,symbol = CIRCLE);seq([n, FSum14(n, 1/2)], n=181..202);plots[listplot]([seq([n, FSum14(n,2/3)],n = 1 .. 200)],style = POINT,symbol = CIRCLE);seq([n, FSum14(n, 2/3)], n=181..202);plots[listplot]([seq([n, FSum14(n,9/10)],n = 1 .. 200)],style = POINT,symbol = CIRCLE);seq([n, FSum14(n, 9/10)], n=181..202);plots[listplot]([seq([n, FSum14(n,99/100)],n = 1 .. 200)],style = POINT,symbol = CIRCLE);seq([n, FSum14(n, 99/100)], n=181..202);
<Text-field layout="Subsection" style="Subsection">6.</Text-field>FSum15 := (n,x) -> sum((-1)^(k-1)*sin(1/2*(2*k-1)*Pi*x)/(2*k-1),k = 1 .. n);plots[display](plot(FSum15(3,x),x = -2 .. 2),plot(FSum15(6,x),x = -2 .. 2),plot(FSum15(9,x),x = -2 .. 2),plot(FSum15(12,x),x = -2 .. 2));
<Text-field layout="Subsection" style="Subsection">7.</Text-field>FSum16 := (n,x) -> sin(x)*(1-cos(n*x))/(2-2*cos(x))+1/2*sin(n*x);plots[display](plot(FSum16(10,x),x = -Pi .. Pi,view = 0 .. 20),plot(FSum16(20,x),x = -Pi .. Pi,view = 0 .. 20),plot(FSum16(100,x),x = -Pi .. Pi,view = 0 .. 20),plot(FSum16(1000,x),x = -Pi .. Pi,view = 0 .. 20));
<Text-field layout="Subsection" style="Subsection">11.</Text-field>FSum17 := (n,x) -> sum((-1)^(k-1)*sin(1/2*k*Pi*x)/k,k = 1 .. n);plots[display](plot(FSum17(3,x),x = -2 .. 2),plot(FSum17(6,x),x = -2 .. 2),plot(FSum17(9,x),x = -2 .. 2),plot(FSum17(12,x),x = -2 .. 2));