Python Forum

Full Version: ln in for loop
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I m trying to solve PDE with finite elements method. Problem is, when I put the part, which has ln(x) in it, I get error. I tried np.log() and math.log() but no luck. Can someone help me?

T[0,:] = T_ok
T[:,0] = T_in


for t in range(Nt):
    for z in range(1,Nz+1):
        T[t+1,z] = T[t,z]-(v_avg*dt/dz)*(T[t,z]-T[t,z-1])-(U*2*dt*L/(r_1*dz))*(((T_in-T_h)-(T[t,z]-T_h))/(np.log((T_in-T_h)/(T[t,z]-T_h))))
        
    T[t+1,Nz+1] = T[t+1,Nz]
(Jun-17-2017, 07:21 AM)pikm57 Wrote: [ -> ]I get error.
Please, post the full Traceback in error tags
I just solved it. Tnx.
would be nice to expalin what the problem was for the benefit of other members who may come here searching for solution
The problem was that some values in ln() were <0.... such a stupid mistake Confused