Example: bankruptcy

Python for Computational Science and Engineering

Introduction toPython for Computational Science and Engineering (A beginner s guide)Hans FangohrFaculty of Engineering and the EnvironmentUniversity of SouthamptonSeptember 7, 20152 Contents1 Computational Modelling .. Modelling .. to support Computational modelling .. Why Python for scientific computing? .. strategies .. it right first, then make it fast .. in Python .. Literature .. video lectures on Python for beginners .. tutor mailing list .. Python version .. This document .. Your feedback ..142 A powerful Python prompt and Read-Eval-Print Loop (REPL).

So far, we have just discussed the development of models to describe reality, and using these models does not necessarily involve any computers or numerical work at all. In fact, if a model’s equation can be solved analytically, then one should do …

Tags:

  Development, Computational, Engineering, Sciences, For computational science and engineering

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Python for Computational Science and Engineering

1 Introduction toPython for Computational Science and Engineering (A beginner s guide)Hans FangohrFaculty of Engineering and the EnvironmentUniversity of SouthamptonSeptember 7, 20152 Contents1 Computational Modelling .. Modelling .. to support Computational modelling .. Why Python for scientific computing? .. strategies .. it right first, then make it fast .. in Python .. Literature .. video lectures on Python for beginners .. tutor mailing list .. Python version .. This document .. Your feedback ..142 A powerful Python prompt and Read-Eval-Print Loop (REPL).

2 Calculator .. Integer division .. to avoid integer division .. should I care about this division problem? .. Mathematical functions .. Variables .. Impossible equations .. +=notation ..233 Data Types and Data What type is it? .. Numbers .. integers .. Point numbers .. numbers .. applicable to all types of numbers .. Sequences .. type 1: String .. type 2: List .. type 3: Tuples .. sequences .. sequences .. Passing arguments to functions .. by value .. by reference.

3 Passing in Python .. considerations .. modification of data .. objects .. Equality and Identity/Sameness .. / Sameness .. : Equality and identity ..434 dir() .. names .. type .. isinstance .. help .. Docstrings ..495 Input and Printing to standard output (normally the screen) .. print (not compatible with Python ) .. printing .. str and str .. repr and repr .. from Python 2 to Python 3:print.. from Python 2 to Python 3: formatting of strings .. Reading and writing files.

4 Reading examples ..566 Control Basics .. If-then-else .. For loop .. While loop .. Relational operators (comparisons) inifandwhilestatements .. Exceptions .. Exceptions .. our own exceptions .. vs EAFP ..657 Functions and Introduction .. Using functions .. Defining functions .. Default values and optional parameters .. Modules .. modules .. modules .. ofname.. 1 .. 2 ..748 Functional Anonymous functions .. Map .. Filter .. List comprehension.

5 Reduce .. Why not just use for-loops? .. Speed ..839 Common Many ways to compute a series .. Sorting ..8810 From Matlab to Important commands .. The for-loop .. The if-then statement .. Indexing .. Matrices ..9211 Python IDLE .. Python (command line) .. Interactive Python (IPython) .. IPython console .. IPython Notebook .. Spyder .. Editors ..9512 Symbolic SymPy .. Symbols .. isympy .. Numeric types .. Differentiation and Integration .. Ordinary differential equations.

6 Series expansions and plotting .. Linear equations and matrix inversion .. Non linear equations .. Output: LATEX interface and pretty-printing .. Automatic generation of C code .. Related tools .. 1096 CONTENTS13 Numerical Numbers and numbers .. Limitations of number types .. Using floating point numbers (carelessly) .. Using floating point numbers carefully 1 .. Using floating point numbers carefully 2 .. Symbolic calculation .. Summary .. Exercise: infinite or finite loop.

7 11714 Numerical Python (numpy): Numpy introduction .. History .. Arrays .. Convert from array to list or tuple .. Standard Linear Algebra operations .. More numpy examples.. Numpy for Matlab users .. 12315 Visualising Matplotlib (Pylab) plotting y=f(x), (and a bit more) .. Matplotlib and Pylab .. First example .. How to import matplotlib, pylab, pyplot, numpy and all that .. IPython s inline mode .. Saving the figure to a file .. Interactive mode .. Fine tuning your plot.

8 Plotting more than one curve .. Histograms .. Visualising matrix data .. Plots ofz=f(x,y) and other features of Matplotlib .. Visual Python .. Basics, rotating and zooming .. Setting the frame rate for animations .. Tracking trajectories .. Connecting objects (Cylinders, springs, .. ) .. 3d vision .. Visualising higher dimensional data .. Mayavi, Paraview, Visit .. Writing vtk files from Python (pyvtk) .. 14416 Numerical Methods using Python (scipy) Overview.

9 SciPy .. Numerical integration .. Exercise: integrate a function .. Exercise: plot before you integrate .. Solving ordinary differential equations .. Exercise: usingodeint.. Root finding .. Root finding using the bisection method .. Exercise: root finding using the bisect method .. Root finding using thefsolvefuncion .. Interpolation .. Curve fitting .. Fourier transforms .. Optimisation .. numerical methods .. : Scipy-input output .. 16117 Where to go from here?

10 Advanced programming .. Compiled programming language .. Testing .. Simulation models .. Software Engineering for research codes .. Data and visualisation .. Version control .. Parallel execution .. 1668 CONTENTSC hapter 1 IntroductionThis text summarises a number of core ideas relevant to Computational Engineering and ScientificComputing using Python . The emphasis is on introducing some basic Python (programming) conceptsthat are relevant for numerical algorithms. The later chapters touch upon numerical libraries suchasnumpyandscipyeach of which deserves much more space than provided here.


Related search queries