There's no good reason. It's just not implemented yet. Mod(Rational(5, 7), 1).n() works because the Mod already returns 5/7, so it's just the same as Rational(5, 7).n().
It looks like Mod doesn't implement evalf at all, and it doesn't work automatically (that only happens if the function name is the same as the mpmath function name). It should be easy. Just evaluate the arguments, and then take the mod of them. Aaron Meurer On Wed, Feb 27, 2013 at 12:26 PM, G B <[email protected]> wrote: > Hi— > > Any idea why > > Mod(Rational(5,7),1).n() > > works but > > Mod(5*pi/7,1).n() > > doesn't? > > I have a number of fully substituted expressions that contain structures like > Mod(acos(cos(34*pi/115))/(2*pi),1) that fail to eval to float, and it's > looking like it's the pi in there that's stumping it. > > I started digging into evalf, but it would take me a while to work out what's > happening in there with all the precision optimizations and such. Maybe > there's an easy answer I'm overlooking... > > Thanks— > Greg > > -- > 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?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
