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

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

Bild der Seite - 172 -

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

Text der Seite - 172 -

172 6 ComputingIntegralsandTestingCode exercise). Therefore, we are forced to compute the integral by numerical methods. Computea result that is right to fourdigits. Hint Use ideas fromExercise6.9. Filename:integrate_x2x.py. Exercise6.11:IntegrateProductsofSine Functions In this exercisewe shall integrate Ij,k = ∫ π −π sin(jx)sin(kx)dx, wherej andk are integers. a) Plotsin(x)sin(2x)andsin(2x)sin(3x)forx∈[−π,π] inseparateplots.Explain whyyouexpect ∫π −π sinxsin2xdx=0and ∫π −π sin2xsin3xdx=0. b) Use the trapezoidal rule tocomputeIj,k forj =1,.. .,10andk=1,.. .,10. Filename:products_sines.py. Exercise6.12:RevisitFitofSines toa Function This is a continuationof Exercise4.13.The task is to approximatea given function f(t)on [−π,π]byasum ofsines, SN(t)= N∑ n=1 bnsin(nt). (6.31) We are nowinterested incomputing theunknowncoefficientsbn such thatSN(t) is in somesense the best approximation tof(t). One commonway of doing this is to firstsetupageneralexpressionfortheapproximationerror,measuredby“summing up” thesquareddeviationofSN fromf : E= ∫ π −π (SN(t)−f(t))2dt . We may view E as a function of b1,.. .,bN. Minimizing E with respect to b1,.. .,bN willgiveusabestapproximation, in thesense thatweadjustb1,.. .,bN such thatSN deviatesas little aspossible fromf .
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