mecn 3500 inter - bayamon lecture 8 numerical methods for engineering mecn 3500 professor: dr. omar...

13
MECN 3500 MECN 3500 Inter - Bayamon Inter - Bayamon Lecture Lecture 8 8 Numerical Methods for Engineering Numerical Methods for Engineering MECN 3500 MECN 3500 Professor: Dr. Omar E. Meza Castillo Professor: Dr. Omar E. Meza Castillo [email protected] http://www.bc.inter.edu/facultad/omeza Department of Mechanical Engineering Department of Mechanical Engineering Inter American University of Puerto Rico Inter American University of Puerto Rico Bayamon Campus Bayamon Campus

Upload: tyler-mathews

Post on 13-Dec-2015

226 views

Category:

Documents


5 download

TRANSCRIPT

MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on

LectureLecture

88Numerical Methods for EngineeringNumerical Methods for Engineering

MECN 3500 MECN 3500

Professor: Dr. Omar E. Meza CastilloProfessor: Dr. Omar E. Meza [email protected]

http://www.bc.inter.edu/facultad/omeza

Department of Mechanical EngineeringDepartment of Mechanical Engineering

Inter American University of Puerto RicoInter American University of Puerto Rico

Bayamon CampusBayamon Campus

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on

22

Tentative Lectures ScheduleTentative Lectures Schedule

TopicTopic LectureLecture

Mathematical Modeling and Engineering Problem SolvingMathematical Modeling and Engineering Problem Solving 11

Introduction to MatlabIntroduction to Matlab 22

Numerical ErrorNumerical Error 33

Root FindingRoot Finding 4-5-64-5-6

System of Linear EquationsSystem of Linear Equations 77

Least Square Curve FittingLeast Square Curve Fitting

Polynomial Interpolation Polynomial Interpolation

Numerical IntegrationNumerical Integration

Ordinary Differential Equations Ordinary Differential Equations

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on

Elimination MethodElimination Method

LU Decomposition and Matrix LU Decomposition and Matrix InversionInversion

33

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on

To solve linear algebraic equations using To solve linear algebraic equations using the technique the technique LU DecompositionLU Decomposition in order in order to provides an efficient means to compute to provides an efficient means to compute the matrix inverse. the matrix inverse.

44

Course ObjectivesCourse Objectives

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on

Provides an efficient way to compute Provides an efficient way to compute matrix inverse by separating the time matrix inverse by separating the time consuming elimination of the consuming elimination of the Matrix [A]Matrix [A] from manipulations of the from manipulations of the right-hand right-hand side {B}side {B}..

Gauss eliminationGauss elimination, in which the forward , in which the forward elimination comprises the bulk of the elimination comprises the bulk of the computational effort, can be computational effort, can be implemented as an LU decompositionimplemented as an LU decomposition

55

IntroductionIntroduction

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on

66

LU DecompositionLU Decomposition

IfL- lower triangular matrixU- upper triangular matrixThen, [A]{X} = {B} or [A]{X} - {B} = 0

[L]{[U]{X}-{D}} = [A]{X} - {B}

0

00

0

3

2

1

3

2

1

33

2322

131211

DXU

d

d

d

x

x

x

u

uu

uuu

1

01

001

3231

21

ll

lL

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on LU DecompositionLU Decomposition

[L][U]=[L][U]=[A] [A] andand [L]{D}= [L]{D}={B}{B}

A two-step strategyA two-step strategy1.-LU Decomposition step: 1.-LU Decomposition step: [A] [A] can be can be

decomposed into two matrices decomposed into two matrices [L][L] and and [U][U] such that such that [L][U]=[A][L][U]=[A]

2.-Substitution step: 2.-Substitution step: Similar to first phase of Similar to first phase of Gauss eliminationGauss elimination, consider, consider[U]{X}={D}[U]{X}={D}[L]{D}={B}[L]{D}={B}[L]{D}={B}[L]{D}={B} is used to generate an is used to generate an intermediate vector intermediate vector {D}{D} by forward by forward substitutionsubstitutionThen, Then, [U]{X}={D}[U]{X}={D} is used to get is used to get {X}{X} by by back substitution.back substitution.

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on LU DecompositionLU Decomposition

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on LU DecompositionLU Decomposition

Requires the same total FLOPS as for Requires the same total FLOPS as for Gauss elimination.Gauss elimination.

Saves computing time by separating time-Saves computing time by separating time-consuming elimination step from the consuming elimination step from the manipulations of the right hand side.manipulations of the right hand side.

Provides efficient means to compute the Provides efficient means to compute the matrix inversematrix inverse

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on NGaussElimwLUDecomp.mNGaussElimwLUDecomp.m

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on

>>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.4000S = 3.0000 -2.5000 7.0000Bc = 7.8500 -19.3000 71.4000

>>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.4000S = 3.0000 -2.5000 7.0000Bc = 7.8500 -19.3000 71.4000

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on

Lecture 8Lecture 8MEC

N 3

500 I

nte

r -

Bayam

on

MEC

N 3

500 I

nte

r -

Bayam

on