Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II.

Similar presentations


Presentation on theme: "ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II."— Presentation transcript:

1 ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II

2 Topics Introduction to Matrix Algebra Gauss Elimination LU Decomposition Matrix Inversion Iterative Methods Function Interpolation & Approximation Newton Polynomials Lagrange Polynomials

3 Matrix Algebra Rectangular Array of Elements Represented by a single symbol [A]

4 Matrix Algebra Row 1 Row 3 Column 2Column m n x m Matrix

5 Matrix Algebra 3 rd Row 2 nd Column

6 Matrix Algebra 1 Row, m Columns Row Vector

7 Matrix Algebra n Rows, 1 Column Column Vector

8 Matrix Algebra If n = m Square Matrix e.g. n=m=5 Main Diagonal

9 Matrix Algebra Special Types of Square Matrices Symmetric: a ij = a ji

10 Matrix Algebra Diagonal: a ij = 0, i  j Special Types of Square Matrices

11 Matrix Algebra Identity: a ii =1.0 a ij = 0, i  j Special Types of Square Matrices

12 Matrix Algebra Upper Triangular Special Types of Square Matrices

13 Matrix Algebra Lower Triangular Special Types of Square Matrices

14 Matrix Algebra Banded Special Types of Square Matrices

15 Matrix Operating Rules - Equality [A] mxn =[B] pxq n=pm=qa ij =b ij

16 Matrix Operating Rules - Addition [C] mxn = [A] mxn +[B] pxq n=p m=q c ij = a ij +b ij

17 Matrix Operating Rules - Addition Properties [A]+[B] = [B]+[A] [A]+([B]+[C]) = ([A]+[B])+[C]

18 Multiplication by Scalar

19 Matrix Multiplication [A] n x m. [B] p x q = [C] n x q m=p

20 Matrix Multiplication

21

22 Matrix Multiplication - Properties Associative: [A]([B][C]) = ([A][B])[C] If dimensions suitable Distributive: [A]([B]+[C]) = [A][B]+[A] [C] Attention: [A][B]  [B][A]

23 Operations - Transpose

24 Operations - Inverse [A][A] -1 [A] [A] -1 =[I] If [A] -1 does not exist [A] is singular

25 Operations - Trace Square Matrix tr[A] =  a ii

26 Linear Equations in Matrix Form

27

28 Gauss Elimination Consider (Eq 1) (Eq 2) Solution 2*(Eq 1) (Eq 2) Solution !!!!!! Scaling Does Not Change the Solution

29 Gauss Elimination Consider (Eq 1) (Eq 2)-(Eq 1) Solution !!!!!! (Eq 1) (Eq 2) Solution Operations Do Not Change the Solution

30 Gauss Elimination Example Forward Elimination

31 Gauss Elimination -

32 Substitute 2 nd eq with new

33 Gauss Elimination -

34 Substitute 3rd eq with new

35 Gauss Elimination -

36 Substitute 3rd eq with new

37 Gauss Elimination Forward Elimination

38 Gauss Elimination Back Substitution

39 Gauss Elimination – Potential Problem Pivoting

40 Partial Pivoting a 32 >a 22 a l2 >a 22 NO YES

41 Partial Pivoting

42 Full Pivoting In addition to row swaping Search columns for max elements Swap Columns Change the order of x i Most cases not necessary

43 LU Decomposition

44 PIVOTS Column 1 PIVOTS Column 2

45 LU Decomposition As many as, and in the location of, zeros Upper Triangular Matrix U

46 LU Decomposition PIVOTS Column 1 PIVOTS Column 2 Lower Triangular Matrix L

47 LU Decomposition = This is the original matrix!!!!!!!!!!

48 LU Decomposition Lyb

49 Lyb

50

51 Ax=b A=LU -LU Decomposition Ly=b- Solve for y Ux=y- Solve for x

52 Matrix Inversion

53 [A][A] -1 [A] [A] -1 =[I] If [A] -1 does not exist [A] is singular

54 Matrix Inversion

55 Solution

56 Matrix Inversion To calculate the invert of a nxn matrix solve n times :

57 Iterative Methods Recall Techniques for Root finding of Single Equations Initial Guess New Estimate Error Calculation Repeat until Convergence

58 Gauss Seidel

59 First Iteration: Better Estimate

60 Gauss Seidel Second Iteration: Better Estimate

61 Gauss Seidel Iteration Error: Convergence Criterion:

62 Jacobi Iteration

63 First Iteration: Better Estimate

64 Jacobi Iteration Second Iteration: Better Estimate

65 Jacobi Iteration Iteration Error:

66 Determinants Are composed of same elements Completely Different Mathematical Concept

67 Determinants Defined in a recursive form 2x2 matrix

68 Determinants Defined in a recursive form 3x3 matrix

69 Determinants Minor a 11

70 Determinants Minor a 12

71 Determinants Minor a 13

72 Singular Matrices If det[A]=0 solution does NOT exist

73 Determinants and LU Decomposition

74 Curve Fitting Often we are faced with the problem… what value of y corresponds to x=0.935?

75 Curve Fitting Question 1 : Is it possible to find a simple and convenient formula that reproduces the points exactly? e.g. Straight Line ? …or smooth line ? …or some other representation? Interpolation

76 Curve Fitting Question 2 : Is it possible to find a simple and convenient formula that represents data approximately ? e.g. Best Fit ? Approximation

77 Linear Interpolation Slope of Line 1 st DIVIDED DIFFERENCE f [x i+1,x i ] First order interpolating polynomial

78 Function Interpolation Quadratic Interpolation Better Accuracy if 2 nd Order Polynomial x

79 General Form of Newton’s Interpolating Polynomials

80 Lagrange Interpolating Polynomials Reformulation of Newton’s Polynomials Avoid Calculation of Divided Differences xf(x) xoxo f(x o ) x1x1 f(x 1 ) x2x2 f(x 2 ) …… xnxn f(x n )

81 Lagrange Interpolating Polynomial Cardinal Functions: Product of n-1 linear factors Skip x i Property:

82 Errors in Polynomial Interpolation It is expected that as number of nodes increases, error decreases, HOWEVER…. At all interpolation nodes x i Error=0 At all intermediate points Error: f(x)-f n-1 (x) f(x)

83 Errors in Polynomial Interpolation Beware of Oscillations…. For Example: Consider f(x)=(1+x 2 ) -1 evaluated at 9 points in [-5,5] And corresponding p 8 (x) Lagrange Interpolating Polynomial P 8 (x) f(x)

84 Other Methods Direct Evaluation n+1 coefficients n+1 Data Points Interpolating Polynomial should represent them exactly

85 Other Methods Direct Evaluation

86 Other Methods Solve Using any of the methods we have learned

87 Other Methods Not the most efficient method Ill-conditioned matrix (nearly singular) If n is large highly inaccurate coefficients Limit to lower order polynomials

88 Inverse Interpolation X=?

89 X=? Switch x and y and then interpolate? Not a Good Idea!

90 Splines

91 Piecewise smooth polynomials

92

93 E.G Quadratic Splines Function Values at adjacent polynomials are equal at interior nodes

94 E.G Quadratic Splines First and Last Functions pass through end points

95 E.G Quadratic Splines First Derivatives at Interior nodes are equal

96 E.G Quadratic Splines Assume Second Derivative @ First Point=0

97 E.G Quadratic Splines Assume Second Derivative @ First Point=0 Solve 3nx3n system of Equations

98 Spline Interpolation Polynomial Interpolation Spline Interpolation Polynomial Interpolation


Download ppt "ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II."

Similar presentations


Ads by Google