Ultraquick Demo

Hans Petter Langtangen [1, 2] (hpl at simula.no)

 

[1] Center for Biomedical Computing, Simula Research Laboratory
[2] Department of Informatics, University of Oslo

 

Dec 16, 2014

Starting point: basic math

Why Python?

Python is better than Matlab and C++ are for those with too much spare time.

Let's add!

 
$$ a + b = c $$

 

a = 2
b = 3
c = a + b
print c

Moving on: breathtaking graphics

Let's plot!

 
$$ f(x) = e^{-x^2} $$

 

from numpy import linspace, exp
from matplotlib.pyplot import plot, show
x = linspace(-4, 4, 101)
y = exp(-x**2)
plot(x, y)
show()