ChE 250 Numeric Methods - PowerPoint PPT Presentation

About This Presentation
Title:

ChE 250 Numeric Methods

Description:

Systems of linear equations. Determinates, Cramer's Rule. Calculate with Matlab/Scilab ... Using matrix notation our previous equation reduces to a linear set. ... – PowerPoint PPT presentation

Number of Views:93
Avg rating:3.0/5.0
Slides: 21
Provided by: christi183
Category:

less

Transcript and Presenter's Notes

Title: ChE 250 Numeric Methods


1
ChE 250 Numeric Methods
  • Lecture 11, Chapra Chapter 9
  • 20070209

2
Gauss Elimination
  • Background
  • Systems of linear equations
  • Determinates, Cramers Rule
  • Calculate with Matlab/Scilab
  • Naïve Gauss Elimination
  • Pitfalls
  • singularity
  • Improving the Method
  • Pivoting
  • Scaling
  • Non-linear systems
  • Gauss-Jordan

3
Linear Equations
  • For a set of n equations and n unknowns, the
    equations are said to be linear if they can be
    expressed as a sum of coefficients and the
    variable only
  • It is convenient to use matrix arithmetic to
    represent the set of equations

4
Linear Equations
  • Call the square matrix of a coefficients A and
    the column vector of variables X and the column
    vector of b coefficients B
  • To solve for the variable values given all of the
    constants we can multiply both sides of the
    equation by the inverse matrix of A-1

5
Linear Equations
  • The only problem with this neat solution is that
    generally it is difficult to calculate the
    inverse matrix, especially of the matrix is large
  • Scilab/Matlab can easily calculate inverse
    matrix, and will indicate if it is singular or
    nearly singular, but it will not detect round off
    error
  • Matlab limit?

6
Two Equations
  • For two equations and two unknowns the graphical
    solution is available
  • This can easily verify the matrix solution
  • Matlab is very easy to use for this type of
    problem

7
Cramers Rule
  • Cramers rule relies on the evaluation of the
    determinate of the coefficient matrix as well as
    that of a modified matrix
  • Because this is computationally intensive for
    large n, this method is only used for small
    systems

8
Gauss Elimination
  • Gauss Elimination systematically removes one
    variable at a time from the set until all are
    solved
  • No determinate or inverse matrix is required
  • This is important because calculation time is
    proportional to the cube of the order, n

9
Gauss Elimination
  • The idea is to eliminate one variable from all
    subsequent rows by subtracting a ratio of the
    current row
  • The prime indicates how many subtractions the row
    experienced
  • On the last row, that variable will be solved
  • Then back substitute all the way up

10
Pitfalls
  • There can be the case were two of the equations
    in the system are singular, they do not have a
    solution
  • The three examples below show no solution (a),
    infinite solution (b), and ill-conditioned (c)

11
Pitfalls
  • The matrix may contain zero values on the
    diagonal, which cause a division by zero error
    in a program
  • Also the constants may be dissimilar in
    magnitude, which can cause round off errors in
    the calculations and loss of significant figures

12
Improving Gauss
  • Two techniques to reduce errors are scaling and
    pivoting
  • Pivoting
  • Select the largest value of aij for the current
    column j, igtj and use that as the pivot
  • Scaling
  • Used with pivoting, this uses a scaled value of
    the row constant for comparison

13
Gauss with Scaled Pivots
  • First, scale all rows
  • Then decide the pivot row order
  • Then go back to the original matrix and perform
    the pivot elimination
  • The scaled equations also may show any
    singularities

14
Gauss with Scaled Pivots
  • To visualize the elimination, we can actually
    reorder the set to show the diagonal pivot
  • This step is not necessary in a computer
    algorithm, just follow the pivot order
  • Once the elimination is complete, solve for xn
    and then substitute this value into row n-1 and
    solve for xn-1, etc.
  • Questions?

15
Gauss and Non-Linear Systems
  • The first step is to make a linear Taylor
    expansion of the equations, and use the
    multi-dimensional Newton-Raphson method
  • Using matrix notation our previous equation
    reduces to a linear set.

16
Systems of Nonlinear Equations
Taylor Expansion for two variables
Rearrange and group
17
Non-Linear Equations
18
Non-Linear Systems
  • For n equations the partials make a square matrix
  • This can be solved using the Gauss method
  • The problem comes up of how to calculate all
    those partials.frequently a finite difference
    method must be used

19
Gauss-Jordan
  • Gauss-Jordan method eliminates forward and
    backward at every step
  • This produces a solution without the back
    substitution set which may be easier to program
  • However it involves approximately 50 more
    calculations which adds time and error to large
    sets

20
Preparation for Feb 12th
  • Reading
  • Chapra Chapter 10 LU Decomposition
Write a Comment
User Comments (0)
About PowerShow.com