Web-Books
im Austria-Forum
Austria-Forum
Web-Books
Informatik
Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Seite - 292 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

Seite - 292 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Bild der Seite - 292 -

Bild der Seite - 292 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition

Text der Seite - 292 -

292 9 SolvingPartialDifferentialEquations ThisapproximationinvolvesafictitiouspointxN+1 outside thedomain.Acommon trick is to use (9.7) for i =N and eliminateuN+1 by use of the discrete boundary condition(uN+1 =uN−1): duN(t) dt =β2uN−1(t)−2uN(t) Δx2 +gN(t). (9.8) That is, we haveaspecialversionof (9.7)at theboundary i=N. Whataboutsimpler finitedifferencesat theboundary? Some reader may think that a smarter trick is to approximate the boundary condition∂u/∂x atx=Lbya one-sideddifference: ∂u ∂x ∣ ∣ ∣ ∣ i=N ≈ uN −uN−1 Δx =0 . This gives a simple equation uN = uN−1 for the boundary value, and a corresponding ODEu′N = u′N−1. However, this approximation has an error oforderΔx,while thecenteredapproximationwe usedabovehasan errorof orderΔx2. The finite differenceapproximationwe used for the second-order derivative in the diffusion equation also has an error of orderΔx2. Thus, if weuse thesimplerone-sideddifferenceabove, it turnsout thatwe reduce the overallaccuracyof themethod. We are now in a position to summarize how we can approximate the PDE problem(9.1)–(9.4)bya systemofordinarydifferentialequations: du0 dt = s′(t), (9.9) dui dt = β Δx2 (ui+1(t)−2ui(t)+ui−1(t))+gi(t), i=1,.. .,N−1, (9.10) duN dt = 2β Δx2 (uN−1(t)−uN(t))+gN(t). (9.11) The initial conditionsare u0(0)= s(0), (9.12) ui(0)= I(xi), i=1,.. .,N . (9.13) We canapplyanymethodfor systemsofODEs tosolve (9.9)–(9.11).
zurück zum  Buch Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Titel
Programming for Computations – Python
Untertitel
A Gentle Introduction to Numerical Simulations with Python 3.6
Band
Second Edition
Autoren
Svein Linge
Hans Petter Langtangen
Verlag
Springer Open
Datum
2020
Sprache
englisch
Lizenz
CC BY 4.0
ISBN
978-3-319-32428-9
Abmessungen
17.8 x 25.4 cm
Seiten
356
Schlagwörter
Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
Kategorie
Informatik
Web-Books
Bibliothek
Datenschutz
Impressum
Austria-Forum
Austria-Forum
Web-Books
Programming for Computations – Python