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 - 271 -
  • Benutzer
  • Version
    • Vollversion
    • Textversion
  • Sprache
    • Deutsch
    • English - Englisch

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

Bild der Seite - 271 -

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

Text der Seite - 271 -

8.5 RateofConvergence 271 midpoint methods), the error was a single number for each choice of n, i.e., the number of sub-intervals. With eachΔti now, however, there is basically one error for each point in the mesh (remember:we computean approximation to a function now, not a single number, as we did with integrals)! What we would like to have, is a single number Ei that we could refer to as “the error” of the corresponding experiment. TherearedifferentwaystoarriveatEi,andwemightreasonasfollows.Foreach of our experiments, at each point in the mesh, there will be a difference (generally notzero)betweenthetruesolutionandourcomputedapproximation.Thecollection ofall these differencesmakesupan errormesh function,havingvaluesat the mesh points only. Also, with a total of Nt time steps, there will be Nt + 1 points in the time mesh (Nt increases when Δt decreases, for a fixed time interval [0,T]). Thus, for each Δti, the error mesh function comprises Nt + 1 function values en, n = 0,1,.. .,Nt. Now, one simple way to get to Ei, is to use the maximum of all en values,9 comparing absolute values. In fact, we did that previously in test_ode_FE_exact_linear.py(Sect. 8.2.7). Other alternatives utilize a constructed error function e(t), being a continuous functionof time. The functione(t)may be generated from the error mesh function by simply connecting successive en values with straight lines. With e(t) in place, onemaychoose to use theL2 norm (read“L-twonorm”)ofe(t), ‖e‖L2 = √∫ T 0 e(t)2dt , (8.85) for Ei. The L2 norm has nice mathematical properties and is much used. When computing the integralof theL2 norm,we may use the trapezoidalmethod,and let the integration points coincide with the mesh points. Because of the straight lines composing e(t), the integral computation will then become exact (within machine precision).Thus, assuminga uniformmesh,wecanproceed towrite (8.85)as ‖e‖L2 ≈ √√ √ √Δt ( 1 2 (e0)+ 1 2 ( eNt )+ Nt−1∑ n=1 (en) 2 ) , (8.86) Finally, we make yet another approximation, by simply disregarding the contribu- tions from e0 and eNt . This is acceptable, since these contributions go to zero as Δt→0.The resultingexpression is called thediscreteL2 norm,and isdenotedby l2. In thisway,we get thefinal andsimplerexpression10 as ‖en‖l2 = √√ √ √Δt Nt−1∑ n=1 (en) 2 . (8.87) 9 This is referred to as the discrete (L∞) norm (read “L-infinity norm”, but often called the “max norm”) for the error mesh functionen. 10 We should add that, in this expression,Δt may be switched with T Nt , followed by droppingT , since thiscommonscalingfactor is independentof thevectorvalues.Finally, it isusuallypreferred touse the length of the vector, i.e.Nt +1 instead ofNt.
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