diff --git a/__pycache__/boris.cpython-37.pyc b/__pycache__/boris.cpython-37.pyc index 434fcdb..e9bc86a 100644 Binary files a/__pycache__/boris.cpython-37.pyc and b/__pycache__/boris.cpython-37.pyc differ diff --git a/boris.py b/boris.py index 028f6b9..a478979 100644 --- a/boris.py +++ b/boris.py @@ -74,6 +74,20 @@ def plot3(X,enote='m',zemlja=False): plt.show() +def rplot(X, enote='m', xy=[0,1],os='xy'): + fig = plt.figure() + ax = fig.subplots() + ax.plot(X[:,xy[0]],X[:,xy[1]], 'k') + ax.grid() + dx = X[-1,xy[0]]-X[-2,xy[0]] + dy = X[-1,xy[1]]-X[-2,xy[1]] + ax.arrow(X[-1,xy[0]],X[-1,xy[1]],dx,dy,head_width=0.1,head_length=0.2, + overhang=0.3, zorder=10,color='k') + ax.set_xlabel(r'${}$ [{}]'.format(os[0],enote)) + ax.set_ylabel(r'${}$ [{}]'.format(os[1],enote)) + plt.show() + + if __name__ == "__main__": # testni del kode E = lambda x: np.array([0.0,0.2,0.3]) diff --git a/report.py b/report.py new file mode 100644 index 0000000..d4f97f1 --- /dev/null +++ b/report.py @@ -0,0 +1,23 @@ +#!/usr/bin/python3 + +import numpy as np +import matplotlib.pyplot as plt +from matplotlib import rc +rc('font',**{'family':'serif','serif':['Computer Modern']}) +rc('text', usetex=True) + +from boris import * + +B = lambda x: np.array([0.,0.,x[0]**2+x[1]**2]) +E = lambda x: np.array([0.,0.,0.]) + +x0 = np.array([0.,-1.,0.]) +v0 = np.array([0.,1.,0.]) + +B = lambda x: np.array([0.,0.,1.]) +E = lambda x: np.array([0.,-1.,0.]) +E = lambda x: np.array([np.cos(x[0]),0.3,0.]) +X,V = boris(x0,v0,E,B,1e-3, 100) + +plot3(X) +rplot(X)