This is clearly a bug, hopefully one that will be fixed soon. 

Aside: symbolic manipulations are more robust when expressions involve 
rational numbers instead of floating point numbers. For example:

y = a + Rational(1, 4)*b**2 + 1*b*c*x + 1*c**2*x**2

or 

y = a + Rational('0.25')*b**2 + 1*b*c*x + 1*c**2*x**2

would avoid the issue. 

Thanks for the report. 

On Thursday, January 25, 2018 at 5:07:57 PM UTC-5, Chuck Ursenbach wrote:
>
> I'm using isympy from a recent anaconda3 installation.  I find that factor 
> is introducing a spurious factor of 0.25.
>
> If I run this:
>
> from sympy import *
> a,b,c,d,x,y = symbols('a,b,c,d,x,y')
> y = a + 0.25*b**2 + 1.0*b*c*x + 1.0*c**2*x**2
> print('factor')
> print(factor(y-a))
> print('expand')
> print(expand(y-a))
> print('factor difference')
> print(simplify(y-a-factor(y-a)))
> print('expand difference')
> print(simplify(y-a-expand(y-a)))
>
> then I get this:
>
> factor
> 1.0*(0.25*b + 0.5*c*x)**2
> expand
> 0.25*b**2 + 1.0*b*c*x + 1.0*c**2*x**2
> factor difference
> 0.1875*b**2 + 0.75*b*c*x + 0.75*c**2*x**2
> expand difference
> 0
>
>

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/aedb9eac-ec3f-4652-a4fc-c0cdb5d2c562%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to