Chapter 1, Section 2: Homework:
pp. 17-19, #4, 7, 12, 14, 24, 27

4.̃

fp4[x_]:=Module[{xshift=x-2},
3+xshift((-1)+xshift/2(2+xshift/3(-1)))
]
fp4[x]
Together[fp4[x]]
{fp4[2],
fp4'[2],
fp4''[2],
fp4'''[2]}
fp4[4]
Plot[{fp4[x],fp4[x]-2(x-2)^4/4!,fp4[x]+5(x-2)^4/4!},{x,2,4},PlotRange->All]
upperBound=10/3 (* 5*2^4/4! *)

7.

Cosh is even, which means the the 43rd is actually of degree 42;  but the error term corresponding to the 43rd will be the 44th derivative, corresponding to Cosh(x). So Cosh(ξ(x))x^44/44!.

Series[Cosh[x],{x,0,43}]

12.

(a)

f[x_]:=Cos[x]
tp[x_]=Normal[Series[f[x],{x,0,3}]]
fd[x_]:=Cos[x]
rp[x_,y_]:=fd[y]x^4/4!
rp[x,y]
xval=Pi
{y1,y2}=y/.N[Solve[rp[xval,y]==-tp[xval]+f[xval],y]]
ksee=0.7625353073244038;
f[xval]
tp[xval]+rp[xval,ksee ]

N[ArcCos[((12Pi^2-48)/Pi^4)]]

(b)

f[x_]:=Exp[x]
tp[x_]=Normal[Series[f[x],{x,0,3}]]
fd[x_]:=Exp[x]
rp[x_,y_]:=fd[y]x^4/4!
xval=Log[4.0]
ksee=(y/.N[Solve[rp[xval,y]==-tp[xval]+f[xval],y]])[[1]]
f[xval]
tp[xval]+rp[xval,ksee ]

(c)

f[x_]:=Log[x]
tp[x_]=Normal[Series[f[x],{x,1,4}]]
fd[x_]:=Factorial[5]/x^5
rp[x_,y_]:=fd[y](x-1)^5/5!
xval=2
ksee=(y/.N[Solve[rp[xval,y]==-tp[xval]+f[xval],y]])[[1]]
N[f[xval]]
tp[xval]+rp[xval,ksee ]

14.

(a) We can multiply the series for e^x and cos(x), to get  the series for f(x):

Clear[p2]
f[x_]:=Exp[x]Cos[x]
p2[x_]=Normal[Series[f[x],{x,0,2}]]
Normal[Series[Exp[x],{x,0,2}]]
Normal[Series[Cos[x],{x,0,2}]]
fppp[x_]=D[f[x],{x,3}] (* bounded by 2 e^0.5 Sin(0.5) *)
errorBound=2 E^0.5 (1+Sin[0.5])(0.5)^3/3!

(b)  We need the third derivative of f(x), and then to bound it:

fppp[x_]=D[f[x],{x,3}]
Plot[{fppp[x],-3-5x},{x,0,1}]
M=8 (* works... *)

more particularly, however, we can create a bound which works for values of x as they slide from 0 to 1:  M(x)=3+5x works.

(c) So let’s compare integrals:

trueVal=N[Integrate[f[x],{x,0,1}]]
approxVal=N[Integrate[p2[x],{x,0,1}]]
errorVal=Abs[trueVal-approxVal]

(d) Let’s bound the error:

N[Integrate[(3+5x) * (x^3)/6,{x,0,1}]]

24.

We’re using the Maclaurin series polynomial to approximate; the error is bounded by e^2 -- the maximum value of the sixth derivative on the interval [0,2] -- multiplied by 2^6/6!

N[E^2*2^6/6!]
E^2
f[x_]=Normal[Series[Exp[x],{x,0,5}]]
f[x]
f[2]
N[Abs[E^2-f[2]]]

27.

f[x_]:=Log[1+x]
(* a *)
t3[x_]=Normal[Series[f[x],{x,0,3}]]
(* b *)
D[f[x],{x,4}]
r3[x_,ksee_]:=(-6/(1+ksee)^4)x^4/4!
r3[x_]:=6x^4/4! (* but an upper bound on the error is this... *)
(* c *)
N[{f[1],t3[1]}]
N[{f[26],t3[26]}]
(* d *)
{r3[1],r3[26]}
(* e *)
0
(* f *)
N[Abs[f[1]-t3[1]]]
N[Abs[f[26]-t3[26]]]
(* g *)
Plot[{f[x],t3[x]},{x,0.01,2}]
Plot[{f[x],t3[x]},{x,1,26}]