Docsity

Root Finding and Basic Function Minimization - Computational Physics | PHYS 5322, Study notes of Physics

Partial preview of the text

Download Root Finding and Basic Function Minimization - Computational Physics | PHYS 5322 and more Study notes Physics in PDF only on Docsity!

Root Finding and BasicFunction Minimization

Igor Volobouev

Computational Physics (PHYS 5322)

Texas Tech University

Root Finding Problem

1-d:

Usually easy, unless you

need to solve gazillion equations in alimited amount of time, and

f(x)

is not

cheap to evaluate

Special case: polynomials N-d:

Usually hard, except for the

important special case of linear systems.Success in the nonlinear case dependscrucially on having a good first guess forthe solution.

(^

x

f

(^

r

r

r^

x

f

Bisection

First, bracket the root! Then divide the interval in two and keepthe root bracketed. Repeat until thedesired tolerance is reached. You mustthink carefully what tolerance isappropriate for your problem. Converges to a root, a discontinuity point,or a singularity. The rate of convergence isusually expressed as

m n

n^

constant

1

ε

ε^

×

Other Methods Without Derivatives^ A variety of methods speed up theconvergence by making assumptionsabout the function behavior. Superlinearconvergence (

m^

  1. is achieved when the

assumptions turn out to be correct.

Secant Ridder’s Brent’s See

Numerical Recipes

for details

Roots of Polynomials

The number of roots is known in advance Direct formula-based methods are appropriatefor polynomial up to 3

rd^ degree.

Assume simpler form near the root and iterate(Muller’s, Laguerre’s methods). Then deflate thepolynomial and repeat for another root. Jenkins-Traub and eigenvalue methods areknown to be very robust (but usually somewhatslower)

Linear Systems

Equations of the type

A^ x

=^ b

Common way to solve:

LU

decomposition^ A = L U

Thus

A^ x

= (L U)

x^ = L (U

x ) =

b

Let^

y^ = U

x. Solve for

y^ in

L^ y

=^ b

by forward substitution.

Solve for

x^ in

U^ x

=^ y

by backward substitution.

This is the technology, for example, behind the “linsolve” module inSciPy. LAPACK is often used for C/Fortan calculations.

Function Minimization

A particular optimization problem whichhappens very often in physics Dichotomies: local / global, 1d / multivariate,using / not using derivatives

Bracketing the Minimum

Three points are needed to bracket theminimum:

a < b < c

so that

f(b) < f(a)

and

f(b) < f(c)

Brent’s Method

Assume the function is parabolic near theminimum. Pick the next point at theminimum of the parabola.

Converges quickly if the starting bracket is nottoo far away Derivative information can be easily included

Simplex Method (Multivariate) Also called Nelder-Mead method. Simplexoperations are illustrated below for a tetrahedron.

Finding the Global Minimum Very difficult Thing to try first: just apply local minimumcodes with many starting points. Use quasi-MC

to choose initial points.

Simulated annealing might or might nothelp – analogs of phase space and energyrequired, and they are not always easy toconstruct.