lecture_25_s2005

# lecture_25_s2005 - 1.00 Lecture 25 Numerical Methods Root...

This preview shows pages 1–6. Sign up to view the full content.

1.00 Lecture 25 Numerical Methods: Root Finding Reading for next time: Big Java: section 19.4 Root Finding Two cases: One dimensional function: f(x)= 0 Systems of equations (F(X)= 0), where X and 0 are vectors and F is an n-dimensional vector-valued function We address only the 1-D function In 1-D, it’s possible to bracket the root between bounding values In multidimensional case, it’s impossible to bound (Almost) all root finding methods are iterative Start from an initial guess Improve solution until convergence limit satisfied For smooth 1-D functions, convergence assured, but not otherwise

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Root Finding Methods Elementary (pedagogical use only): Bisection Secant, false position (regula falsi) “Practical” (using the term advisedly): Brent’s algorithm (if derivative unknown) Newton-Raphson (if derivative known) Laguerre’s method (polynomials) Newton-Raphson (for n-dimensional problems) Only if a very good first guess can be supplied See “Numerical Recipes in C” for methods Library available on Athena . Can translate or link to Java The C code in the book is quite (needlessly) obscure Why is this so hard? The computer can’t “see” the functions. It only has function values at a few points. You’d find it hard to solve equations with this little information also! Root Finding Preparation Before using root finding methods: Graph the equation(s): Matlab, etc. Are they continuous, smooth; how differentiable? Use Matlab, etc. to explore solutions Linearize the equations and use matrix methods to get approximate solutions Approximate the equations in other ways and solve analytically Bracket the ranges where roots are expected For fun, look at Plot it at 3.13, 3.14, 3.15, 3.16; f(x) is around 30 Well behaved except at x= π Dips below 0 in interval x= π +/- 10 -667 This interval is less than precision of doubles! You’ll never find these two roots numerically This is in Pathological.java: experiment with it later 1 ] ) ( ln[ ) / 1 ( 3 ) ( 2 4 2 + = x x x f π
Bracketing f(x)= x 2 -2 -8 -6 -4 -2 0 2 4 6 8 No zero in bracket (though we can’t be sure) Move in direction of smaller f(x) value. Empirical multiplier of 1.6 to expand bracket size U L Bracketing f(x)= x 2 -2 -8 -6 -4 -2 0 2 4 6 8 U L Still no zero in bracket (though we can’t be sure) Move again in direction of smaller f(x) value.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Bracketing f(x)= x 2 -2 -8 -6 -4 -2 0 2 4 6 8 U L Done; found an interval containing a zero “Function Passing” Again // MathFunction is interface with one method public interface MathFunction { public double f(double x); } // FuncA implements the interface public class FuncA implements MathFunction { public double f(double x) { return x*x - 4; } }
Bracketing Program public class Bracket { public static boolean zbrac(MathFunction func, double[] x){ // Java version of zbrac, p.352, Numerical Recipes

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 16

lecture_25_s2005 - 1.00 Lecture 25 Numerical Methods Root...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online