8.1.1. Basic numerics and plotting with PythonΒΆ

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

../_images/sphx_glr_plot_python_101_001.png

Out:

[<matplotlib.lines.Line2D object at 0x7f8759d4db90>]

# 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 script: ( 0 minutes 0.101 seconds)

Gallery generated by Sphinx-Gallery