Exercise 4.3 Solutions

2.

f[x_] := x + (2/x)

f[1.5]

f[1.2]

(a)

xymat = {{1, f[1]}, {2, f[2]}, {2.5, f[2.5]}}

lgpolyquad = Expand[Lagrange[xymat]]

lgpolyquad /. x -> 1.5

lgpolyquad /. x -> 1.2

lgpolyquad /. x -> 1

(b)

xymat = {{0.5, f[0.5]}, {1, f[1]}, {2, f[2]}, {2.5, f[2.5]}}

lgpolycubic = Expand[Lagrange[xymat]]

lgpolycubic /. x -> 1.5

lgpolycubic /. x -> 1.2

6.

f[x_] := (x^x)

(a)

xymat = {{1, f[1]}, {1.25, f[1.25]}, {1.5, f[1.5]}}

lgpolyquad = Expand[Lagrange[xymat]]

(b)

avgvalue = ((∫_1^1.5) 
              lgpolyquad \[DifferentialD]x)/(1.5 - 1)

(c)

|(Subscript[E, 2])(
          x)|≤(((h^3) 
                (Subscript[M, 3]))/(9 (Sqrt[ 3])))  where (Subscript[M, 3]) is the maximum value of the 3rd derivative of f[x] on [1,1.5].

der3 = D[f[x], {x, 3}]

Plot[der3, {x, 1, 1.5}];

der3 /. x -> 1

der3 /. x -> 1.5

(0.25^3 ( der3 /. x -> 1.5))/(9 (Sqrt[3]))

10.

In all of these parts the absolute value of any derivative is bounded above by 1.

(a)

((h^2)/8) ≤ (10^(-6))

(h^2) ≤ (8/1000000)

h ≤ N[Sqrt[1/125000]]

(b)

((h^3)/(9 (Sqrt[ 3]))) ≤ (10^(-6))

(h^3) ≤ ((9 (Sqrt[ 3]))/1000000)

h ≤ N[(9 (Sqrt[ 3])/1000000)^(1/3)]

(c)

((h^4)/24) ≤ (10^(-6))

(h^4) ≤ (24/1000000)

h ≤ N[(3/125000)^(1/4)]

11.

Done in Class

12.

P[x_, y_] := A  +  B x  +  C y

(a)

Solve[{P[1, 1] == 5, P[2, 1] == 3, P[1, 2] == 9}, {A, 
        B, C}]

(b)

Solve[{P[1, 1] == 2.5, P[2, 1] == 0, 
        P[1, 2] == 4}, {A, B, C}]

(c)

Solve[{P[2, 1] == 5, P[1, 3] == 7, P[3, 2] == 4}, {A, 
        B, C}]

(d)

Solve[{P[1, 2] == 5, P[3, 2] == 7, P[1, 2] == 0}, {A, 
        B, C}]

Functions Used in this notebook

Lagrange[
          XY_] := 
Module[{j, k, n, X, 
            Y}, 
(Subscript[X, k])_  :=  (Subscript[(Transpose[XY]), [[1, k + 1]]]);  
(Subscript[Y, k])_  :=  (Subscript[(Transpose[XY]), [[2, k + 1]]]);  
n  =  
            Length[XY] - 
              1;  
Return[  (∑_(k = 0)^n) (Subscript[Y, k]) ( (∏_(j = 0)^(k - 1))((x - (Subscript[X, j]))/((Subscript[X, k]) - (Subscript[X, j])))) ((∏_(j = k + 1)^n)(( x - (Subscript[X, j]))/((Subscript[X, k]) - (Subscript[X, j])))) ]; ];