Hi,
On 12 August 2011 02:21, smichr <[email protected]> wrote:
> The following fails under 64 bit systems in my assert branch. I could
> really use some help figuring out why. If someone could run the
> following and post the results, I would appreciate it:
>
> Please run this in my (smichr) `assert` branch:
>
> from sympy.abc import *
> from sympy import *
> from sympy.core.exprtools import (Factors, Term, _gcd_terms)
> f = 2*(x + 1)*(x + 4)/(5*x**2 + 5) + (2*x + 2)*(x + 5)/(x**2 +1)/5
> + (2*x + 2)*(x + 6)/(5*x**2 + 5)
> print srepr((3*x + 6).primitive())
> print srepr(Term((2*x + 2)*(3*x + 6)**2))
> print srepr(_gcd_terms(f))
> try:assert (3*x + 6).primitive() == (3, x + 2)
> except:print 'fail1'
> try:assert Term((2*x + 2)*(3*x + 6)**2) == Term(18, Factors({x +
> 1: 1,x + 2: 2}), Factors({}))
> except:print 'fail2'
> try:assert _gcd_terms(f) == ((S(6)/5)*((1 + x)/(1 + x**2)), 5 + x,
> 1)
> except:print 'fail3'
>
Apply this https://gist.github.com/1141548. Corner cases were handled
improperly, so this is fixed (core tests pass on 64-bit). I also improved
speed of new primitive() by avoiding indexing. Anyway, this patch just
validates my previous doubts that we shouldn't hack SymPy this way. There
should be method mul_coeff()/div_coeff() that would implement this
optimization properly once for all applications.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>
>
Mateusz
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.