Differentiation Homework
MAT360
Spring, 2017
Andy Long

    p. 264, #2, 3,6; 
    Use Richardson’s Extrapolation once to obtain a higher-order estimate to the second derivative, using the centered difference formula of exercise 1, p. 264. You’ll need the error term for that method that we obtained in class (or you can get it from any other source).

p. 264, #1 (and Richardson’s Extrapolation)

Clear[x,a,f,fp,g,d,h]
g[x_]=Normal[Series[f[x],{x,a,6}]];
g[a+h]
g[a-h]
re[h_]:=Simplify[(g[a+h]-2g[a]+g[a-h])/h^2]
re[h]
re[2h]
Simplify[(4re[h]-re[2h])/3]

p. 264, #2

g[x_]=Normal[Series[f[x],{x,a,6}]];
d[x_]=Normal[Series[fp[x],{x,a,4}]];
Collect[Simplify[g[a+h/2]-1/2(g[a]+g[a+h])+h/8(d[a+h]-d[a])],h]

p. 264, #3

dividedDifference[list_]:=
Module[
{n=Length[list]}, 
If[n==1,
b=list[[1]][[2]],
b=(dividedDifference[list[[2;;n]]]-dividedDifference[list[[1;;n-1]]])/
(list[[n]][[1]]-list[[1]][[1]])];
b
]

xs={0,1,2,3}
ys={0,1,5,13}
xs[[2]]
p[x_]:=ys[[1]]+(x-xs[[1]])*(dividedDifference[{{xs[[1]],ys[[1]]},{xs[[2]],ys[[2]]}}] +
(x-xs[[2]])*(dividedDifference[{{xs[[1]],ys[[1]]},{xs[[2]],ys[[2]]},{xs[[3]],ys[[3]]}}] +
(x-xs[[3]])*(dividedDifference[{{xs[[1]],ys[[1]]},{xs[[2]],ys[[2]]},{xs[[3]],ys[[3]]},{xs[[4]],ys[[4]]}}])))
p[xs]
p''[0]
(* the third derivative is constant, and would be the same for all values of x: *)
p'''[x]
6*dividedDifference[{{xs[[1]],ys[[1]]},{xs[[2]],ys[[2]]},{xs[[3]],ys[[3]]},{xs[[4]],ys[[4]]}}]

p. 264, #6

a.

g[x_]=Normal[Series[f[x],{x,a,6}]];
d[h_]:=(g[a+h]-g[a])/h
Simplify[3*d[h]-2*d[3/2*h]]

b.

xs={1,1.2,1.3};
ys={3.1,3.9,4.0};
g[x_]:=ys[[1]]+(x-xs[[1]])*(dividedDifference[{{xs[[1]],ys[[1]]},{xs[[2]],ys[[2]]}}] +
(x-xs[[2]])*(dividedDifference[{{xs[[1]],ys[[1]]},{xs[[2]],ys[[2]]},{xs[[3]],ys[[3]]}}]))
{g[1],g[1.2],g[1.3]}
h=.2
a=xs[[1]]
3d[h]-2d[3/2*h]