#! /usr/bin/env python #! /usr/bin/env python # plot2.py # # Example python program introducing the use # of the matplotlib module. # # Paul Eugenio # PHZ4151C # Jan 28, 2019 # import matplotlib.pyplot as plt plt.rc('text', usetex=True) # needed for Latex formatting of figure lables import numpy as np def cross_section(t): """" The transverse four-momentum scattering cross section: t * exp(-t) """ return t**2 * np.exp(-t) # Generate an array of values to plot # x = np.linspace(0,10,101) y = cross_section(x) # # Plotting Routines # plt.plot(x,y) # figure dressing plt.legend([r"$d\sigma/dt = t^2 e^{-t}$"]) plt.title("Scattering Probability") plt.xlabel("t") plt.ylabel(r"$d\sigma/dt$") # Figure is saved as a png image and displayed in an X window. plt.savefig("sigma-t.png") plt.show()