Homework set #2, sections 1.3, 1.4, and 1.5

Clear["Global`*"]

p. 14, #3

yp=c/xp
xp=(x+y)/2
y=c/x
Simplify[(yp-xp)/(y-x)]

p. 20, #1, 2, 5, 6, 7

(* #5 *)
(* Log[10,2] approx w/10 *)
N[Log[10,2]]
N[3/10]

(* #7 *)
f[h_]:=1/(1-h)
fhat[h_]:=1+h*(1+h)
h=21/100
hhat=2/10
propogatedError[h_,hhat_]:=f[hhat]-f[h]
computationalError[h_,hhat_]:=fhat[hhat]-f[hhat]
totalError[h_,hhat_]:=computationalError[h,hhat]+propogatedError[h,hhat]

computationalError[h,hhat]
propogatedError[h,hhat]
totalError[h,hhat]
100./79
f[h]
100./80
f[hhat]
1.0+1/5+1/25
fhat[hhat]

p. 28, 1, 4, 5, 8, 14

#1

a=100
ahat=100.1
b =101
gamma=1/180*Pi (* radians *)

relError[a_,ahat_]:=(ahat-a)/a
tableRowEntry[a_,ahat_]:={N[a],ahat,100*relError[a,ahat]}

TableForm[
{
tableRowEntry[a,ahat]
,tableRowEntry[b*Cos[gamma]-a,b*Cos[gamma]-ahat]
,tableRowEntry[(b*Cos[gamma]-a)^2,(b*Cos[gamma]-ahat)^2]
,tableRowEntry[(b*Cos[gamma]-a)^2+(b*Sin[gamma])^2,(b*Cos[gamma]-ahat)^2+(b*Sin[gamma])^2]
,tableRowEntry[Sqrt[(b*Cos[gamma]-a)^2+(b*Sin[gamma])^2],Sqrt[(b*Cos[gamma]-ahat)^2+(b*Sin[gamma])^2]]
},TableHeadings->{
{"a","b*Cos[gamma]-a","(b*Cos[gamma]-a)^2","(b*Cos[gamma]-a)^2+(b*Sin[gamma])^2","c"}
,{"true","approx","relError"}}
]

#8: might start with some experiments:

b=Pi/2
f[x_]:=Abs[Cos[b+x]-Cos[b]]
Plot[{f[x],Abs[x]},{x,-Pi/2,Pi/2}]
g[x_]:=Cos[x]
condition[x_]:=Abs[x*g'[x]/g[x]]
Plot[condition[x],{x,-Pi/2,Pi/2}]

#8 is an opportunity to make use of the MVT from calculus: for example

Clear[b,e]
Integrate[-Sin[x],{x,b,b+e}]

Can you bound that integral?