Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- from scipy.special import jv
- data = (7.9997, 0.234593634, -0.291131046, 0.185841208,
- 7.9998, 0.234607873, -0.291131434, 0.185819063,
- 7.9999, 0.234622108, -0.291131819, 0.185796918,
- 8.0000, 0.234628387, -0.291125242, 0.185775021,
- 8.0001, 0.234642617, -0.291125622, 0.185752874,
- 8.0002, 0.234656846, -0.291126, 0.185730726,
- 8.0003, 0.234671072, -0.291126376, 0.185708577)
- x, J1, J3, J5 = np.array(data).reshape(-1, 4).T
- j1, j3, j5 = [jv(n, x) for n in (1, 3, 5)]
- dj1 = J1 - j1
- dj3 = J3 - j3
- dj5 = J5 - j5
- if True:
- fig = plt.figure()
- ax = fig.add_subplot(1, 1, 1)
- for thing in (dj1, dj3, dj5):
- plt.plot(x, thing, linewidth=1.5)
- plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
- plt.ticklabel_format(axis='both', fontsize=14)
- plt.gca().get_xaxis().get_major_formatter().set_useOffset(False)
- plt.text(8.00005, -7E-06, 'J1', fontsize=16)
- plt.text(8.00005, 5E-06, 'J3', fontsize=16)
- plt.text(8.00005, -1E-06, 'J5', fontsize=16)
- plt.ylim(-8.3E-06, 7.8E-06)
- plt.title('Excel minus Scipy', fontsize=16)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement