1

I want to know whether equation set has a solution, and I use solve(f)!=[] (python sympy) to achieve it. But I only need to know that whether there is a solution so I do not need to find all the solutions which will consume a lot of time. Is there any way to do it efficiently?

xcl
  • 21
  • 2

1 Answers1

1

Be aware that sympy.solve giving [] doesn't necessarily mean the equation has no solution. It only means it could not find any. Some equations have solutions but they cannot be expressed in closed form (like cos(x) = x). sympy.solveset will give you the full solutions but in cases where it can't tell it will just return a generic solution set.

As to the original question I don't know if there's a way to do it in general. If you are only dealing with real continuous functions you could check if it is strictly positive or strictly negative on its domain. Sympy doesn't have the strongest tools for checking this, without some user assistance.

asmeurer
  • 86,894
  • 26
  • 169
  • 240