Seite - 82 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python
Bild der Seite - 82 -
Text der Seite - 82 -
82 3 Computing Integrals
andwant to approximate the integral by amidpoint rule. Following the ideas for
thedouble integral,wesplit this integral intoone-dimensional integrals:
p.x;y/D fZ
e g.x;y;z/dz
q.x/D dZ
c p.x;y/dy
bZ
a dZ
c fZ
e g.x;y;z/dzdydxD bZ
a q.x/dx
Foreachof theseone-dimensional integralsweapply themidpoint rule:
p.x;y/D fZ
e g.x;y;z/dz nz
1X
kD0 g.x;y;zk/;
q.x/D dZ
c p.x;y/dy ny
1X
jD0 p.x;yj/;
bZ
a dZ
c fZ
e g.x;y;z/dzdydxD bZ
a q.x/dx nx
1X
iD0 q.xi/;
where
zk D eC 1
2 hz Ckhz; yj DcC 1
2 hy Cjhy xi DaC 1
2 hx C ihx :
Starting with the formula for Rb
a Rd
c Rf
e g.x;y;z/dzdydx and inserting the two
previous formulasgives
bZ
a dZ
c fZ
e g.x;y;z/dzdydx
hxhyhz nx
1X
iD0 ny
1X
jD0 nz
1X
kD0 g aC 1
2 hx C ihx;cC 1
2 hy Cjhy;eC 1
2 hz Ckhz :
(3.26)
Note thatwemay apply the ideasunderDirect derivation at the endofSect. 3.7.1
to arrive at (3.26) directly: divide the domain intonx ny nz cells of volumes
hxhyhz; approximategbyaconstant, evaluatedat themidpoint.xi;yj;zk/, ineach
cell; andsumthecell integralshxhyhzg.xi;yj;zk/.
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