Hi.

As others have noted, this was done intentionally.  1.0 is not the
same as 1.  You should avoid using floating point numbers in powers.
Using them as coefficients is fine.  The reason is that anything that
works using polynomials will only work with exact integer powers.  For
example,

In [18]: factor(x**2 - 1)Out[18]: (x - 1)⋅(x + 1)
In [19]: factor(x**2.0 - 1)
Out[19]:
 2.0
x    - 1

We had some discussion about this some other places before.  One is at
http://code.google.com/p/sympy/issues/detail?id=1374.  I think there
were others too.  If you want, you could probably bisect the change
and possibly find more info on it.

The non-simplification of x**2.0/x is indeed a bug.  That should work.
 I made http://code.google.com/p/sympy/issues/detail?id=2978 for this.

Aaron Meurer

On Tue, Jan 10, 2012 at 1:11 PM, Robert <[email protected]> wrote:
> I'm recently upgrading sympy to sympy-0.7.1-py2.7 (fom a fairly old
> version).
>
> One surprising change that I've noticed so far is
>
>>>> a = sympy.Symbol('a')
>>>> a**1 == a
> True
>>>> a**1.0 == a
> False
>
> I'm not clear on the reasoning. Is there any way to get around this?
> This results in very strange behavior like
>>>> a**1.0/a
> a**1.0/a
>
> The only solution I've found so far is the following:
>>>> (a**1.0/a).subs(a**1.0, a)
> 1
>
> I did attempt to search for this in the message board and the open
> issues, but I didn't find anything.
>
> Any help would be appreciated,
> Thanks,
> Rob
>
> --
> 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.
>

-- 
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.

Reply via email to