Re: [sympy] Difference between fraction and as_numer_denom

2015-03-27 Thread Paul Royik
I see now. On Friday, March 27, 2015 at 9:51:52 PM UTC+2, Aaron Meurer wrote: > > We need to just remove this automatic distribution of numbers. Until > we do that, we will continue to have confusing behavior like this. See > https://github.com/sympy/sympy/issues/4596 for more information. > >

Re: [sympy] Difference between fraction and as_numer_denom

2015-03-27 Thread Aaron Meurer
We need to just remove this automatic distribution of numbers. Until we do that, we will continue to have confusing behavior like this. See https://github.com/sympy/sympy/issues/4596 for more information. Aaron Meurer On Fri, Mar 27, 2015 at 1:47 PM, Paul Royik wrote: > This dosn't seem reasonab

Re: [sympy] Difference between fraction and as_numer_denom

2015-03-27 Thread Paul Royik
This dosn't seem reasonable. Expanding goes on the line Mul(*numer). Mul(*numer, evaluate=False) fixes things. On Friday, March 27, 2015 at 4:31:58 PM UTC+2, Chris Smith wrote: > > That seems reasonable since fraction is allowing the expr to rewrite: > > >>> 2*e > 2*(x + 1)/(x - 1) > >>> fraction

Re: [sympy] Difference between fraction and as_numer_denom

2015-03-27 Thread Aaron Meurer
Isn't this just because the Mul evaluates itself. I don't think it's actually fraction() that is rewriting things. Aaron Meurer On Fri, Mar 27, 2015 at 9:31 AM, Chris Smith wrote: > That seems reasonable since fraction is allowing the expr to rewrite: > 2*e > 2*(x + 1)/(x - 1) fraction

Re: [sympy] Difference between fraction and as_numer_denom

2015-03-27 Thread Chris Smith
That seems reasonable since fraction is allowing the expr to rewrite: >>> 2*e 2*(x + 1)/(x - 1) >>> fraction(_) (2*x + 2, x - 1) On Friday, March 27, 2015 at 4:28:28 AM UTC-5, Paul Royik wrote: > > Both fraction and as_numer_denom return (2x+2, sin(x)+1) for expression > 2(x+1)/(sin(x)+1), i.e.

Re: [sympy] Difference between fraction and as_numer_denom

2015-03-27 Thread Paul Royik
Both fraction and as_numer_denom return (2x+2, sin(x)+1) for expression 2(x+1)/(sin(x)+1), i.e. they rewrite numerator and denominator. I suggest simple fix for fraction: substitute last line return Mul(*numer), Mul(*denom) with return Mul(*numer, evaluate=False), Mul(*denom, evaluate=False) For

Re: [sympy] Difference between fraction and as_numer_denom

2015-03-26 Thread Aaron Meurer
It looks like fraction takes into account assumptions, but on the other hand, it doesn't do any rewriting of the expression to combine sums of fractions (e.g., fraction(1/x + 1/y) gives (1/x + 1/y, 1), whereas (1/x + 1/y).as_numer_denom() gives (x + y, x*y)). Aaron Meurer On Thu, Mar 26, 2015 at

[sympy] Difference between fraction and as_numer_denom

2015-03-26 Thread Paul Royik
I used as_numer_denom earlier and now found fraction. Is there any difference between them? -- 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...@googlegrou