Dec-29-2016, 07:57 PM
Hey there,
I'm new to python and the answer to my question might be really easy to find out but I admit I don't really know what to look for. I tried but without success.
So I simply want to plot the following function: 1/np.sqrt(1+(x/1700)**2)
So obviously this is what I want on the y-axis, however, I don't want something like plt.plot(x,1/np.sqrt(1+(x/1700)**2))
I want to "scale" the x-axis so that I have 1/np.sqrt(1+(x/1700)**2) over np.log(1700/x). This is simply to make it look nicer since
x should go from 159 to 160000
So I thought I could try sth like this:
"
x=np.arange(159,160000)
plt.plot(np.log(1700/x) , 1/np.sqrt(1+(x/1700)**2))
"
Should sth like this be possible?
I keep getting no graph and simply errors like:
RuntimeWarning: divide by zero encountered in log
invalid value encountered in subtract
return np.amin(x[1:] - x[0:-1]) >= 0
Obviously I shouldn't divide by zero but I don't think I actually do...
as for the second error I don't get at all where it's coming from
I would really appreciate it if anyone could tell me what I'm doing wrong. Thanks!
I'm new to python and the answer to my question might be really easy to find out but I admit I don't really know what to look for. I tried but without success.
So I simply want to plot the following function: 1/np.sqrt(1+(x/1700)**2)
So obviously this is what I want on the y-axis, however, I don't want something like plt.plot(x,1/np.sqrt(1+(x/1700)**2))
I want to "scale" the x-axis so that I have 1/np.sqrt(1+(x/1700)**2) over np.log(1700/x). This is simply to make it look nicer since
x should go from 159 to 160000
So I thought I could try sth like this:
"
x=np.arange(159,160000)
plt.plot(np.log(1700/x) , 1/np.sqrt(1+(x/1700)**2))
"
Should sth like this be possible?
I keep getting no graph and simply errors like:
RuntimeWarning: divide by zero encountered in log
invalid value encountered in subtract
return np.amin(x[1:] - x[0:-1]) >= 0
Obviously I shouldn't divide by zero but I don't think I actually do...
as for the second error I don't get at all where it's coming from
I would really appreciate it if anyone could tell me what I'm doing wrong. Thanks!