Seite - 11 - in Programming for Computations – Python - A Gentle Introduction to Numerical Simulations with Python 3.6, Band Second Edition
Bild der Seite - 11 -
Text der Seite - 11 -
1.2 APythonProgramwithVariables 11
The documentationfor Spyder8 might be useful to you. Also, more information
onwritingand runningPythonprogramsis found inAppendixA.4herein.
Whynotapocketcalculator instead?
Certainly, finding the answer as with the program above could easily have
beendonewithapocketcalculator.Noobjectionstothatandnoprogramming
wouldhavebeenneeded.However,whatifyouwouldliketohavetheposition
of the ball for every milli-second of the flight? All that punching on the
calculatorwouldhave takenyousomething like4h!
If you know how to program, however, you could modify the code above
slightly, using a minute or two of writing, and easily get all the positions
computed inonegowithina second.
An even stronger argument, however, is that mathematical models from
real life are often complicated and comprehensive. The pocket calculator
cannot cope with such problems, even not the programmable ones, because
their computational power and their programming tools are far too weak
comparedtowhata real computercanoffer.
Writeprogramswith a texteditor
When Python interprets some code in a file, it is concerned with every
character in the file, exactly as it was typed in. This makes it trouble-
some to write the code into a file with word processors like, e.g., Mi-
crosoft Word, since such a program will insert extra characters, invisible
to us, with information on how to format the text (e.g., the font size and
type).
Such extra information is necessary for the text to be nicely formatted
for the human eye. Python, however, will be much annoyed by the extra
charactersin thefileinsertedbyawordprocessor.Therefore,it is fundamental
that you write your program in a text editor where what you type on the
keyboard is exactly the characters that appear in the file and what Python
will later read. There are many text editors around. Some are stand-alone
programs like Emacs, Vim, Gedit, Notepad++, and TextWrangler. Others
are integrated in graphical development environments for Python, such as
Spyder.
8 See, e.g., https://www.spyder-ide.org/.
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