Web-Books
in the Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Page - 190 -
  • User
  • Version
    • full version
    • text only version
  • Language
    • Deutsch - German
    • English

Page - 190 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Image of the Page - 190 -

Image of the Page - 190 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Text of the Page - 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.
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python
Title
Programming for Computations – Python
Subtitle
A Gentle Introduction to Numerical Simulations with Python
Authors
Svein Linge
Hans Petter Langtangen
Publisher
Springer Open
Date
2016
Language
English
License
CC BY-NC 4.0
ISBN
978-3-319-32428-9
Size
17.8 x 25.4 cm
Pages
248
Keywords
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Category
Informatik
Web-Books
Library
Privacy
Imprint
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python