Page - 186 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Image of the Page - 186 -
Text of the Page - 186 -
186 6 SolvingNonlinearAlgebraicEquations
has
f.x/D e x sinx cosx:
Just move all terms to the left-hand side and then the formula to the left of the
equality sign isf.x/.
So, when dowe really need to solve algebraic equations beyond the simplest
typeswecan treatwithpenandpaper?Thereare twomajorapplicationareas.One
iswhenusing implicitnumericalmethodsforordinarydifferentialequations. These
giverise tooneorasystemofalgebraicequations. Theothermajorapplicationtype
isoptimization, i.e.,findingthemaximaorminimaofafunction.Thesemaximaand
minimaarenormally foundbysolving thealgebraicequationF 0.x/D0 ifF.x/ is
the function tobeoptimized.Differential equationsareverymuchused throughout
science and engineering, and actuallymost engineeringproblemsareoptimization
problems in the end, becauseonewants a design thatmaximizes performanceand
minimizescost.
Wefirstconsideronealgebraicequationinonevariable,withourusualemphasis
on how to program the algorithms. Systems of nonlinear algebraic equationswith
many variables arise from implicit methods for ordinary and partial differential
equationsaswell as inmultivariateoptimization.Ourattentionwill be restricted to
Newton’smethodfor suchsystemsofnonlinearalgebraicequations.
Terminology
When solving algebraic equationsf.x/ D 0, we often say that the solution x
is a root of the equation. The solution process itself is thus often called root
finding.
6.1 BruteForceMethods
Therepresentationofamathematicalfunctionf.x/onacomputertakes twoforms.
OneisaPythonfunctionreturningthefunctionvaluegiventheargument,while the
other is a collection of points .x;f.x// along the functioncurve. The latter is the
representationweuse for plotting, togetherwith an assumption of linear variation
between the points. This representation is also very suited for equation solving
and optimization: we simply go through all points and see if the function crosses
thex axis, or for optimization, test for a localmaximumorminimumpoint. Be-
cause there is a lot ofwork to examine a hugenumber of points, and also because
the idea is extremely simple, such approaches are often referred to as brute force
methods.However,wearenotembarrassedofexplaining themethods indetail and
implementing them.
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