-
- Consider f(x) = ln(x).
Give the interpolating polynomial in the form of Lagrange,
using three points: (1,ln(1)), (2,ln(2)), and (3,ln(3)).
- Give one advantage and one disadvantage of the method of Lagrange.
-
p(x) = l0(x)*ln(1) + l1(x)*ln(2) + l2(x)*ln(3)
(x-2)*(x-3)
l0(x) = -----------
(1-2)*(1-3)
(x-1)*(x-3)
l1(x) = -----------
(2-1)*(2-3)
(x-1)*(x-2)
l2(x) = -----------
(3-2)*(3-2)
- Advantage: if only the function values change, then
we can keep the Lagrange polynomials.
Disadvantage: one extra point causes the recalculation
of all Lagrange polynomials.
+--------+
| /20 |
+--------+
- Set up the linear system for the natural spline for ln(x)
over [1,2], using 4 intervals of equal length.
Do NOT solve the system.
Natural spline: S0 = 0 and S4 = 0.
We have three equations in three unknowns: S1,S2,S3
.25*S2 + S1 = 6*(ln[1.25,1.50]-ln[1.00,1.25])
.25*S3 + S2 + .25*S1 = 6*(ln[1.50,1.75]-ln[1.25,1.50])
S3 + .25*S2 = 6*(ln[1.75,2.00]-ln[1.50,1.75])
+--------+
| /20 |
+--------+
- Show that the central difference operator delta f(x,h) applied
to a function f with step size h >0 at x to approximate
f'(x) has an error of order O(h^2).
f(x+h) - f(x-h)
delta f(x,h) = ---------------
2*h
f(x+h) = f(x) + h*f'(x) + h^2*f"(x)/2 + h^3*f"'(x)/3! + ...
- ( f(x-h) = f(x) - h*f'(x) + h^2*f"(x)/2 - h^3*f"'(x)/3! + ... )
-------------------------------------------------------------------
f(x+h)-f(x-h) = 2*h*f'(x) + 2*h^3*f"'(x)/3! + ...
=> delta f(x,h) = f'(x) + h^2*f"'(x)/3! + ...
+--------+
| /15 |
+--------+
- Consider the values in the table below:
+----------------------------------------------------------------------------------------------+
| x | 1.00000 | 1.12500 | 1.25000 | 1.37500 | 1.50000 | 1.62500 | 1.75000 | 1.87500 | 2.00000 |
+----------------------------------------------------------------------------------------------+
|f(x)| .841471 | .902268 | .948985 | .980893 | .997495 | .998531 | .983986 | .954086 | .909297 |
+----------------------------------------------------------------------------------------------+
Perform all your calculations with six significant decimal places.
- Apply the composite Trapezoidal rule to compute
T(h), for h = 0.5,0.25,0.125.
- Use the three values for T(h) from above in Romberg integration.
- How accurate is your final approximation for
the integral of f(x) over [1,2]?
-
T(.5) = .25*(.841471 + .909297) + .5*.997495 = .936440
T(.25) = T(.5)/2 + .25*(.948985 + .983986) = .951463
T(.125) = T(.25)/2 + .125*(.902268 + .980893 + .998531 + .954086) = .955204
-
.936440
.951463*2^2 - .936440
--------------------- = .956471
2^2 - 1 .956451*2^4 - .956471
.951463 --------------------- = .956450
.955204*2^2 - .951463 2^4 - 1
--------------------- = .956451
2^2 - 1
.955204
-
(.125)^6 = 3.8E-6 => 5 decimal places are correct
Also, see the number of corresponding digits
between the last two approximations.
+--------+
| /30 |
+--------+
- Consider the quadrature rule
+h
/
| f(x) dx = f(x0) + f(x1) + f(x2) + f(x3), for h > 0.
/
-h
- Set up the system of equations in the unknown
nodes x0, x1, x2, and x3 to be satisfied for the
highest possible algebraic degree of accuracy.
Do NOT solve this system.
- What is the algebraic degree of accuracy attained by this rule?
-
+h
/
f=1: | 1 dx = 2*h = 1 + 1 + 1 + 1
/
-h
+h
/
f=x: | x dx = 0 = x0 + x1 + x2 + x3
/
-h
+h
/
f=x^2: | x^2 dx = 2*h^3/3 = x0^2 + x1^2 + x2^2 + x3^2
/
-h
+h
/
f=x^3: | x^3 dx = 0 = x0^3 + x1^3 + x2^3 + x3^3
/
-h
+h
/
f=x^4: | x^4 dx = 2*h^5/5 = x0^4 + x1^4 + x2^4 + x3^4
/
-h
- The algebraic degree of accuracy is 4, but only if h = 1/2.
+--------+
| /15 |
+--------+