Chapter 1, Section 1: Homework:
pp. 8-9, #3-5, 8, 11, 18, 20

3.̃

absError[p_,ptilde_]:=N[Abs[p-ptilde]]

absError[123,1106/9]
absError[1/E,.3666]
absError[2^10,1000]
absError[24,48]
absError[Pi^(-7),10^(-4)]
absError[(0.062847)(0.069234),0.0042]

4. Calculate the relative errors in the approximations of
question 3.

relError[p_,ptilde_]:=N[Abs[p-ptilde]/Abs[p]]

relError[123,1106/9]
relError[1/E,.3666]
relError[2^10,1000]
relError[24,48]
relError[Pi^(-7),10^(-4)]
relError[(0.062847) (0.069234),0.0042]

5. How many significant digits of accuracy do the approx-
imations of question 3 have?

sigDigits[p_,ptilde_]:=N[-Log10[relError[p,ptilde]]]

sigDigits[123,1106/9]
sigDigits[1/E,.3666]
sigDigits[2^10,1000]
sigDigits[24,48]
sigDigits[Pi^(-7),10^(-4)]
sigDigits[(0.062847) (0.069234),0.0042]

8. The number in question 7 is an approximation of 1/π. Using Octave, find the absolute and relative errors in the approximation.

absError[1103Sqrt[8]/9801,1/Pi]
relError[1103Sqrt[8]/9801,1/Pi]
sigDigits[1103Sqrt[8]/9801,1/Pi]

N[1103Sqrt[8]/9801,20]
N[1/Pi,20]

11.

2*12 ==9^2-4*9-21
E^(3Log[2])==8
Log[10]==Log[5]+Log[2]

g[x_]:=CubeRoot[x^2+x];
g[(1+Sqrt[5])/2]==(1+Sqrt[5])/2
EqualTo[g[(1+Sqrt[5])/2]][(1+Sqrt[5])/2]

Floor[153465/3]==153465/3
3Pi^3+7Pi^2-2Pi+8 == ((3Pi+7)Pi-2)Pi+8

18.

{p0,p1}=pstar/.Solve[relError[900,pstar]==10^(-3),pstar]
Plot[relError[900,pstar],{pstar,p0,p1}]

20.

Note: Mathematica (and a lot of others, including I) define Fibonacci[0] as 0 (we’re offset from this sequence by one place).

Fibonacci[0]
f11=Fibonacci[12]
f10=Fibonacci[11]
NumberForm[N[GoldenRatio,30],30]
relError[f11/f10,GoldenRatio]
NumberForm[N[Fibonacci[110]/Fibonacci[109],30],30]