0% found this document useful (0 votes)
71 views2 pages

KEN1540 Numerical Mathematics 2017/2018 Formula Sheet Algebraic Equations Cubic Spline Interpolation

This document provides formulas and concepts related to numerical mathematics, including: 1) Cubic spline interpolation, which uses piecewise cubic polynomials to interpolate points, with formulas given for the coefficients and knot conditions. 2) Methods for finding roots of functions numerically, including the secant method and Newton's method. 3) Formulas for polynomial interpolation, including the Lagrange and Newton forms. The error of polynomial interpolation is estimated. 4) Formulas for numerical differentiation and integration, including midpoint, trapezoid, and other rules, along with associated error estimates.

Uploaded by

Yiping Huang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views2 pages

KEN1540 Numerical Mathematics 2017/2018 Formula Sheet Algebraic Equations Cubic Spline Interpolation

This document provides formulas and concepts related to numerical mathematics, including: 1) Cubic spline interpolation, which uses piecewise cubic polynomials to interpolate points, with formulas given for the coefficients and knot conditions. 2) Methods for finding roots of functions numerically, including the secant method and Newton's method. 3) Formulas for polynomial interpolation, including the Lagrange and Newton forms. The error of polynomial interpolation is estimated. 4) Formulas for numerical differentiation and integration, including midpoint, trapezoid, and other rules, along with associated error estimates.

Uploaded by

Yiping Huang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

KEN1540 Numerical Mathematics 2017/2018 Cubic Spline Interpolation

Formula Sheet Knots Interpolate (x0 , y0 ), . . . , (xn , yn ) with knots xj . Set hj = xj+1 − xj .
Interpolant s(x) = sj (x) = aj+bj (x−xj )+cj (x−xj )2+dj (x−xj )3 for xj ≤ x < xj+1 .
Coefficients
Algebraic Equations aj = yj , bj =
1 h
(aj+1 − aj ) − j (2cj + cj+1 ), dj =
1
(cj+1 − cj ).
hj 3 3hj
Secant method pn − pn−1 Knot conditions
pn+1 = pn − f (pn ). 3 3
f (pn ) − f (pn−1 ) hj−1 cj−1 + 2(hj−1 + hj )cj + hj cj+1 = (aj+1 − aj ) − (aj − aj−1 ).
hj hj−1
Newton’s method pn+1 = pn − f (pn )/f 0 (pn ).
Derivatives 1 h
s0j (xj ) = bj = (aj+1 − aj ) − j (2cj + cj+1 ); s00j (xj ) = 2cj .
hj 3
Polynomial Interpolation Natural spline s00 (x0 ) = s00 (xn ) = 0, so c0 = cn = 0.
Lagrange form Interpolating polynomial Clamped boundary s0 (x0 ) = w0 , s0 (xn ) = wn , so b0 = w0 ; bn = wn ;
  a − a0 an − an−1 
2h0 c0 + h0 c1 = 3 1
x−xj

p(x) = n − b0 ; hn−1 cn−1 + 2hn−1 cn = 3 bn − .
P Q
k=0 yk lk (x) where lk (x) = j6=k xk −xj h0 hn−1
Divided differences f [xi ] = f (xi ); recurrence relation Not-a-knot s000 is continuous at x1 and xn−1 , so
f [xi+1 , . . . , xi+k ] − f [xi , . . . , xi+k−1 ] h1 c0 − (h0 + h1 )c1 + h0 c2 = 0; hn−1 cn−2 − (hn−1 + hn−2 )cn−1 + hn−2 cn = 0.
f [xi , . . . , xi+k ] =
xi+k − xi 3
Equally-spaced cj−1 + 4cj + cj+1 = 2 (aj−1 − 2aj + aj+1 );
h
Theorem (Divided differences and derivatives) If f (n) is continous on [a, b] 2c0 + c1 = h32 a1 − a0 − hb0 ; cn−1 + 2cn = h32 hbn − an + an−1 .
 
and x0 , . . . , xn are distinct points in [a, b], there exists ξ ∈ [a, b] with
f [x0 , . . . , xn ] = f (n) (ξ)/n! Differentiation
Nested form Let ak = f [x0 , . . . , xk ]. Then
 Two-point forward difference f 0 (x) = (f (x + h) − f (x))/h − f 00 (ξ)h/2.
p(x) = a0 + (x − x0 ) a1 + (x − x1 ) a2 + · · · + (x − xn−2 ) an−1 + (x − xn−1 )an
Three-point centred difference f 0 (x) = (f (x + h) − f (x − h))/2h − f 000 (ξ)h2 /6.
Chebyshev nodes xk = a+b − b−a 2k+1

