December 2017
Intermediate to advanced
386 pages
10h 42m
English
Enter the following code in your text editor:
import numpy as npimport matplotlibmatplotlib.use('Qt5Agg')import matplotlib.pyplot as pltf = lambda x: 1/((x-3)**2+.01) + 1/((x-9)**2+.04) - 6xvalues = np.linspace(2, 10, 300)yvalues = f(xvalues)plt.plot(xvalues, yvalues)plt.xlabel('$x$')plt.ylabel('$f(x)$')plt.title('The "humps" function')plt.show()print('Done plotting.')
Save the script to disk with the name backend_test.py and run it with the following command line:
python3 backend_test.py
Running the script will open a window displaying the plot shown in the following screenshot:

Read now
Unlock full access