.. Automatically generated Sphinx-extended reStructuredText file from DocOnce source (https://github.com/hplgit/doconce/) .. NOTE: This document is written in DocOnce syntax and automatically .. compiled to HTML, Sphinx, LaTeX, Markdown, MediaWiki, IPython notebooks, ... .. See ``_ .. Document title: A worked example on scientific computing with Python %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% :Authors: Hans Petter Langtangen (hpl at simula.no) :Date: Jul 27, 2016 .. Make corresponding slides .. The lists below could be coded in Python via Mako and processed .. for table of contents, requirements, etc. of teaching modules .. admonition:: Contents This worked example * fetches a data file from a web site, * applies that file as input data for a differential equation modeling a vibrating system, * solves the equation by a finite difference method, * visualizes various properties of the solution and the input data. The following programming topics are illustrated: * basic Python constructs: variables, loops, if-tests, arrays, functions * flexible storage of objects in lists, * storage of objects in files (persistence), * downloading files from the web, * user input via the command line, * signal processing and FFT, * curve plotting of data, * unit testing, * symbolic mathematics, * modules. All files can be forked at ``_. Optimal background for reading this note ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * some interest in exploring physics through numerical simulation * some very basic knowledge of * differential equations * finite difference approximations * Python or Matlab * significant interest in exploring Python for scientific computations to solve a real-world physical problem (with low mathematical complexity) .. admonition:: Notice You can read in two ways: either as a detailed example on using Python for solving differential equations (some `very basic Python knowledge `__ is preferred) or just to get an impression of how Python can be used in a Matlab-like fashion. If you need motivation for using Python as programming language, see :ref:`app:motivation`. Lists of many useful tutorials and introductions to Python, with emphasis on scientific computing, are found in :ref:`app:resources`.