Linear Approximation
Homework
Andy Long

#2, p. 187

f[x_]:=Sin[x]
a=Pi/6;
Da=.1;
L[x_]:=f[a]+f'[a](x-a)
L[.5]
f[.5]
Plot[{f[x],L[x]},{x,0,Pi}]
Plot[{f[x],L[x]},{x,a-Da,a+Da}]

(* I define the relative error so that, if the approximation is bigger than f[x], then the error will be positive: *)
rerror[x_]:=(L[x]-f[x])/f[x]
rerror[.5]
perror[x_]:=rerror[x]*100
perror[.5]

#10, p. 187

f[x_]:=Tan[x]
a=0;
Da=.1;
L[x_]:=f[a]+f'[a](x-a)
Plot[{f[x],L[x]},{x,-.5,.5}]
Plot[{f[x],L[x]},{x,a-Da,a+Da}]

L[.1]
f[.1]
rerror[.1]
perror[.1]
L[.01]
f[.01]
rerror[.01]
perror[.01]
FindRoot[f[x]-x-.1,{x,0.1}]

#25, p. 188

f[x_]:=x^(1/3)
a=1000;
Da=1;
L[x_]:=f[a]+f'[a](x-a)
L[1001]
N[f[1001]]
Plot[{f[x],L[x]},{x,a-Da,a+Da}]