Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: PHY120
Views: 115
Kernel: Python 3 (old Anaconda 3)
import numpy as np import matplotlib.pyplot as plt Y, X = np.mgrid[-1:1:100j, -1:1:100j] ###Field equation### Fx = 1/(1-2*X*X) #i component of field equation Fy = Y/X #j component of field equation ##e.g. if your field equation is F = yi+xj, set Fx=Y and Fy=X plt.figure(figsize=(10,10)) plt.streamplot(X, Y, Fx, Fy, density=5) #Change density for more or fewer field lines plotted plt.xlabel('X', fontsize=18) plt.ylabel('Y', fontsize=18) plt.tick_params(labelsize=20) plt.show()
Image in a Jupyter notebook
##