nth root

Tim Roberts timr at probo.com
Sun Feb 1 01:09:12 CET 2009


"Tim Roberts" <t.roberts at cqu.edu.au> wrote:
> 
>Thanks - you're probably right - just my intuition said to me that rather than calculating that the 13th root of 4021503534212915433093809093996098953996019232
>is 3221.2904208350265....
>there must be a quicker way of finding out its between 3221 and 3222....
> 
>....but perhaps not.

Also, remember that the number you computed there is not really the 13th
root of 4021503534212915433093809093996098953996019232.  When you convert
it to float to do the exponentiation, you're losing everything after the
15th significant digit.  Of course, if all you're looking for is the
nearest integer, that's not very relevant.

Do you really need the absolute number?  You could take log(x)/13 and work
with the log of the results.  I suspect (without trying it) that's faster
than the exponentiation.

>From one Tim Roberts to another.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list