Basic numerics and plotting with PythonΒΆ

A simple example of basic Python numerics and how to plot it.


Python source code:

# import numpy: the module providing numerical arrays
import numpy as np
t = np.linspace(1, 10, 2000)

# import matplotlib.pyplot: the module for scientific plotting
import matplotlib.pyplot as plt
plt.plot(t, np.cos(t))

Total running time of the example: 1.71 seconds ( 0 minutes 1.71 seconds)