CPN5-IterativeSoln - Brigham Young University

advertisement
Brigham Young University - Idaho
College of Physical Sciences and Engineering
Department of Mechanical Engineering
Class Prep Notes #5
Root Finding and Iterative Solutions
Finding the roots of an equation is a common engineering application. Many strategies
exist for doing this. We will focus on three techniques in this class. The three techniques
are:
Plotting
Bisection Method
Excel’s Goal Seek
Plotting
Creating a graph is a relatively quick and easy process to approximate the roots of an
equation. It is also commonly used as a starting process to an iterative method. Once the
graph is created, the scale may easily be refined to zoom the plot in on the area of
interest.
Bisection Method
You may note when using a graph to locate roots that f(x) changed signs on opposite
sides of the root. In general, if f(x) is real and continuous in the interval from f(xlow) to
f(xhi) and
f(xlow)*f(xhi) < 0
then there is at least one real root between xlow and xhi.
The bisection method is one type of incremental search method in which the interval is
always divided in half. If a function changes sign over an interval, the function value at
the midpoint of the interval is evaluated. The location of the root is then determined to
lie within the subinterval in which the sin change occurs. The process is repeated by
refining or halving the estimates.
A simple algorithm for the bisection calculation follows:
1. Choose initial guesses, xlow and xhi, such that the function changes sign over the
interval. This can be checked by ensuring that f(xlow)*f(xhi)<0.
2. Estimate the root xroot by finding the midpoint of the interval:
xroot 
xlow  xhi
2
3. Determine which subinterval the root lies in and adjust the limits to create a new
interval
If f(xlow)*f(xroot)<0 the root lies in the lower subinterval
Set xhi=xroot
If f(xlow)*f(xroot)>0, the root lies in the upper subinterval
Set xlow=xroot
4. Repeat steps 2 through 4 until desired termination criteria is reached.
Termination Criteria
A couple of methods are commonly used for deciding when to end the iterations and
accept the estimate of the root. The simplest method involves comparing computing the
absolute value of the last two root estimates. The iterations stop when the desired
threshold is reached. A tolerance threshold of 0.001 is reasonable for many applications.
The second method involves calculating an error estimate as percentage and stopping
when the desired error threshold is reached. The error estimate can be calculated from
the following formula:
x new  x old
  root new root 100%
xroot
A reasonable error estimate for many applications is 0.1%.
Limitations of Bisection Method
The Bisection method will not solve double root problems where the curve touches rather
than crosses the axis. This is due to the fact that the bisection method relies on the sign
change that occurs when the axis is crossed. See the double root plot example shown
below.
Using Goal Seek
The third method involves a what-if analysis tool called Goal Seek. Goal Seek takes a
result and determines possible input values that produce that result. Excel help on Goal
Seek is included below for your convenience.
Use Goal Seek to find out how to get a desired result
If you know the result that you want from a formula, but you are not sure what input value the
formula requires to get that result, you can use the Goal Seek feature. For example, suppose that
you need to borrow some money. You know how much money you want, how long a period you
want in which to pay off the loan, and how much you can afford to pay each month. You can use
Goal Seek to determine what interest rate you must secure in order to meet your loan goal.
NOTE Goal Seek works with only one variable input value. If you want to determine more than
one input value, for example, the loan amount and the monthly payment amount for a loan, you
should instead use the Solver add-in. For more information about the Solver add-in, see the
section Prepare forecasts and advanced business models, and follow the links in the See Also
section.
Download