[Tfug] OT: Python: Fractional Exponents of Negative Numbers

Charles R. Kiss charles at kissbrothers.com
Mon Jan 18 13:09:53 MST 2010


Figured it out, thanks anyway!


I just used the log function; and used the abs() built-in on A, the negative number.
Seems to work.


def m(t, precision=1E-12, maxiters=100):
m=1.5

for i in range(maxiters):

n =m*log(m)+(m+1)*log(abs(A))-m*log(B)-log(k)-log(t)
dn =1+log(m)+log(abs(A))-log(B)


if precision > abs(n):

return m

m=m-(n/dn)

-- 


This message and any attachments may contain information that is privileged or confidential, and is intended solely for the addressee.  If you received this message in error, please notify the sender by reply e-mail and delete the message and any attachments.  Thank you.




More information about the tfug mailing list