ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Post on 17-Jan-2016

216 views 1 download

Transcript of ME 142 Engineering Computation I Root Finding & Iterative Solutions.

ME 142Engineering Computation I

Root Finding

&

Iterative Solutions

Key Concepts

Find Roots by PlottingFind Roots by Bisection RoutineFind Roots by using Goal Seek

Using a Graph to Find Roots

How do you plot a function in Excel?

Using a Graph to Find Roots

Approximate process May be used as a starting process to an iterative method May want to refine axis max/min values to focus on plot on

area of interest

Example ProblemFind all the roots for the following

equation: Plot (approximate)

42 2 xy

Using a Graph to Find Roots42 2 xy

x y-10 -196-9 -158-8 -124-7 -94-6 -68-5 -46-4 -28-3 -14-2 -4-1 20 41 22 -43 -144 -285 -466 -687 -948 -1249 -15810 -196

-15 -10 -5 0 5 10 15

-250

-200

-150

-100

-50

0

50

y

y

-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5

-5

-4

-3

-2

-1

0

1

2

3

4

5

y

y

Bisection Routine

What do we mean by iterative solutions?

Bisection Routine

1. Begin with initial guess: xlow, xhi

2. Calculate corresponding f(x): f(xlow), f(xhi) f(xlow)*f(xhi)<0, to ensure root lies within interval

3. Estimate Root and calculate corresponding f(xroot)

4. Determine subinterval of root If f(xlow)*f(xroot)<0 , set xhi=xroot

If f(xlow)*f(xroot)>0, set xlow=xroot

5. Repeat Steps 3-4 until desired tolerance is reached

2hilow

root

xxx

Example ProblemFind all the roots for the following

equation: Bisection

42 2 xy

Bisection Routinex y-10 -196-9 -158-8 -124-7 -94-6 -68-5 -46-4 -28-3 -14-2 -4-1 2

Xlow f(Xlow) Xhigh f(Xhigh) Xroot f(Xroot) f(Xlow)*f(Xroot)

-2 -4 -1 2 -1.5 -0.5 2

-1.5 -0.5 -1 2 -1.25 0.875 -0.4375

-1.5 -0.5 -1.25 0.875 -1.375 0.21875 -0.109375

-1.5 -0.5 -1.375 0.21875 -1.4375 -0.13281 0.06640625

-1.4375 -0.13281 -1.375 0.21875 -1.40625 0.044922 -0.005966187

-1.4375 -0.13281 -1.40625 0.044922 -1.421875 -0.04346 0.005771637

2hilow

root

xxx

Determine subinterval of rootIf f(xlow)*f(xroot)<0 , set xhi=xroot

If f(xlow)*f(xroot)>0, set xlow=xroot

42 2 xy

Goal Seek Function

What is Goal Seek?

Goal Seek Function

Begin with initial guess “x” value

Define function, f(x), related to initial guess Use Goal Seek function to find root

Example ProblemFind all the roots for the following

equation: Goal Seek

42 2 xy

Goal Seek Function

Goal Seek Function

Accuracy of Goal Seek function can be controlled in Excel Options

You may need to set the following: Maximum Iterations Maximum Change

Review Questions

Review QuestionFinding Roots by Plotting

A third order polynomial has how many real roots?

A. 0

B. 1

C. 2

D. 3

E. Cannot tell from info given

Review QuestionBisection Routine

Which of the following are false statements concerning the bisection method?

A. The true root must be between the initial high/low guesses

B. The estimated xroot is calculated by averaging the xhigh and xlow values

C. The subinterval of the true route is determined by a sign comparison of f(x) values

D. All of the above are true

Review QuestionUsing Goal Seek

Goal Seek is the only Excel function available for solving problems that are iterative in nature.

A. True

B. False

Homework Help ‘n Hints