cos 2(n+1) π for k = 0, . . . , n.
2 2 Three-point forward difference
Theorem (Error of polynomial interpolation) If p is the degree-n polynomial f 0 (x) = (−f (x + 2h) + 4f (x + h) − 3f (x))/2h + f 000 (ξ)h2 /3.
of interpolating f at the n + 1 distinct nodes x0 , x1 , . . . , xn in [a, b], and f (n+1) Five-point centred difference
is continuous, then for each x in [a, b], there is a ξ in (a, b) for which f 0 (x) = −f (x + 2h) + 8f (x + h) − 8f (x − h) + f (x − 2h) /12h + f (5) (ξ)h4 /30.

n
1 Y
Second derivative f 00 (x) = f (x + h) − 2f (x) + f (x − h) /h2 − f (4) (ξ) h2 /12.

f (x) − p(x) = f n+1 (ξ) (x − xi )
(n + 1)! i=0

Theorem (Maximum error of polynomial interpolation) If p is the interpo- Integration


lating polynomial of f with n + 1 equally-spaced nodes, then
Midpoint rule M (f, P ) = h n 1
P
(b − a)n+1 j=1 f (cj ) where cj = (xj−1 + xj )/2 = a + (j − 2 )h.
|f (x) − p(x)| ≤ max |f (n+1) (ξ)| 2 (2)
Error I(f ) − M (f, P ) = (b − a) h f (ξ)/24.
4nn+1 (n + 1) x∈[a,b]
Trapezoid rule T (f, P ) = h 12 f (x0 ) + f (x1 ) + · · · + f (xn−1 ) + 12 f (xn ) .

If p is the interpolating polynomial of f with n + 1 Chebyshev nodes, then
(b − a)n+1 Error bound |I(f ) − T (f, P )| ≤ b−a12
h2 supξ∈[a,b] |f (2) (ξ)|.
|f (x) − p(x)| ≤ 2n+1 max |f (n+1) (ξ)| Error estimate |I(f ) − T2 (f )| ≈ |T2 (f ) − T1 (f )|/3= b−a

f (a) − 2f ( a+b ) + f (b) .
2 (n + 1)! x∈[a,b] 12 2
Simpson’s rule Least-Squares Approximation
S(f, P ) = 13 h f (x0 )+4f (x1 )+2f (x2 )+4f (x3 )+· · ·+2f (xn−2 )+4f (xn−1 )+f (xn ) .


Error I(f ) − S(f, P ) = −(b − a) h4 f (4) (ξ)/180. Linear least squares g(x) = ax + b fitting data (x1 , y1 ), . . . , (xm , ym ) where
2
Error estimate |I(f ) − S(f, P4 )| ≈ |S(f, P2 ) − S(f, P4 )|/15 a = (XY − X · Y )/(X 2 − X ); b = Y − a X.
= f (a) − 4f ( 3a+b
4
) + 6f ( a+b
2
) − 4f ( a+3b
4
) + f (b) (b − a)/180
Nonlinear least squares If g(x) = n
P
where P2 = (a, a+b , b), P4 = (a, 3a+b , a+b , a+3b , b). k=0 ck φk (x) then for j = 0, . . . , n:
2 4 2 4 n m m
Rb X X X
Romburg integration a f (x) dx ≈ Rn,n . Let hm = (b − a)/m. ck φj (xi )φk (xi ) = φj (xi )yi .
Rk,1 = T2k−1 ; Rk,j = Rk,j−1 + (Rk,j−1 − Rk−1,j−1 )/(4j−1 − 1). k=0 i=1 i=1
Pn
P k−1 Continuous least squares If g(x) = k=0 ck φk (x) fits f (x), then for j = 0, . . . , n:
1
f (a) + f (b) ; T2k = 21 T2k−1 + h2k 2i=1 f (a + (2i − 1)h2k ).

T1 = h1 2
Xn Z b Z b
Differential Equations ck
k=0
w(x) φj (x) φk (x) dx =
a
w(x) φj (x) f (x) dx.
a
Euler’s method wi+1 = wi + hf (ti , wi ). Local error O(h2 ); global error O(h).
Least-squares for orthogonal functions
Error wi+1 − y(ti+1 ) = 21 ÿ(τi )h2 for some τi in (ti , ti+1 ) if wi = y(ti ). Rb Z b
Taylor method Local error O(h3 ). w(x) φk (x) f (x) dx
ck = aR b if w(x) φj (x) φk (x) dx = 0 for j 6= k.
wi+1 = wi + hf (ti , wi ) + 12 h2 f,t (ti , wi ) + f,y (ti , wi )f (ti , wi ) .

