Title: ECIV 301
1ECIV 301
- Programming Graphics
- Numerical Methods for Engineers
- REVIEW II
2Topics
- Introduction to Matrix Algebra
- Gauss Elimination
- LU Decomposition
- Matrix Inversion
- Iterative Methods
- Function Interpolation Approximation
- Newton Polynomials
- Lagrange Polynomials
3Matrix Algebra
Rectangular Array of Elements Represented by a
single symbol A
4Matrix Algebra
n x m Matrix
5Matrix Algebra
6Matrix Algebra
1 Row, m Columns
Row Vector
7Matrix Algebra
n Rows, 1 Column
Column Vector
8Matrix Algebra
If n m Square Matrix
e.g. nm5
9Matrix Algebra
Special Types of Square Matrices
Symmetric aij aji
10Matrix Algebra
Special Types of Square Matrices
Diagonal aij 0, i?j
11Matrix Algebra
Special Types of Square Matrices
Identity aii1.0 aij 0, i?j
12Matrix Algebra
Special Types of Square Matrices
Upper Triangular
13Matrix Algebra
Special Types of Square Matrices
Lower Triangular
14Matrix Algebra
Special Types of Square Matrices
Banded
15Matrix Operating Rules - Equality
AmxnBpxq
np
mq
aijbij
16Matrix Operating Rules - Addition
Cmxn AmxnBpxq
np
cij aijbij
mq
17Matrix Operating Rules - Addition
Properties
AB BA
A(BC) (AB)C
18Multiplication by Scalar
19Matrix Multiplication
A n x m . B p x q C n x q
20Matrix Multiplication
21Matrix Multiplication
22Matrix Multiplication - Properties
If dimensions suitable
Associative A(BC) (AB)C
Distributive A(BC) ABA C
Attention AB ? BA
23Operations - Transpose
24Operations - Inverse
A
A-1
A A-1I
If A-1 does not exist A is singular
25Operations - Trace
Square Matrix
trA Saii
26Linear Equations in Matrix Form
27(No Transcript)
28Gauss Elimination
Consider
(Eq 1)
2(Eq 1)
(Eq 2)
(Eq 2)
Solution
Solution
!!!!!!
Scaling Does Not Change the Solution
29Gauss Elimination
Consider
(Eq 1)
(Eq 1)
(Eq 2)-(Eq 1)
(Eq 2)
Solution
Solution
!!!!!!
Operations Do Not Change the Solution
30Gauss Elimination
Example
Forward Elimination
31Gauss Elimination
-
32Gauss Elimination
Substitute 2nd eq with new
33Gauss Elimination
-
34Gauss Elimination
Substitute 3rd eq with new
35Gauss Elimination
-
36Gauss Elimination
Substitute 3rd eq with new
37Gauss Elimination
Forward Elimination
38Gauss Elimination
Back Substitution
39Gauss Elimination Potential Problem
Pivoting
40Partial Pivoting
NO
YES
41Partial Pivoting
42Full Pivoting
- In addition to row swaping
- Search columns for max elements
- Swap Columns
- Change the order of xi
- Most cases not necessary
43 LU Decomposition
44 LU Decomposition
PIVOTS Column 1
PIVOTS Column 2
45 LU Decomposition
Upper Triangular Matrix
U
As many as, and in the location of, zeros
46 LU Decomposition
PIVOTS Column 2
PIVOTS Column 1
Lower Triangular Matrix
L
47 LU Decomposition
This is the original matrix!!!!!!!!!!
48LU Decomposition
L
y
b
49LU Decomposition
L
y
b
50LU Decomposition
51LU Decomposition
- Axb
- ALU - LU Decomposition
- Lyb - Solve for y
- Uxy - Solve for x
52Matrix Inversion
53Matrix Inversion
A
A-1
A A-1I
If A-1 does not exist A is singular
54Matrix Inversion
55Matrix Inversion
Solution
56Matrix Inversion
- To calculate the invert of a nxn matrix solve n
times
57Iterative Methods
Recall Techniques for Root finding of Single
Equations
Initial Guess New Estimate Error
Calculation Repeat until Convergence
58Gauss Seidel
59Gauss Seidel
First Iteration
60Gauss Seidel
Second Iteration
61Gauss Seidel
Iteration Error
Convergence Criterion
62Jacobi Iteration
63Jacobi Iteration
First Iteration
64Jacobi Iteration
Second Iteration
65Jacobi Iteration
Iteration Error
66Determinants
Are composed of same elements
Completely Different Mathematical Concept
67Determinants
Defined in a recursive form
2x2 matrix
68Determinants
Defined in a recursive form
3x3 matrix
69Determinants
Minor a11
70Determinants
Minor a12
71Determinants
Minor a13
72Singular Matrices
If detA0 solution does NOT exist
73Determinants and LU Decomposition
74Curve Fitting
Often we are faced with the problem
75Curve Fitting
Question 1 Is it possible to find a simple and
convenient formula that reproduces the points
exactly?
Interpolation
76Curve Fitting
Question 2 Is it possible to find a simple and
convenient formula that represents data
approximately ?
Approximation
77Linear Interpolation
First order interpolating polynomial
Slope of Line
1st DIVIDED DIFFERENCE f xi1,xi
78Function Interpolation
- Quadratic Interpolation
- Better Accuracy if
- 2nd Order Polynomial
79General Form of Newtons Interpolating Polynomials
80Lagrange Interpolating Polynomials
- Reformulation of Newtons Polynomials
- Avoid Calculation of Divided Differences
x f(x)
xo f(xo )
x1 f(x1 )
x2 f(x2 )
xn f(xn)
81Lagrange Interpolating Polynomial
Cardinal Functions Product of n-1 linear factors
Property
82Errors in Polynomial Interpolation
f(x)
It is expected that as number of nodes increases,
error decreases, HOWEVER.
83Errors in Polynomial Interpolation
Beware of Oscillations.
For Example Consider f(x)(1x2)-1 evaluated at
9 points in -5,5 And corresponding p8(x)
Lagrange Interpolating Polynomial
84Other Methods
Direct Evaluation
n1 coefficients
n1 Data Points
Interpolating Polynomial should represent them
exactly
85Other Methods
Direct Evaluation
86Other Methods
Solve Using any of the methods we have learned
87Other Methods
- Not the most efficient method
- Ill-conditioned matrix (nearly singular)
- If n is large highly inaccurate coefficients
- Limit to lower order polynomials
88Inverse Interpolation
X?
89Inverse Interpolation
Switch x and y and then interpolate?
X?
Not a Good Idea!
90Splines
91Splines
Piecewise smooth polynomials
92(No Transcript)
93E.G Quadratic Splines
- Function Values at adjacent polynomials are equal
at interior nodes
94E.G Quadratic Splines
- First and Last Functions pass through end points
95E.G Quadratic Splines
- First Derivatives at Interior nodes are equal
96E.G Quadratic Splines
- Assume Second Derivative _at_ First Point0
97E.G Quadratic Splines
- Assume Second Derivative _at_ First Point0
Solve 3nx3n system of Equations
98Spline Interpolation