Hello,
I'm trying to plot this function with using this values:

Rh = 9.8    
H0 = 0.063 

def Thickness_H(H0, r, Rh): 
      return float(H0)*np.exp(float(r)/float(Rh))

r = np.linspace(0,1, 10)    
x =Thickness_H(H0, r, Rh)
plt.plot(r, x)
plt.show()

I'm trying to defind r like what i know but this dose not work, I'm getting this error:
only length-1 arrays can be converted to Python scalars.

may you please help me in this point?
Thank you

Try to remove all the calls to float(). They are not necessary, and numpy uses its own float type.

Okay, what about the plot how can I defined r

I don't understand your question. If you write return H0*np.exp(r/Rh), the code works and draws a curve, which is almost a straight line (I suppose it is because 1/Rh is small).

I want to plot this function

H0*np.exp(r/Rh)
I definded it, then I want to plot it, r is different values ? yes you are right I will get exponential curve?

Yes but when u is close enough to 0, exp(u) is close to 1 + u.

Thank you very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.