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

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

Bild der Seite - 75 -

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

Text der Seite - 75 -

3.4 Testing 75 Makinga test function is amatter of choosingf,F,a, andb, and thenchecking thevalueofri for the largest i: def test_trapezoidal_conv_rate(): """Check empirical convergence rates against the expected -2.""" from math import exp v = lambda t: 3*(t**2)*exp(t**3) V = lambda t: exp(t**3) a = 1.1; b = 1.9 r = convergence_rates(v, V, a, b, 14) print r tol = 0.01 msg = str(r[-4:]) # show last 4 estimated rates assert (abs(r[-1]) - 2) < tol, msg Running the test shows that all ri, except the first one, equal the target limit 2 within twodecimals. Thisobservationsuggest a toleranceof10 2. Remarkaboutversioncontroloffiles Having a suite of test functions for automatically checking that your soft- wareworks is considered as a fundamental requirement for reliable computing. Equally important isasystemthatcankeeptrackofdifferentversionsof thefiles and the tests, knownas a version control system. Today’smost popular version control system isGit4,which the authors strongly recommend the reader to use forprogrammingandwriting reports. ThecombinationofGit andcloudstorage such asGitHub is a very commonway of organizing scientific or engineering work. Wehave a quick intro5 toGit andGitHub that gets you up and running withinminutes. The typicalworkflowwithGitgoesas follows. 1. Beforeyoustartworkingwithfiles,makesureyouhave the latest versionof thembyrunninggit pull. 2. Editfiles, removeorcreatefiles (newfilesmustbe registeredbygit add). 3. When a natural piece of work is done, commit your changes by the git commitcommand. 4. Implementyourchangesalso in thecloudbydoinggit push. A nice feature ofGit is that people can edit the samefile at the same time and very oftenGit will be able to automaticallymerge the changes (!). Therefore, versioncontrol is crucialwhenyouworkwithothersorwhenyoudoyourwork on different types of computers. Another key feature is that anyone can at any timeview thehistory of afile, seewhodidwhatwhen, and roll back the entire file collection to a previouscommit. This feature is, of course, fundamental for reliablework. 4https://en.wikipedia.org/wiki/Git_(software) 5http://hplgit.github.io/teamods/bitgit/Langtangen_bitgit-bootstrap.html
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