You are on page 1of 1

PHY473A

HW-VI
DATE - 10/03/2023

1. Show that the three-point formula for the second derivative for nonuniform data points can be expressed
00 −(hi +hi−1 )+hi fi−1 )]
as fi = 2[hi−1 fi+1
hi hi+1 (hi +hi−1 ) + O(h). Show that the leading term in the error would be O(h2 )
in case of uniform data points.
2. Show that the second derivative of a function can be approximated as
000000
00 −fi+2 +16fi+1 −30fi +16fi−1 −fi−2 h4 fi
fi = 12h2 + E, where E ≈ 90 and h = xi+1 − xi .

3. Show that the leading terms in the errors are Etrapezoid = − (b−a) (b−a) 4
2 00 0000
12 h fi and ESimpson 3 = − 180 h fi
1

for the composite Trapezoid and Simpson’s 31 rule, respectively. f denotes averaged over the intervals.
Note that Simpson’s 31 rule gives exact result for a cubic function!

4. Argue that the order of accuracy in Simpson’s 13 and 83 rules will be the same, even though more data
points (four data points) are used to approximate the original function in Simpson’s 38 rule.
5. Write a C program to calculate the second derivative of Sin(x) using the formula given in Problem
1. Take 10 nonuniform points of your choice in [0, π]. You can use a linear interpolation at the
boundaries for fi−1 and fi+1 .

6. Write a C program to implement the Simpson’s 13 rule and use it to calculate 0 Sin(x)dx.

You might also like