Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8663801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:04:42+00:00 2026-06-12T17:04:42+00:00

sympy.solve() seems to give me a wrong result. There are known problems with inequalities,

  • 0

sympy.solve() seems to give me a wrong result. There are known problems with inequalities, e.g. http://code.google.com/p/sympy/issues/detail?id=3244 but this is simple enough that it should work:

 import sympy
    from sympy.abc import x, u, s
    t1 = x*(1 - x)/(1 - s*x)
    t2 = u*x + (1-s)*(1 - u)*x*(1 - x)/(1 - s*x)
    sympy.solve(t1-t2,x)

is giving me 3 solutions. There should be only two, the first one is wrong. Is this a bug or am I making a mistake somewhere?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:04:44+00:00Added an answer on June 12, 2026 at 5:04 pm

    This has been fixed in the development version of SymPy (and in 0.7.2, which will be released in about a week). It now gives [0, s*(u - 1)/(2*s*u - s - u)].

    So, to answer your question, yes, it was a bug, and it was fixed.

    Regarding what went wrong before, I used git bisect to narrow down the commit that fixed the problem. That commit just changed the way that one of the fundamental simplification algorithms in SymPy, as_numer_denom, works. So I guess what happened is that the result in some intermediate operation came out simple enough that solve() was able to recognize that the bad solution is just 1/s (assuming the square root denests). solve() does check the solutions it finds by pluggin them back in, but if they are too complicated, it won’t be able to tell if they are bogus.

    Probably actually what happened, now that I look a little closer is that just (t1 - t2).as_numer_denom()[0], which solve uses (because the zeros of an expression are just the zeros of the numerator), in 0.7.2 only has degree 2 in x, whereas in 0.7.1 it had degree 3. The bogus solution came from this “false zero” (meaning it was also a zero of the denominator), and as I noted, it was too complicated for solve to notice it as such.

    That’s the best I can say without really digging into the code deeper.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, I am making a program using SymPy. I use sympy.Eq, sympy.solve, and sympy.Symbol.
I'm trying to solve a set of equations with SymPy 0.7.1: from sympy import
I did this code: from scitools.std import * from sympy import * x=Symbol('x') #Integral
I am using sympy and numpy to solve the following the problem: Given a
I'm currently learning to use SymPy. It seems interesting and useful, but I haven't
For example, I'd like to solve (source: texify.com ) Here's what I tried: from
As i've read in the sympy docs, the solve() command expects an equation to
how to simplify exponents in equations in sympy from sympy import symbols a,b,c,d,e,f=symbols('abcdef') j=(a**b**5)**(b**10)
I need to write some code that deals with generating and manipulating multivariable polynomials.
I'm brand new to Google App Engine and have just been playing around with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.