ME 142 Engineering Computation I Root Finding & Iterative Solutions.

23
ME 142 Engineering Computation I Root Finding & Iterative Solutions

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

Page 1: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

ME 142Engineering Computation I

Root Finding

&

Iterative Solutions

Page 2: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Key Concepts

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

Page 3: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Using a Graph to Find Roots

Page 4: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

How do you plot a function in Excel?

Page 5: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

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

Page 6: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Example ProblemFind all the roots for the following

equation: Plot (approximate)

42 2 xy

Page 7: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

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

Page 8: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Bisection Routine

Page 9: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

What do we mean by iterative solutions?

Page 10: ME 142 Engineering Computation I Root Finding & 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

Page 11: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Example ProblemFind all the roots for the following

equation: Bisection

42 2 xy

Page 12: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

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

Page 13: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Goal Seek Function

Page 14: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

What is Goal Seek?

Page 15: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Goal Seek Function

Begin with initial guess “x” value

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

Page 16: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Example ProblemFind all the roots for the following

equation: Goal Seek

42 2 xy

Page 17: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Goal Seek Function

Page 18: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

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

Page 19: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Review Questions

Page 20: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

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

Page 21: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

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

Page 22: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Review QuestionUsing Goal Seek

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

A. True

B. False

Page 23: ME 142 Engineering Computation I Root Finding & Iterative Solutions.

Homework Help ‘n Hints