1 / 38

Computational Modeling for Engineering MECN 6040

Computational Modeling for Engineering MECN 6040. Professor: Dr. Omar E. Meza Castillo omeza@bayamon.inter.edu http://facultad.bayamon.inter.edu/omeza Department of Mechanical Engineering. Implementation of SOLUTION methods. Gaussian elimination, LU factorization, and others. Introduction.

angus
Télécharger la présentation

Computational Modeling for Engineering MECN 6040

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computational Modeling for EngineeringMECN 6040 Professor: Dr. Omar E. Meza Castillo omeza@bayamon.inter.edu http://facultad.bayamon.inter.edu/omeza Department of Mechanical Engineering

  2. Implementation of SOLUTION methods Gaussian elimination, LU factorization, and others

  3. Introduction • An equation of the form ax+by+c=0 or equivalently ax+by=-c is called a linear equation in x and y variables. • ax+by+cz=d is a linear equation in three variables, x, y, and z. • Thus, a linear equation in n variables is a1x1+a2x2+ … +anxn = b • A solution of such an equation consists of real numbers c1, c2, c3, … , cn. If you need to work more than one linear equations, a system of linear equations must be solved simultaneously.

  4. Solving Small Number of Equations • For small number of equations (n ≤ 3) linear equations can be solved readily by simple techniques such as “method of elimination.” • Linear algebra provides the tools to solve such systems of linear equations. • Nowadays, easy access to computers makes the solution of large sets of linear algebraic equations possible and practical.

  5. Solving Small Number of Equations • There are many ways to solve a system of linear equations: • Graphical method • Cramer’s rule • Method of elimination • Computer methods.

  6. The Graphical Method • For two equations: • Solve both equations for x2:

  7. The Graphical Method • Or equate and solve for x1

  8. The Graphical Method • No solution Infinite solutions • Ill-conditioned • (Slopes are too close)

  9. Application Problems

  10. The Graphical Method x1 + x2 = 3 2x1 – x2 = 3 One solution

  11. The Graphical Method No solution 2x1 – x2 = – 1 2x1 – x2 = 3

  12. The Graphical Method Infinite solutions 2x1 – x2 = 3 6x1 – 3x2 = 9

  13. Cramer’s Rule • Compute the determinant D • 2 x 2 matrix • 3 x 3 matrix

  14. Cramer’s Rule • To find xk for the following system • Replace kth column of as with bs (i.e., aikbi )

  15. Cramer’s Rule • 3 x 3 matrix

  16. Application Problems

  17. Example 9.3

  18. Elimination Method Eliminate x2  Subtract to get Not very practical for large number (> 4) of equations

  19. 2 x 2 matrix

  20. NAVIE GAUSS Elimination The system can be written in a matrix format as • Gauss elimination is the most important algorithm to solve systems of linear equations. • It involves by combining equations to eliminate unknowns. • It involves 2 phases: • Forward elimination phase: reduce the set of equations to an upper triangular system. • Back substitution: work from the last equation up.

  21. NAVIE GAUSS Elimination • In the first step of the forward elimination phase, x1 is eliminated from all equations except the first one. • The coefficient of x1 in the first equation is called the pivot element. • The second step is to eliminate x2 from the third equation through the nth equation. • Do the same for all variables x3 to xn-1. • The goal is to set up upper triangular matrix • The back-substitution phase starts from the last equation up, to find the values of x1, x2, …, xn.

  22. NAVIE GAUSS Elimination Forward elimination phase Gauss Elimination Pseudocode Back substitution

  23. NAVIE GAUSS Elimination Use Gauss elimination to solve Carry 6 significant figures Solution 1. Forward elimination: eliminate x1 from equation (2):  - (0.1/3)   

  24. Eliminate x1 from equation (3):  - (0.3/3)    After eliminating x1 from equations (2) and (3), the system becomes Eliminate x2 from equation (3):  + (0.190000/7.00333)    After eliminating x2 from equation (3), the system becomes

  25. 2. Back Substitution:find the value of x3 from equation (3): Substitute the value of x3 in equation (2) to find the value of x2: Substitute the values of x2 and x3 in equation (1) to find the value of x1:

  26. Pitfalls of Elimination Methods • Division by zero (Partially solved by the pivoting technique) • Round-off errors (Important when large number of equation are to be solved) • Ill-conditioned systems: Small changes in coefficients result in large changes in the solution. When

  27. Techniques for Improving Solutions • Use of more significant figures (The simplest remedy) • Pivoting(Determine the largest available coefficient in the column below the pivot element and switch rows so that the largest element is the pivot element)

  28. Techniques for Improving Solutions • Scaling (Divide each row by the largest element in that row) Without Scaling: With Scaling: With Scaling and Pivoting:

  29. MATLAB Script File: NGaussElim.m

  30. Application Problems

  31. Example 9.5 >>Enter Matrix A > [3 -0.1 -0.2; 0.1 7 -0.3; 0.3 -0.2 10] A = 3.0000 -0.1000 -0.2000 0.1000 7.0000 -0.3000 0.3000 -0.2000 10.0000 >>Enter Solution Vector B > [7.85 -19.3 71.4] B = 7.8500 -19.3000 71.4000 S = 3.0000 -2.5000 7.0000

  32. MATLAB Script File: GaussElimPPivot.m

  33. Example >>Enter Matrix A > [1 0 2 3; -1 2 2 -3; 0 1 1 4; 6 2 2 4] A = 1 0 2 3 -1 2 2 -3 0 1 1 4 6 2 2 4 >>Enter Solution Vector B > [1 -1 2 1] B = 1 -1 2 1 S = -0.1857 0.2286 -0.1143 0.4714

  34. GAUSS-JORDAN Method • It is a variation of Gauss elimination. Both methods use row operations to eliminate variables • The major difference is that what an unknown is eliminated, it is eliminated from all other equations. • Also, all rows (equations) are normalized by dividing by their pivot elements. • The elimination phase produces an identity matrix. • It does not involve the back substitution phase.

  35. MATLAB Script File: GaussJordan.m

  36. Application Problems

  37. Example 9.12 >>Dame la matriz aumentada Cuantas filas tiene la matriz: 3 Cuantas columnas tiene la matriz: 4 fila : 1 columna : 1Numero de esta fila y columna: 3 fila : 2 columna : 1Numero de esta fila y columna: 0.1 fila : 3 columna : 1Numero de esta fila y columna: 0.3 … Continuar ingresando los valores de la matriz aumentada a = 3.0000 -0.1000 -0.2000 7.8500 0.1000 7.0000 -0.3000 -19.3000 0.3000 -0.2000 10.0000 71.4000 a = 1.0000 0 0 3.0000 0 1.0000 0 -2.5000 0 0 1.0000 7.0000 resultado

  38. MATLAB’s Methods To solve the system Enter the following commands >> A=[3 -.1 -.2; .1 7 -0.3;.3 -.2 10]; >> b=[7.85;-19.3;71.4]; >> inv(A)*b ans = 3.0000 -2.5000 7.0000

More Related