Seite - 190 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Bild der Seite - 190 -
Text der Seite - 190 -
190 6 SolvingNonlinearAlgebraicEquations
Anapplication tof.x/D e x2cos.4x/ looks like
def demo():
from numpy import exp, cos
minima, maxima = brute_force_optimizer(
lambda x: exp(-x**2)*cos(4*x), 0, 4, 1001)
print ’Minima:’, minima
print ’Maxima:’, maxima
6.1.3 ModelProblemforAlgebraicEquations
Weshall consider the very simple problemof finding the square root of 9, which
is the positive solution ofx2 D 9. The nice feature of solving an equationwhose
solution is known beforehand is thatwe can easily investigate how the numerical
method and the implementation perform in the search for the solution. Thef.x/
functioncorresponding to theequationx2 D9 is
f.x/Dx2 9:
Ourintervalof interest forsolutionswillbe Œ0;1000 (theupper limithere ischosen
somewhatarbitrarily).
In the following,wewillpresentseveral efficientandaccuratemethodsforsolv-
ing nonlinear algebraic equations, both single equation and systems of equations.
Themethods all have in common that they search forapproximate solutions. The
methodsdiffer,however, in theway theyperformthesearch forsolutions. The idea
for the search influences the efficiencyof the search and the reliability of actually
finding a solution. For example, Newton’s method is very fast, but not reliable,
while the bisectionmethod is the slowest, but absolutely reliable. Nomethod is
best at all problems, soweneeddifferentmethods fordifferentproblems.
Whatisthedifferencebetweenlinearandnonlinearequations?
You knowhow to solve linear equations axCb D 0: x D b=a. All other
types of equationsf.x/ D 0, i.e., whenf.x/ is not a linear function ofx, are
callednonlinear.Atypicalwayofrecognizinganonlinearequationis toobserve
thatx is “not alone” as inax, but involved in a productwith itself, such as in
x3C2x2 9D0.Wesay thatx3 and2x2 arenonlinear terms.Anequationlike
sinxCexcosx D0 is alsononlinear althoughx is not explicitlymultipliedby
itself, but theTaylor series of sinx, ex, and cosx all involve polynomials ofx
wherex ismultipliedby itself.
6.2 Newton’sMethod
Newton’smethod, also knownasNewton-Raphson’smethod, is a very famous and
widely usedmethod for solving nonlinear algebraic equations. Compared to the
othermethodswewill consider, it is generally the fastest one (usually by far). It
doesnotguarantee thatanexisting solutionwill be found,however.
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python
- Titel
- Programming for Computations – Python
- Untertitel
- A Gentle Introduction to Numerical Simulations with Python
- Autoren
- Svein Linge
- Hans Petter Langtangen
- Verlag
- Springer Open
- Datum
- 2016
- Sprache
- englisch
- Lizenz
- CC BY-NC 4.0
- ISBN
- 978-3-319-32428-9
- Abmessungen
- 17.8 x 25.4 cm
- Seiten
- 248
- Schlagwörter
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Kategorie
- Informatik