On 25 February 2016 at 10:44, Yingchi Li <[email protected]> wrote:
>
> I have found a bug in factor() and simplify()
> please look at the image below
>
> the correct answer is q2 + 0.1
Looks like a recent regression since I don't see it with 0.7.1 but I
do with master:
$ isympy
IPython console for SymPy 0.7.7.dev (Python 2.7.3-64-bit) (ground types: python)
...
In [1]: q1, q2 = symbols('q1 q2')
In [2]: b = q2*sin(q1)**2 + q2*cos(q1)**2 + 0.1*sin(q1)**2 + 0.1*cos(q1)**2
In [3]: simplify(b)
Out[3]: 0.1⋅q₂ + 0.01
It doesn't happen if you split the sum in two:
In [1]: q1, q2 = symbols('q1 q2')
In [2]: a = q2*sin(q1)**2 + q2*cos(q1)**2
In [3]: b = 0.1*sin(q1)**2 + 0.1*cos(q1)**2
In [4]: simplify(a)
Out[4]: q₂
In [5]: simplify(b)
Out[5]: 0.100000000000000
In [6]: simplify(a + b)
Out[6]: 0.1⋅q₂ + 0.01
In [7]: simplify(a + b) == simplify(a) + simplify(b)
Out[7]: False
--
Oscar
--
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/CAHVvXxToNmGSX%2BbgQNFpo92z7iCCoOmSFsK2kx9%3DudGvTe_LWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.