This week I worked on solving trigonometric inequalities.
The primary univariate inequality solver -
depends upon the results of
solve in order to solve the given inequality.
Taking a cue from PR#10022 on incorporating
solveset for inequalities, I worked on developing an approach for replacing the use of
solveset in solving inequalities.
Set-type output from
listobjects similar to that returned by
The most striking difference between both the APIs is the uniform
Set output returned by
Hence, the prime concern while transitioning from
solveset should be handling the various type of solutions.
Here are a few implementation ideas on the same:
FiniteSet : finite number of solutions
listconstructor on these type of objects works extremely well.
ImageSet : infinite number of solutions
This is generally the case with trigonometric functions as most of them are periodic in nature. We need to limit the number of solutions to be finite.
For this, I intend to use the a periodic interval:
[0, period]as the basis for filtering the solution set. This returns a simplified
FiniteSetof solutions which can be used to solve inequalities in a restricted interval. Following which we can generalise the output over the entire domain of the function.
A major issue here is the representation of the final solution set.
python In : solveset(cos(x)<0, x, domain=S.Reals) ⎡ π 3⋅π ⎤ ⎢2*n*pi + ─, 2*n*pi + ─── | n ∊ ℤ⎥ ⎣ 2 2 ⎦
Currently, we do not have a
Setobject for representing this.
For this, we need to implement an Indexed Union :
Union(X(a) for a in I)
We can symbolically represent the above solution as
BigUnion(Interval(2*n*pi + pi/2, 2*n*pi + 3*pi/2), n, S.Intgers).
The next week I will devote my time to the implementation part of solving inequalities.