Advertisement
Guest User

Untitled

a guest
Sep 28th, 2018
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1.     import numpy as np
  2.     import matplotlib.pyplot as plt
  3.     from scipy.special import jv
  4.  
  5.     data = (7.9997,  0.234593634,  -0.291131046,  0.185841208,
  6.     7.9998,  0.234607873,  -0.291131434,  0.185819063,
  7.     7.9999,  0.234622108,  -0.291131819,  0.185796918,
  8.     8.0000,  0.234628387,  -0.291125242,  0.185775021,
  9.     8.0001,  0.234642617,  -0.291125622,  0.185752874,
  10.     8.0002,  0.234656846,  -0.291126,     0.185730726,
  11.     8.0003,  0.234671072,  -0.291126376,  0.185708577)
  12.  
  13.     x, J1, J3, J5 = np.array(data).reshape(-1, 4).T
  14.  
  15.     j1, j3, j5 = [jv(n, x) for n in (1, 3, 5)]
  16.  
  17.     dj1 = J1 - j1
  18.     dj3 = J3 - j3
  19.     dj5 = J5 - j5
  20.  
  21.     if True:
  22.         fig = plt.figure()
  23.         ax = fig.add_subplot(1, 1, 1)
  24.         for thing in (dj1, dj3, dj5):
  25.             plt.plot(x, thing, linewidth=1.5)
  26.         plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
  27.         plt.ticklabel_format(axis='both', fontsize=14)
  28.         plt.gca().get_xaxis().get_major_formatter().set_useOffset(False)
  29.         plt.text(8.00005, -7E-06, 'J1', fontsize=16)
  30.         plt.text(8.00005,  5E-06, 'J3', fontsize=16)
  31.         plt.text(8.00005, -1E-06, 'J5', fontsize=16)
  32.         plt.ylim(-8.3E-06, 7.8E-06)
  33.         plt.title('Excel minus Scipy', fontsize=16)
  34.         plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement