Oscar you mentioned below finding the # of digits using log
and the code ;

In [1]: from sympy import mpmath 
In [2]: mpmath.mp.dps = 950 
In [3]: mpmath.mpf('1.4142') ** 6000 % 400 

How accurate of a return do you feel this will give?  Are we losing
any data, will the return be very accurate?


 

>   10**d = 1.4142**6000 
> Which gives that 
>     d = log10(1.4142**6000) = 6000*log10(1.4142) ~= 903 
>
> So if you want an answer that's good for m digits you'll need to use 
> about 900+m digits for the exponentiation: 
>
> In [1]: from sympy import mpmath 
> In [2]: mpmath.mp.dps = 950 
> In [3]: mpmath.mpf('1.4142') ** 6000 % 400 
> Out[3]: mpf('271.048181008630921815939109488389
>
 

> BTW it's also possible to do this particular calculation easily enough 
> just with Python stdlib (and without numpy or sympy): 
>
> In [1]: from fractions import Fraction 
>
> In [2]: float(Fraction('1.4142')**6000 % 400) 
> Out[2]: 271.04818100863093 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/6da7b2d0-ce6f-4eb5-886f-36af91ac7ebe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to