Sympy: order of decisions from decision

Are the solutions from sympy solve () ordered in some way? Is it from minimum to maximum solutions? How can I ensure that the solution is non-negative?

In my problem, I need a unique minimum affirmative solution. I appreciate all the help

+3


source to share


1 answer


They are unordered, although if they are numeric you can use sorted

them for them (this will fail if they are symbolic or unreal). You can enforce only positive solutions by setting the character you decide to be positive, for example

x = symbols('x', positive=True)

      



Also note the caveat with sympy.solve

that he does not guarantee that he has provided you with all the solutions to the equation - only those he was able to find using the algorithms he implemented.

0


source







All Articles