On Wednesday, 8 January 2014 10:47:51 UTC-5, Andrea Cortis wrote:
>
> I have an expression, the result of a sympy calculation, of this type
>
> sqrt(pi)*(0.333333333333333*delta_1 + 0.333333333333333*delta_2 - 
> 2.66666666666667*gamma*r**2)
>
> where delta_1, delta_2,, gamma, and, r are symbols, and would like to 
> parse the atoms in such a way to replace the floats with rationals like in
>
> Rational(str(0.333333333333333)).limit_denominator(1000)
> Out[24]: 1/3
>
> snd so on, to obtain something like
>
> sqrt(pi)*(1/3*delta_1 + 1/3*delta_2 - 8/3*gamma*r**2)
>
>
>
Use nsimplify() on the expression. 

Cheers,
Julien

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to