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

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

Bild der Seite - 117 -

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

Text der Seite - 117 -

5.4 MakingOurOwnModule 117 DESCRIPTION Module for computing vertical motion characteristics for a projectile. FUNCTIONS max_height(v0) Compute maximum height reached, given the initial vertical velocity v0. Assume negligible air resistance. time_of_flight(v0) Compute time in the air, given the initial vertical velocity v0. Assume negligible air resistance. y(v0, t) Compute vertical position at time t, given the initial vertical velocity v0. Assume negligible air resistance. We recognize thedocstrings in theprintoutandshould realize that it is agood idea tokeep thosedocstrings informative. With the following interactive session, comparing the answers to hand calcula- tions (using the formulasand a calculator),we confirm that the modulenow seems toworkas intended, In [1]: import vertical_motion as vm In [2]: vm.y(v0=5, t=0.6) Out[2]: 1.2342 In [3]: vm.time_of_flight(v0=5) Out[3]: 1.019367991845056 In [4]: vm.max_height(v0=5) Out[4]: 1.27420998980632 We now have a useful version of our own vertical motion module, from which imports work just like from built-in modules. Still, there is room for useful modifications,aswe will turn tonext.
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