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

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

Image of the Page - 204 -

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

Text of the Page - 204 -

204 6 SolvingNonlinearAlgebraicEquations canbewritten inourabstract formby introducingx0 Dx andx1 Dy. Then F0.x0;x1/Dx2 yCxcos. x/D0; F1.x0;x1/DyxCe y x 1 D0: 6.6.2 TaylorExpansionsforMulti-VariableFunctions Wefollowthe ideasofNewton’smethodforoneequation inonevariable: approxi- mate thenonlinearf bya linear functionandfind the root of that function.When nvariables are involved,weneed to approximate a vector function F.x/by some linear function QF D JxCc,whereJ is ann nmatrix andc is somevector of lengthn. The technique for approximatingF by a linear function is to use the first two terms in aTaylor series expansion. Given thevalueofF and its partial derivatives with respect tox at some pointxi, we can approximate the value at some point xiC1by the twofirst term inaTaylor seriesexpansionaroundxi: F.xiC1/ F.xi/CrF.xi/.xiC1 xi/: Thenext terms in theexpansionsareomittedhereandof size jjxiC1 xijj2,which areassumed tobesmall comparedwith the two termsabove. TheexpressionrF is thematrixof all thepartial derivativesofF . Component .i;j/ inrF is @Fi @xj : For example, in our2 2 system (6.11)-(6.12)we canuseSymPy to compute the Jacobian: >>> from sympy import * >>> x0, x1 = symbols(’x0 x1’) >>> F0 = x0**2 - x1 + x0*cos(pi*x0) >>> F1 = x0*x1 + exp(-x1) - x0**(-1) >>> diff(F0, x0) -pi*x0*sin(pi*x0) + 2*x0 + cos(pi*x0) >>> diff(F0, x1) -1 >>> diff(F1, x0) x1 + x0**(-2) >>> diff(F1, x1) x0 - exp(-x1) Wecan thenwrite rF D @F0 @x0 @F0 @x1 @F1 @x0 @F1 @x1 ! D 2x0Ccos. x0/ x0sin. x0/ 1 x1Cx 20 x0 e x1 ! ThematrixrF is called theJacobianofF andoftendenotedbyJ.
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