Loading...

PPT – Numerical Methods, PowerPoint presentation | free to download - id: 6e6cd0-NDRhN

The Adobe Flash plugin is needed to view this content

Todays class

- Numerical differentiation
- Roots of equation
- Bracketing methods

Numerical Differentiation

- Finite divided difference
- First forward difference
- First backward difference

Numerical Differentiation

- Centered difference approximation
- Subtract the two equations

Numerical Differentiation

- First forward difference

Numerical Differentiation

- First backward difference

Numerical Differentiation

- Centered difference

Error Propagation

- What is the effect of error in one calculation

propagating to subsequent calculations? - Example
- Multiplying sin x with cos x
- Single variable functions

Error Propagation

- Use Taylor series

Error Propagation

Error Propagation

- Multivariable functions

Numerical stability

- Condition of a problem is a measure of its

sensitivity to changes in input values - The condition number is defined as the ratio of

the relative function error to the relative value

error

Numerical stability

- Condition number lt 1 indicates a well-conditioned

function i.e. changes in the input are

attenuated - Condition number gt 1 indicates a ill-conditioned

function i.e. changes in the input are amplified

Roots of equation

- Given a function f(x), the roots are those values

of x that satisfy the relation f(x) 0 - Example
- From the quadratic formula, the roots are

Roots of Equations

- The need to solve for roots show up in many

engineering problems - Also, can be used to find solutions to implicit

variables

Example

- Find a value of R such that current is 5A at t

1s

Example

- It is not possible to isolate R to the left side

and thus solve for R - R is know as an implicit variable
- Rewrite the function as a function of R set to 0

Roots of equations

- Still need a method to solve for this root
- Other examples of difficult to solve roots

Roots of equations

- Non-computer methods
- Graphical methods

Graphical methods

- Not exact
- Can give you a rough estimate of the root,
- Can give you insights on the number of roots and

shape of the curve - Can use the rough estimate in more precise

numerical methods

Graphical methods

- Use to get an initial estimate of the root and

also to find out how many roots there are

Graphical methods

Graphical methods

Graphical methods

Roots of equation

- Non-computer/numerical method
- Exhaustive search method
- To find the root in the interval a,b, start at

xa and check if f(a) 0, then try f(a?),

f(a2?), and so on, until we get f(x)

sufficiently close to 0 - If the step value ? is sufficiently small we can

obtain an accurate result but this could take an

extremely long time. For example, if the interval

is 0,10 and the step size is ? 0.001, it will

take on average 10,000 guesses - In addition to the inefficiency of this approach,

if f(x) is a steep function, this approach may

not produce an accurate results

Exhaustive search

- Example
- Find the root of the function
- Actual root is at x1.0001
- With an interval of 0.9, 1.1 and a step size of

? 0.001. The exhaustive search method will test

f(1.000) -0.01 and f(1.001) 0.086, neither of

which are that close to f(x) 0

Roots of equations

- More systematic methods are required
- Bracketing methods
- Open methods

Incremental search methods

- Locate an interval where sign changes
- Divide interval into smaller subintervals which

are then searched for sign changes - Keep repeating until root is found with

sufficient confidence

Bisection method

- Also called
- Binary chopping
- Interval halving
- An incremental search method where the interval

is cut in half

Bisection method

- Step 1
- Choose lower xl and upper xu such that the

function changes sign over that range i.e.

f(xl) and f(xu) are different signs or f(xl)

f(xu) lt 0 - Step 2
- Estimate root to be xr(xlxu)/2

Bisection method

- Step 3
- Determine in which subinterval the root lies
- If f(xr)?0 is within acceptable tolerance, stop

and root equals xr - If f(xl) f(xr) lt 0, then root is in lower

subinterval. Set xu xr, and return to step 2 - If f(xl) f(xr) gt 0, then root is in upper

subinterval. Set xl xr, and return to step 2

Bisection method

- Termination criteria
- Use approximate relative error calculation to

determine when to stop - In general, ?a is larger than ?t

Bisection method

- Example
- Use range of 202204
- Root is in upper subinterval

Bisection method

Bisection method

- Use range of 203203.5
- Root is in upper subinterval

Error estimates

- The approximate error is upper bound estimate of

the true error - When the root is near one of the ends of the

interval, the approximate error is fairly close

to the actual true error - Error is fairly well-contained

Error estimates

- You always know that the true root is within ?x/2

of your estimate

Bisection method

Bisection method

- You can calculate an error estimate based just on

the initial guesses - You can also make estimates on the error on

future iterations - Superscripts indicates the iteration number

Bisection method

- Each subsequent iteration cuts the approximate

error in half - This, allows to determine a priori exactly how

many iterations are needed to arrive at the

desired error

False Position Method

- The false position method works in a similar

fashion to the bisection method - Start with an initial interval a,b where f(a)

and f(b) have opposite signs, which is the same

as the bisection - Instead of choosing the initial guess xr as the

midpoint of the interval, we join the point

a,f(a) and b,f(b) with a straight line and

choose xr as the point where that straight line

crosses the x-axis.

False Position Method

False Position Method

- Algorithm is the same as bisection method with

the same three steps

False Position Method

- Step 1
- Choose lower xl and upper xu such that the

function changes sign over that range - i.e.

f(xl) and f(xu) are different signs - or f(xl)

f(xu) lt 0 - Step 2
- Estimate new root to be

False Position Method

- Step 3
- Determine in which subinterval the root lies
- If f(xr) ? 0 is within acceptable tolerance, stop

and root equals xr - If f(xl) f(xr) lt 0, then root is in lower

subinterval. Set xu xr, and return to step 2 - If f(xl) f(xr) gt 0, then root is in upper

subinterval. Set xl xr, and return to step 2

Next class

- Roots of equations
- Open methods
- Read chapters 5 and 6
- HW2, due 9/17
- Chapra Canale
- 6th edition 3.5, 3.7, 3.13, 4.5, 4.6, 4.12 (b)

and (d), and 4.16