570 likes | 746 Views
Tuesday 2:30 – 4:00 Colin Chris M Johnathan P Craig Jonathan E Alex. Tuesday 4:00 – 5:30 Curtis Matt Chris L Janet Cory Kristen. Chem 302 Lab Assignment. Chem 302 - Math 252. Chapter 1 Solutions of nonlinear equations. Roots of Nonlinear Equations.
E N D
Tuesday 2:30 – 4:00ColinChris MJohnathan PCraigJonathan EAlex Tuesday 4:00 – 5:30CurtisMattChris LJanetCoryKristen Chem 302 Lab Assignment
Chem 302 - Math 252 Chapter 1Solutions of nonlinear equations
Roots of Nonlinear Equations • Many problems in chemistry involve nonlinear equations • Linear and quadratic equations are trivial, can be solved analytically • Cubic and higher order solve numerically • Present a overview of basic methods • Not a complete discussion
Successive Approximations • Simplest method • Want to solvef(x)=0rearrange into the formx=g(x) • Use as iteration formulaxi+1=g(xi) • Use initial guess and iterate until self consistent
Successive Approximations Second root
Successive Approximations Second root
Successive Approximations Different formula Will find x=2, will not find x=1 Different formula – different results No one formula is best Slow to converge
Successive Approximations How to find initial guesses? Grid search Course to start Get finer
Analysis of Convergence • Each stage of iterationxi+1=g(xi) • For convergence • True root • Intersection of two functions: x & g(x)
Analysis of Convergence • Four possibilities • Monotonic convergence • Oscillating convergence • Monotonic divergence • Oscillating divergence
Analysis of Convergence • Key is g(x) • Mean Value Theorem • If g(x) and g(x) are continuous on the interval [a,b] then there exists an e (a<e<b) such that
Analysis of Convergence If M < 1 guaranteed to converge Sufficient but not necessary To converge LHS → 0
Speed of Convergence Taylor expansion about root For xi When close to convergence • Dominant term will be 1st nonzero derivative • Order of Convergence
Newton-Raphson Method • One of most common methods • Usually 2nd order convergence • Generally superior to simple iteration • Uses function and 1st derivative to predict root (assume f is linear)
Newton-Raphson Method • Fairly robust • Need analytic expressions for f(x) and f'(x) • May be complicated or not available • Need to evaluate f(x) and f'(x) many times • Maximum efficiency • f'(x) close to zero will cause problems • Especially important for multiple roots • Need to checks in program • Value of f'(x) • Max iterations
Newton-Raphson Method • Test conditions Convergence
Secant Method • NR but use numeric derivative • Need two points to start
False-Position Method • Similar to Secant Method • Uses two points (one on each side of root) (need search) • Find where function would be zero if linear between two points • During each iteration one point is held fixed (pivot), other is moved • More stable but slower than NR • If pivot far from root then slow • If pivot close to root then denominator can be small
False-Position Method • Algorithm • Pick xL & xR (xL < < xR) • Evaluate • Calculate • Calculate • If then xM is the root • Replace xL or xR with xM (depends on sign of ) xM xL xR Repeat
Bisection Method • Same as FP Method but xM is average of xL & xR • Drawbacks of both FP & Bisection • Two initial guesses on opposite sides of root • Multiple or close roots a problem • f always same sign a problem • Round-off error as xM gets close to root • Secant, FP & Bisection methods do not require analtyic expression of f'(x)
Roots of Polynomials • Want as efficient an algorithm as possible • Efficiency of operations • + • * • / • Power • Naive method (10 ×, 4 +) • Most efficient method for polynomial of order m requires m additionsand m multiplications • Nesting (Horner’s Method)
Horner’s Method • For polynomial of degree m • Divide by (x-r) • b0 is f(r)
Horner’s Method m×, m +
Horner’s Method 1 is a root
Horner’s Method 2 is a root
Horner’s Method • If b0 = 0 (i.e. r is a root) • Have factored (x-r) from equation (i.e. reduced order, called deflating) • Continue to find roots of reduced equation
Horner’s Method 2 is a root (i.e. a double root of original equation)
Birge-Vieta Method • NR method with f(x) and f'(x) evaluated using Horner’s method • Once a root is found, reduce order of polynomial
Example • NR • x0 4.33 3 • x0> 4.33 5 • Third root? Try it!!!
Roots of Polynomials • What about complex roots? • Occur in pairs • Have form a+ ib & a – ib • Roots of quadratic equationf(x) = x2 – 2ax + a2 + b2 • BV method – we removed factors of x – r. • Quadratic can be solved analytically – therefore best to remove quadratic factors
Lin-Bairstow Method • Iteration Scheme
Lin-Bairstow Method • Algorithm • m > 3: determine quadratic roots, reduce order of problem by 2 • m = 3: determine linear root then quadratic roots • m = 2: determine quadratic roots • m = 1: determine linear root