Upload
yamaneko-shin
View
212
Download
0
Embed Size (px)
Citation preview
7/24/2019 Revision for Final Examination 2015-2016
1/5
Revision for Final ExaminationComputational Mathematics
Interpolationi) Polynomial Interpolation
2
1 2 3( )f x p x p x p
ii) Newtons Interpolating Polynomial
2nd
Order (need 3 points)
2 1 2 1 3 1 2
1 1
2 2 1
3 3 2 1
( ) ( ) ( )( )
( )
[ , ]
[ , , ]
f x b b x x b x x x x
b f x
b f x x
b f x x x
3rd
Order (need 4 points)
3 1 2 1 3 1 2 4 1 2 3
1 1
2 2 1
3 3 2 1
4 4 3 2 1
( ) ( ) ( )( ) ( )( )( )
( )
[ , ]
[ , , ]
[ , , , ]
f x b b x x b x x x x b x x x x x x
b f x
b f x x
b f x x x
b f x x x x
iii) Lagrange Polynomial
1st
Order (need 2 points)
2 11 1 2
1 2 2 1
( ) ( )( ) ( ) ( )
( ) ( )
x x x xf x f x f x
x x x x
2nd
Order (need 3 points)
2 3 1 3 1 22 1 2 3
1 2 1 3 2 1 2 3 3 1 3 2
( )( ) ( )( ) ( )( )( ) ( ) ( ) ( )
( )( ) ( )( ) ( )( )
x x x x x x x x x x x xf x f x f x f x
x x x x x x x x x x x x
7/24/2019 Revision for Final Examination 2015-2016
2/5
Example Tutorial 4 Question 1:
Estimate the logarithm of 5 to the base 10 (log 5) using Newtons interpolation:
i) Linear interpolation between log 4 and log 6.
ii) Linear interpolation between log 4.5 and 5.5.
iii) 2nd
order (use log 4, log 4.5, log 5.5)iv) 2ndorder (use log 4.5, log 5.5, log 6)
v) 3rdorder
vi) 1storder Lagrange
vii) 2ndorder Lagrange
Numerical Integration
i) Trapezoidal rule
2 points => 1 22
hI f f
3 points => 1 2 322
hI f f f
4 points => 1 2 3 42( )2
hI f f f f
ii) Simpsons 1/3 rule
Single Application (3 points) => 1 2 343
hI f f f
Composite (Odd no points) => 1 2 4 3 54( ) 23
hI f f f f f
iii) Simpsons 3/8 rule(4 points) => 1 2 3 43
3 38
hI f f f f
Example Tutorial 6 Question 1:
Evaluate the following integral:
4
0(1 )xI e dx
a) Analytically
b) Single application of the trapezoidal rule,
c) Composite trapezoidal rule with n = 2 and 4,
d) Single application of Simpsons 1/3 rule,
e) Composite Simpsons 1/3 rule with n = 4,
f) Simpsons 3/8 rule
g) Composite Simpsons rule, with n = 5. For each of the numerical estimates (b) through (g),
determine the true percent relative error based on (a).
7/24/2019 Revision for Final Examination 2015-2016
3/5
Ordinary Differential Equations
i) Eulers method
1 ( , )i i i iy y f x y h
ii) Midpoints method
1 1/2 1/2( , )i i i iy y f x y h
iii) Heuns method0
1 11
( , ) ( , )
2
i i i ii i
f x y f x yy y h
iv) Ralston method
1 1 2
1 2
3 3i iy y k k h
1
2 1
( , )
3 3( , )
4 4
i i
i i
k f x y
k f x h y k h
v) Runge-Kutta method
1
2 1
3 2
4 3
1 1 2 3 4
( , )
1( , )
2
1( , )
2( , )
1( 2 2 )
6
i i
i i
i i
i i
i i
K f x y
K f x h y K h
K f x h y K h
K f x h y K h
y y K K K K h
Example (Question 1: Tutorial 7)
Solve the following problem over the interval fromx = 0 to 1 using a step size of 0.25 where y(0) = 1.
Display all your results on the same graph.
(1 4 )y
x yx
i) Analytically.
ii) Using Eulers method.
iii) Using Heuns method without iteration.
iv) Using the fourth-order RK method.
7/24/2019 Revision for Final Examination 2015-2016
4/5
Gauss Elimination
i) Cramers rule
1 12 13
2 22 23
3 32 33
1
b a a
b a a
b a ax
D
11 1 13
21 2 23
31 3 33
2
a b a
a b a
a b ax
D
11 12 1
21 22 2
31 32 3
3
a a b
a a b
a a bx
D
ii) Nave Gauss elimination
iii) Pivotingpartial and complete
Example (Question 2 Tutorial 8)
Solve the following equations by using Gauss elimination with partial pivoting:
1 2 3
1 2 3
1 2 3
2 6 38
3 7 34
8 2 20
x x x
x x x
x x x
7/24/2019 Revision for Final Examination 2015-2016
5/5
Linear Algebraic Equation
i) Jacobi
ii) Gauss-Seidel
iii) SOR
Example (Question 2: Tutorial 8)
For the system below, solve using Jacobi and Gauss-Seidel methods with error of below 5%.
1
2
3
3 6 2 61.5
10 2 1 27
1 1 5 21.5
x
x
x
Finite Difference Method
i) Forward in time - first derivative
1n n
i iT TT
t t
ii) Central in space - second derivative2
1 1
2 2
2
( )
n n n
i i iT T TT
x x
Example (Assignment 9)