#! /usr/bin/env python # plot1.py # # Example python program introducing the use # of the matplotlib module. # # Paul Eugenio # PHZ4151C # Jan 29, 2019 import matplotlib.pyplot as plt import numpy as np def cross_section(t): """ The transverse four-momentum scattering cross section: t * exp(-t) """ return t*np.exp(-t) # # main program # # Generate an array of values to plot x = np.linspace(0,10,101) y = np.zeros(len(x)) for i in range(len(x)): y[i] = cross_section(x[i]) # plotting routines # # Figure is saved as a png image and displayed in an X window. plt.plot(x,y) plt.savefig("sigma.png") plt.show()