1

I had a lot of issues trying to solve the problem with my plot of omega vs time, since the angle returned from the arctan function jumps up to a positive value. I tried adding 2*pi so that it returns to the first quadrant, but to no avail (from the answer to using arctan / arctan2 to plot a from 0 to 2π). I then tried making all the items in the array negative so that it continues on but I'm not sure what the issue is: arctan plot returns values that jump discontinuously I also tried using arctan2, math.atan, math.atan2

h = h5py.File("Waveforms/BBH0001/rhOverM_Asymptotic_GeometricUnits.h5", "r")
data = h['Extrapolated_N2.dir/Y_l2_m1.dat']

I had to define a function because of the error I got when trying to find the arctan of an array, and then vectorize iy

def f(z):
    return np.int(math.degrees(np.arctan(z)))

f2 = np.vectorize(f)
z = data[:,2]/data[:,1]
a = f2(z)

This part of code might look painful for some of you. I tried using a lot of different methods to solve the issue

i = 1
for i in xrange(len(z)):
    if a[i] > (a[i-1] + 10):
        b = [-x for x in a]

plt.plot(data[:,0], b, label='w')
Community
  • 1
  • 1
Daniel George
  • 23
  • 1
  • 9
  • 2
    `arctan` is a continuous function on the real line. Are you sure that the problem doesn't lie with the data that you are feeding `arctan`? Please give a [mcve] which demonstrates the problem. – John Coleman Jan 28 '17 at 21:18
  • Yes, please see the graph where the first and last plots are fine. Sorry, I am new to this – Daniel George Jan 28 '17 at 23:11
  • If it is true, as the title of your question claims, that the arctan function is discontinuous, then it should be discontinuous *somewhere*. For what real number are you claiming that the arctan function is discontinuous? If you are observing discontinuous output from the arctan function, it is probably the input which is the culprit. What your input is, we have no idea, since it come from some file. You seem to be using division before you feed input to arctan. Perhaps you are dividing by numbers close to 0? – John Coleman Jan 28 '17 at 23:29

0 Answers0