Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 3724 by [email protected]: simplify raises IndexError: list index out of range
http://code.google.com/p/sympy/issues/detail?id=3724

Hi,
(I'm assuming this is where I post information about what looks like a bug sympy.)

I am tried to simplify an expression using simplify.

Here's something that worked:

In [266]: f = (-2*a*b - 2*alpha*t - 2*beta*t*x + 2*gamma*t)/(2 + 2*t*sigma**2)

In [267]: simplify(f)
Out[267]: (gamma*t - a*b - alpha*t - beta*t*x)/(1 + t*sigma**2)

Now, if I just include another variable in f, i.e. z, and then try to simplify, I get the error below. I can't see why this would happen, so I thought I would mention it here. (note that z has been declared by from sympy.abc import z).



In [268]: f = (-2*a*b - 2*alpha*t - 2*beta*t*x + 2*gamma*t*z)/(2 + 2*t*sigma**2)

In [269]: simplify(f)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-269-553a780abe5d> in <module>()
----> 1 simplify(f)

/usr/lib/pymodules/python2.7/sympy/simplify/simplify.pyc in simplify(expr)
   1309
   1310     """
-> 1311     expr = Poly.cancel(powsimp(expr))
1312 expr = powsimp(together(expr.expand()), combine='exp', deep=True)
   1313     if expr.could_extract_minus_sign():

/usr/lib/pymodules/python2.7/sympy/polys/polynomial.pyc in cancel(f, *symbols)
    693             return numer / denom
    694
--> 695         g = sympy.polys.algorithms.poly_gcd(p, q)
    696
    697         p = sympy.polys.algorithms.poly_div(p, g)[0]

/usr/lib/pymodules/python2.7/sympy/polys/algorithms.pyc in poly_gcd(f, g, *symbols)
    481
    482     if f.is_multivariate:
--> 483         h = poly_div(f*g, poly_lcm(f, g))[0]
    484     else:
    485         h = poly_subresultants(f, g, res=False)[-1]

/usr/lib/pymodules/python2.7/sympy/polys/algorithms.pyc in poly_lcm(f, g, *symbols)
    410             h_coeffs = [ coeff*lcm for coeff in H[0].coeffs ]
    411         else:
--> 412             h_coeffs = H[0].coeffs
    413
    414         h_monoms = [ monom[1:] for monom in H[0].monoms ]

IndexError: list index out of range






--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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 http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to