Numerical Methods: Dr. Charisma Choudhury

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

CE 205

Numerical Methods
Dr. Charisma Choudhury
Lecture 1 March 30, 2009

Objective
Some of the analysis methods you have used so far..
Algebra Calculus Differential Equations etc.

Often not possible to determine analytical solution


Complex calculation Sheer size of problem

Why Numerical Methods?


Example:
No closed form solution
Length of one half of the curve y = sin(x):

1 + cos 2 ( x) dx

Large matrices

Computer is not so smart


Need to break the problem to simple mathematical problems
Add, subtract, multiply, divide, compare

Practical considerations
Example: Length of a board derived by solving equation: x 3 - x 2 - 3x + 3=0
How accurately can we measure for practical applications?

Course Outline
Numerical solution of algebraic and transcendental equations Solution of systems of linear equations Linear and non-linear curve-fitting by least square regression Finite differences Divided differences Interpolation Numerical differentiation and integration Numerical solution of differential equations

Course Outline
Numerical solution of algebraic and transcendental equations Solution of systems of linear equations Linear and non-linear curve-fitting by least square regression Finite differences Divided differences Interpolation Numerical differentiation and integration Numerical solution of differential equations

Lecture Plan
Algebraic and transcendental equations Curve-fitting Differential equations CE applications and review 5 classes 3 classes 4 classes 1 class

References
Any standard undergraduate textbook on Numerical Methods Some examples:
Numerical Analysis: Goel & Mittal Applied Numerical Analysis: Gerald & Wheatley Numerical Methods for Engineers: Chapra & Canale Introductory Methods of Numerical Analysis: Sastry

Grading Policy
3 quizzes Tentatively on 5th, 9th and 12th class
Or maybe one computer programming assignment? The last one is only a make-up quiz/assignment

Approach
Often multiple methods for solving same problem
Which is the most relevant method?
Examine the problem What inputs do we have? What accuracy do we need? What is the computational burden? What is the rate of convergence?

Errors in Numerical Methods


Error in original data/measurement error Truncation error: ex=1+ x/1! + x 2/2!+ Round-off error: 1/3, etc. Calculations errors
significant digits

Errors
Abs error = |true-apprx|
Relative= abs error /true
5000+/-0.10 0.005+/-0.1

True=10/3, apprx = 3.333 Abs=1/3000 Rel=1/10000

Significant digits 4

Algebraic and Transcendental Equations


Algebraic: y =ax+b Transcendental: y = a sinx+b cosx

Solution Methods
Bisection/ Half-interval Search Method of false position/Regula Falsi Secant Method Newton Raphson Iteration Method Many more

Choice of Method Depends on ..


Required accuracy Rate of convergence Inputs
How does initial approximation affect the computation?

Often combination of multiple methods is the optimum

Bisection/ Half-interval Search


Background:
Lessons from Graphical approach
Solve: f(x)=0 Let y=f(x) Take a set of rectangular coordinates within a range (say xL and xU) Plot Root(s): the point(s) where y crosses x

Background
Different variations (Examples shown in next page)
Single root Multiple roots No root within specified range

1 root

no roots

3 roots

2 roots

Background
Observations
If f(xl) and f(xU) have opposite signs
Odd number of roots in between

If f(xl) and f(xU) have same signs


Zero/even number of roots in between

Exceptions
Discontinuous function

Discontinuous Function

Deductions
If f(x) is
continuous between xL and xU and f(xl) * f(xU) <0 (i.e. f(xl) and f(xU) have opposite signs) There is at least 1 real root f(x)=0 between xL and xU

10

Example
Tangential functions can have any number of roots even irrespective of sign change/unchange

Deductions
If f(x) is
continuous and strictly monotonic between xL and xU and f(xl) * f(xU) <0 (i.e. f(xl) and f(xU) have opposite signs) There is atmost 1 real root f(x)=0 between xL and xU

11

Basis of Bisection Method


Narrow down interval [f(xL) and f(xU) ]to locate where the sign change occurs Divide into equal sub-intervals to search the point where the sign change occurs

Steps
Choose xL and xL such that f(xL)*f(xU)<0 Initial estimate of root xR=(xL + xU)/2 f(xR)*f(xL)<0, root is in lower interval, replace xU by xR f(xR)*f(xL)>0, root is in upper interval, replace xL by xR Terminate when f(xR)=f(xL) or f(xU)-f(xL)<tolerance

12

Example
f(x)=x3-x-1 x L =1,x U =2 x R=1.5

Solution: x=1.324
xL 1.0000 1.0000 1.2500 1.2500 1.3125 1.3125 1.3125 1.3203 1.3242 xR 1.5000 1.2500 1.3750 1.3125 1.3438 1.3281 1.3203 1.3242 1.3262 xU 2.0000 1.5000 1.5000 1.3750 1.3750 1.3438 1.3281 1.3281 1.3281 f(xL) -ve -ve -ve -ve -ve -ve -ve -ve -ve f(xR) +ve -ve +ve -ve +ve +ve -ve -ve +ve f(xU) +ve +ve +ve +ve +ve +ve +ve +ve +ve DifferenceRemark 1.0000 replace upper 0.5000 replace lower 0.2500 replace upper 0.1250 replace lower 0.0625 replace upper 0.0313 replace upper 0.0156 replace lower 0.0078 replace lower 0.0039 OK at 0.01 tolerance

Note: OK at 0.01 tolerance. Not ok at 0.001 tolerance, need more iterations.

13

Practice Problems
Find roots of the following in bisection method
a. e x = Sin( b. xe x = 2

x
2

14

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy