System of Inequalities

Right now solve uses
reduce_inequalitie
s to solve system of equations. But it is not designed for more than one variable. 
ex: system =
[2*x  3*y <= 12, x+5*y <=20, x>0] symbols = [x,y])
you will get :NotImplementedError
: inequality has more than one symbol of interest We know answer is[0 < x <120/13 and 2(x6)/3 <= y <= (20x)/5]
[x = 120/13 and y = 28/13]

But
SymPy
already have project on this Cylindrical algebraic decomposition to Provide an interface for solving systems of polynomial inequalities. 
If we want to feature like old
solve
then just need to pass system of inequalities having one variable to solve for one variable. After checking this usereduce_inequalitie(system, symbol)
it will return solution. It is easy to implement.
General solution for Trigonometric equations
Problems in old method :

_solve_trig
changes the trig equation inexp
form (it’s fine). But then fraction and solving equation for it’s parts makes more number ofexp
. If we have more number ofexp
then we get more number ofimageset
, Since we_invert
for eachexp
factors. 
It retuns
ConditionSet
when it can’t solve, but its expression is in ` expform mostly with
I` and in complicated form. 
some times
_solve_as_poly
can solve Trig equations, but it is not using it.
New implemention :

I added
reduce_imageset
insolveset.py
to reduce the number of union returned by_solve_trig
method. As Harsh said it is no specific tosolveset
, so I moved the method tosets/sets.py
. I added the doctests and testcases intest_sets.py
. 
Now solving the
exp
form directly usingsolveset
. This makes the less number ofImageSet
in many cases. But to solve equation havingtan
in it, will be complicated, for that I changed thesolve_rational
method, so that it can handleexp
withI
. in denominator. 
Now using
_solve_as_poly
whensolveset
can’t solve it usingexp
form. If this also can’t solve then retuns theConditionSet
having simple trig functions, which is understandable.
reduce_imageset :

reduce_imageset
take theImageSet
or Union ofImageSet
and returns the minimum number ofImageSet
. 
First we extract the
Lambda
expression from the eachImageSet
and take principle values. Separate the positive and negative principle values and sort them. 
+ve and ve values are passed into
interpolate
method defined inpolys/polyfuncs.py
to get the general function in terms of Dummyn
. 
If only one
Imageset
or value in +ve or ve value list then return that as it is. Here we need to note that Dummyn
defined here is different then original lambda expression, so need to return originalimageset
. So I am storing originalImageSet
in dict with its principle vales. 
If more than one +ve/ve values are there then interpolate expression will be
ImageSet
expression and return. 
Here I separe the ve and +ve values because interpolate returns complicated expressions if we both types of values.

Also I sorted the +ve and ve list, to get simplified expression from interpolate.
Problems :
 In this PR
solveset_real(tan(x), x)
returnsimageset(Lambda(n, pi*(n  1)), S.Integers)
but I wantimageset(Lambda(n, n*pi), S.Integers)
.
Issues :
 Meanwhile I found a issue in
solveset
. issues/11194.2*sin(x)  2*sqrt(3)*cos(x)  sqrt(3)*tan(x) +3 = 0
can be easily solved if we factorize it correctly. But I haven’t found a good way to get its factor. I triedfactor
,expand(Trig + True)
,expand_trig
,rewrite(sin)
.
Follow @shekharrajak