a
w(x) φk (x)2 dx a
3
Trapezoid (modified Euler) method Local error O(h  ). Square error for orthogonal functions
1
wi+1 = wi + 2 h f (ti , wi ) + f (ti+1 , wi + hf (ti , wi )) . Rb Rb Rb
w(x)(f (x)−g(x))2 dx = a w(x)f (x)2 dx− n 2 2
P
k=0 αk ck where αk = a w(x)φk (x) dx.
Midpoint method Local error O(h3 ). a

wi+1 = wi + hf (ti + 12 h, wi + 21 hf (t, wi )). Generating orthogonal polynomials φk (x) = (x − Bk )φk−1 (x) − Ck φk−2 (x)
Rb Rb
Ralston’s 2nd-order method Local error O(h3 ). x w(x) (φk−1 (x))2 dx x w(x) φk−1 (x) φk−2 (x) dx
wi+1 = wi + 14 h f (ti , wi ) + 3f (ti + 32 h, wi + 23 hf (ti , wi )) .
 with Bk = Ra b , Ck = a R b .
w(x) (φ (x)) 2 dx w(x) (φk−2 (x))2 dx
k−1
ki,1 = hf (ti , wi ); ki,2 = hf (ti + 23 h, wi + 23 ki,1 ); wi+1 = wi (t) + 41 (ki,1 + 3ki,2 ). a a

Heun’s 3rd-order method Local error O(h4 ). Legendre polynomials



ki,1 = hf (ti , wi ); ki,2 = hf (ti + 13 h, wi + 31 ki,1 ); ki,3 = hf (ti + 23 h, wi + 23 ki,2 ); P0 (x) = 1; P1 (x) = x; Pk (x) = (2k − 1)xPk−1 (x) − (k − 1)Pk−2 (x) /k.
wi+1 = wi (t) + 41 (ki,1 + 3ki,3 ). R1
P (x) Pk (x) dx = 0, j 6= k,
R +1 2 k
Pk (x) dx = 2k+1
R1
; ck = (k + 12 ) −1 Pk (x) f (x) dx.
−1 j −1
Classical 4th-order Runge-Kutta method Local error O(h5 ).
ki,1 = hf (ti , wi ); ki,2 = hf (ti + 12 h, wi + 21 ki,1 ); Chebyshev polynomials Tk (x) = cos(k acos(x))
ki,3 = hf (ti + 21 h, wi + 12 ki,2 ); ki,4 = hf (ti + h, wi + ki,3 ); T0 (x) = 1; T1 (x) = x; Tk (x) = 2xTk−1 (x) − Tk−2 (x)
wi+1 = wi + ki = wi + 61 (ki,1 + 2ki,2 + 2ki,3 + ki,4 ). 
Z 1
Tj (x) Tk (x) 0, j 6= k;
2-stage Adams-Bashforth method Local error O(h3 ). √ dx = π/2, j = k 6= 0;
wi+1 = wi + 21 h 3f (ti , wi ) − f (ti−1 , wi−1 ) .

−1 1 − x2 
π, j = k = 0.
3-stage Adams-Bashforth method Local error O(h4 ). n
1
 Fourier series a
h 23f (ti , wi ) − 16f (ti−1 , wi−1 ) + 5f (ti−2 , wi−2 ) .
X
wi+1 = wi + 12 f (x) ≈ 0 +

ak cos(kx) + bk sin(kx) ;
2
2-stage Adams-Moulton method Local error O(h4 ). k=1
1 π 1 π
Z Z
1

wi+1 = wi + 12 h 5f (ti+1 , wi+1 ) + 8f (ti , wi ) − f (ti−1 , wi−1 ) . ak = cos(kx)f (x) dx; bk = sin(kx)f (x) dx.
Bogacki-Shampine adaptive method Local error O(h4 ). π −π π −π
ki,1 = hf (ti , wi ); ki,2 = hf (ti + 12 h, wi + 21 ki,1 ); ki,3 = hf (ti + 34 h, wi + 34 ki,2 ); Discrete Fourier transform If xj = (j/m − 1)π for j = 0, 1, . . . , 2m − 1, then
wi+1 = wi + 92 ki,1 + 39 ki,2 + 94 ki,3 ; 2m−1 2m−1
ki,4 = hf (ti + h, wi+1 ); ŵi+1 = wi + 24 7
ki,1 + 14 ki,2 + 13 ki,3 + 18 ki,4 . 1 X 1 X
ak = f (xj ) cos(kxj ), bk = f (xj ) sin(kxj ).
1/2
Set q = (h/|wi+1 − ŵi+1 |) . Step size estimate qh. m j=0 m j=0

You might also like