Page - 209 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
Image of the Page - 209 -
Text of the Page - 209 -
8.1 FillingaWaterTank:TwoCases 209
Fig. 8.2 Water volume in a tank as it develops with constantly increasing rate of volume change
(r=V).Thenumerical computationsuse piecewise constant ratesasanapproximation to the true
rate
The similar code structures used for Case 1 and Case 2 suggests that a more
general (and improved)codemaybewritten, applicable tobothcases. Aswe move
onwith ournextexample,populationgrowth,wewill see howthiscanbedone.
8.1.3 ReformulatingtheProblemsasODEs
Typically, the problems we solved in Case 1 and Case 2, would rather have been
presented in “morepropermathematical language”asODEs.
Case 1 When the rates were piecewise constant, we could have been requested to
solve
V ′(t)=1Ls−1, 0s<t<1s,
V ′(t)=3Ls−1, 1s≤ t <2s,
V ′(t)=7Ls−1, 2s≤ t≤3s,
with
V(0)=1L,
whereV(0) isknownasan initial condition.
Programming for Computations – Python
A Gentle Introduction to Numerical Simulations with Python 3.6, Volume Second Edition
- Title
- Programming for Computations – Python
- Subtitle
- A Gentle Introduction to Numerical Simulations with Python 3.6
- Volume
- Second Edition
- Authors
- Svein Linge
- Hans Petter Langtangen
- Publisher
- Springer Open
- Date
- 2020
- Language
- English
- License
- CC BY 4.0
- ISBN
- 978-3-319-32428-9
- Size
- 17.8 x 25.4 cm
- Pages
- 356
- Keywords
- Programmiersprache, Informatik, programming language, functional, imperative, object-oriented, reflective
- Category
- Informatik