HW03 Spring 2024

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

MATH 351 Numerical Methods with Applications

Spring 2024
Homework 3.
1. Construct the natural cubic spline for the following data.

x f (x) x f (x)
(a) 8.3 17.56492 (b) 0.8 0.22363362
8.6 18.50515 1.0 0.65809197
x f (x)
x f (x)
0.1 -0.62049958
-0.5 -0.0247500
(c) (d) 0.2 -0.28398668
-0.25 0.3349375
0.3 0.00660095
0 1.1010000
0.4 0.24842440

2. A natural cubic spline S on [0, 2] is defined by


(
S0 (x) = 1 + 2x − x3 , if 0 ≤ x ≤ 1,
S(x) =
S1 (x) = 2 + b(x − 1) + c(x − 1)2 + d(x − 1)3 , if 1 ≤ x ≤ 2.

Find b, c, and d.

3. Given the partition x0 = 0, x1 = 0.05, and x2 = 0.1 of [0, 0.1], find the piecewise linear interpolating
Z 0.1 Z 0.1
2x 2x
function F for f (x) = e . Approximate e dx with F (x)dx and compare the results to
0 0
the actual value.

4. Use the forward-difference formulas and the backward-difference formulas to determine each missing
entry in the following tables.
x f (x) f ′ (x) x f (x) f ′ (x)
0.5 0.4794 0.0 0.00000
(a) (b)
0.6 0.5646 0.2 0.74140
0.7 0.6442 0.4 1.3718
5. The data in Exercise 4 were taken from the following functions. Compute the actual errors in Exercise
4, and find error bounds using the error formulas.

(a) f (x) = sin x


(b) f (x) = ex − 2x2 + 3x − 1.

6. The forward-difference formula can be expressed as

1 h h2
f ′ (x0 ) = (f (x0 + h) − f (x0 )) − f ′′ (x0 ) − f ′′′ (x0 ) + O(h3 )
h 2 6
Use extrapolation to derive an O(h3 ) formula for f ′ (x0 ).

7. Approximate the following integrals using the Trapezoidal rule and Simpson’s rule. Find bounds for
each method for the error using the error formula and compare this to the actual error.
Z 1
(a) x4 dx
0.5
Z0.5
2
(b) dx
0 x−4
Z 1.5
(c) x2 ln xdx
1

1
Z 1
(d) x2 e−x dx
0
Z 2
8. Approximate x2 ln(x2 + 1)dx using h = 0.25. Use
0

(a) Composite Trapezoidal rule.


(b) Composite Simpson’s rule.
(c) Composite Midpoint rule.
Z b
9. Romberg integration for approximating f (x)dx gives R11 = 8, R22 = 16/3, and R33 = 208/45.
a
Find R31 .

10. Approximate the integrals from exercise 7 (a) and 7 (c) using Gaussian quadrature with n = 2 and
compare your results to the exact values of the integrals.

11. Use Simpson’s Double Integral(Algorithm 4.4) with n = m = 4 to approximate the following double
integrals and compare the results to the exact answers.
Z 2.5 Z 1.4
(a) xy 2 dydx
2.1 1.2
Z0.5 Z 0.5
(b) ey−x dydx
0 0
(c)
Z 2.2 Z 2x
(d) (x2 + y 3 )dydx
2 x

You might also like