You can specify the bounds as inequalities such as x >= lb
and x <= ub
, for example:
from sympy.solvers import solve
from sympy import Symbol
x = Symbol('x')
solve([x >= 0.5, x <= 3, x**2 - 1], x)
Here we search for a solution of equation x**2 == 1
such that x
is in the interval [0.5, 3]
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…