I wonder if there is a way to specify that p is greater than 0 and smaller than pi, so that I don't get "cannot determine truth value of Relational".
Asked
Active
Viewed 638 times
1 Answers
2
You can do something like the following, using two booleans rather than the relational 0 <= x <= p
.
import sympy as sp
x, h, p = sp.symbols('x h p')
fx = sp.Piecewise(
((x*h)/p, ((0 <= x) & (x <= p))),
((h*(sp.pi - x))/(sp.pi - p), ((p <= x) & (x <= sp.pi)))
)
Which gives

CDJB
- 14,043
- 5
- 29
- 55