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

Seite - 85 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Bild der Seite - 85 -

Bild der Seite - 85 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python

Text der Seite - 85 -

3.7 DoubleandTriple Integrals 85 boundaryg D 0 as the zero-level contourof the level-set function. For simple ge- ometries onecan easily constructg byhand,while inmorecomplicated industrial applicationsonemust resort tomathematicalmodels forconstructingg. LetA.˝/be theareaofadomain˝.Wecanestimate the integralbythisMonte Carlo integrationmethod: 1. embed thegeometry˝ in a rectangularareaR 2. drawa largenumberof randompoints .x;y/ inR 3. count the fractionqofpoints that are inside˝ 4. approximateA.˝/=A.R/byq, i.e., setA.˝/DqA.R/ 5. evaluate themeanoff , Nf , at thepoints inside˝ 6. estimate the integral asA.˝/ Nf NotethatA.R/ is trivial tocomputesinceR isarectangle,whileA.˝/ isunknown. However, ifweassume that the fractionofA.R/occupiedbyA.˝/ is the sameas the fractionof randompoints inside˝,wegeta simpleestimate forA.˝/. Toget an ideaof themethod,consider acirculardomain˝ embedded ina rect- angleas shownbelow.Acollectionof randompoints is illustratedbyblackdots. Implementation APythonfunctionimplementing R ˝ f.x;y/dxdy canbewritten like this: import numpy as np def MonteCarlo_double(f, g, x0, x1, y0, y1, n): """ Monte Carlo integration of f over a domain g>=0, embedded in a rectangle [x0,x1]x[y0,y1]. n^2 is the number of random points. """
zurück zum  Buch Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python"
Programming for Computations – Python A Gentle Introduction to Numerical Simulations with Python
Titel
Programming for Computations – Python
Untertitel
A Gentle Introduction to Numerical Simulations with Python
Autoren
Svein Linge
Hans Petter Langtangen
Verlag
Springer Open
Datum
2016
Sprache
englisch
Lizenz
CC BY-NC 4.0
ISBN
978-3-319-32428-9
Abmessungen
17.8 x 25.4 cm
Seiten
248
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