Reputation: 336
I want to look for the critical points of the following periodic function abs(sin(x))
for x
in the Real set.
So far I have tried:
from sympy import *
x = Symbol("x")
f = abs(sin(x))
solveset(diff(f), x, S.Reals)
with no luck, I then tried to unpack the absolute value into a piecewise function:
as_piece = Piecewise((sin(x), sin(x)>=0), (-sin(x), sin(x)<0))
solveset(diff(as_piece), x, S.Reals)
and again solveset
cannot solve it. The interesting thing is that solve
is able to solve as_piece
but of course returns only the first two critical points as its output is not a set
.
Upvotes: 0
Views: 438