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

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

Image of the Page - 91 -

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

Text of the Page - 91 -

3.8 Exercises 91 The integrandxx doesnothaveananti-derivative that canbeexpressed in termsof standard functions (visit http://wolframalpha.comand typeintegral(x**x,x) to convince yourself that our claim is right. Note thatWolframalpha does give you an answer, but that answer is an approximation, it is not exact. This is because Wolframalpha toousesnumericalmethods to arriveat the answer, just asyouwill in this exercise). Therefore, we are forced to compute the integral by numerical methods.Computea result that is right to fourdigits. Hint Use ideas fromExercise3.9. Filename:integrate_x2x.py. Exercise3.11: Integrateproductsof sine functions In this exerciseweshall integrate Ij;k D Z sin.jx/sin.kx/dx; wherej andk are integers. a) Plot sin.x/sin.2x/ and sin.2x/sin.3x/ forx 2 ; in separate plots. Ex- plainwhyyouexpect R sinxsin2xdxD0and R sin2xsin3xdxD0. b) Use the trapezoidal rule tocomputeIj;k forj D1;:: :;10andkD1;:: :;10. Filename:products_sines.py. Exercise3.12:Revisitfitof sines toa function This is acontinuationofExercise2.18. The task is toapproximateagivenfunction f.t/on Ε’ ; byasumofsines, SN.t/D NX nD1 bnsin.nt/: (3.27) We are now interested in computing the unknowncoefficients bn such thatSN.t/ is in some sense the best approximation tof.t/. One commonway of doing this is to first set up a general expression for the approximation error, measured by β€œsummingup” thesquareddeviationofSN fromf : E D Z .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 .
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