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

Page - 196 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Image of the Page - 196 -

Image of the Page - 196 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition

Text of the Page - 196 -

196 7 SolvingNonlinearAlgebraicEquations by the twofirst termina Taylor series expansionaroundxi: F(xi+1)≈F(xi)+∇F(xi)(xi+1−xi). Thenext terms in theexpansionsareomittedhereandof size ||xi+1−xi||2,which areassumedto besmall comparedwith the two termsabove. The expression∇F is the matrix of all the partial derivativesofF. Component (i,j) in∇F is ∂Fi ∂xj . For example, in our 2×2 system (7.10)and (7.11) we can use SymPy to compute theJacobian: In [1]: from sympy import * In [2]: x0, x1 = symbols(’x0 x1’) In [3]: F0 = x0**2 - x1 + x0*cos(pi*x0) In [4]: F1 = x0*x1 + exp(-x1) - x0**(-1) In [5]: diff(F0, x0) Out[5]: -pi*x0*sin(pi*x0) + 2*x0 + cos(pi*x0) In [6]: diff(F0, x1) Out[6]: -1 In [7]: diff(F1, x0) Out[7]: x1 + x0**(-2) In [8]: diff(F1, x1) Out[8]: x0 - exp(-x1) We can thenwrite ∇F = ( ∂F0 ∂x0 ∂F0 ∂x1 ∂F1 ∂x0 ∂F1 ∂x1 ) = ( 2x0+cos(πx0)−πx0 sin(πx0) −1 x1+x−20 x0−e−x1 ) Thematrix∇F is called the JacobianofF andoftendenotedbyJ. 7.6.3 Newton’sMethod TheideaofNewton’smethodis thatwehavesomeapproximationxi to therootand seekanew(andhopefullybetter)approximationxi+1 byapproximatingF(xi+1)by a linear function and solve the corresponding linear system of algebraic equations. We approximate thenonlinearproblemF(xi+1)=0by the linearproblem F(xi)+J(xi)(xi+1−xi)=0, (7.12)
back to the  book Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Title
Programming for Computations – Python
Subtitle
A Gentle Introduction to Numerical Simulations with Python 3.6
Volume
Second Edition
Authors
Svein Linge
Hans Petter Langtangen
Publisher
Springer Open
Date
2020
Language
English
License
CC BY 4.0
ISBN
978-3-319-32428-9
Size
17.8 x 25.4 cm
Pages
356
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