GSoC 2018  Week 12  Continuing with logarithmic solver and implementing lambert solver PartII
09 Aug 2018This week I continued the work with log solver and lambert solver. The log solver implementation is almost done with just few check for assumptions. Symbolic logarithmic equations should be dealt with proper assumptions. Such equations would give unsolved instance of ConditionSet
otherwise.
>>> a, b, x = symbols('a, b, x')
>>> solveset(a**x  b**(x + 1), x, S.Reals)
ConditionSet(x, Eq(a**x  b**(x + 1), 0), S.Reals)
# because the bases (here, `a and b`) should have a positive value > 0)
>>> a, b = symbols('a b', positive=True)
>>> solveset(a**x  b**(x + 1), x, S.Reals)
{log(b)/(log(a)  log(b))}
Discussions with Amit and Chris suggested that there should be some other way to handle vanilla symbols. There should be atleast a ValueError
or something else that would tell the user why this cannot be solved. Chris suggested of returning a Piecewise
as object for this scenario. Something like:
cond = True if fuzzy_and([a > 0, b > 0, Eq(im(f), 0), Eq(im(g), 0)]) else False
Piecewise((solutions, cond), ConditionSet(........), True))
Using Piecewise was not the greatest of the option as:

Though the assumptions were checked but it didn’t provided information to the user that why did it not solved.

Also using
Piecewise
had some problem causing recursion error, though it could be solved but it would make things unncessarily complicated. 
Also
solveset
is not made to return objects other thanSets
.
So we switched to a completely different approach. We tried using a different type of ConditionSet
: providing the information within it that is necessary for the equation to be solved. The approach was: Force the equation to get solved but return a ConditionSet (a different than ususal) with the required assumptions, like:
ConditionSet(x, And(a_base>0, b_base>0, Eq(im(a_exp), 0), Eq((im(b_exp), 0))), {solutions})
. So now the above equation would return solutions something like:
ConditionSet(x, (a > 0) & (b > 0), Intersection(Reals, {log(b)/(log(a)  log(b))}))
So this approach has been applied in the PR as of now, only a few minor changes needs to be done. I will try to finish this by the end of the week.
Apart from this some work has been done in lambert solver
:
 Used
_is_lambert
to identify lambert type equations.  Implemented bivariate solver (I will add a commit for this soon).
 Ran
solve
’s tests, to get an idea of the extent to whichsolveset
would handle such equations.
What’s next:
I will try to wrap up the work of both the PR’s. Lambert solver PR would need a bit more time for reviewing but nevertheless I will be continuing its work post GSoC. Implementing these two solvers will make solveset
fully functional to handle transcendental equations which is a major part of my GSoC propsal. There will be a few minor things left that I will try to finish post GSoC. Also since this is the last week for the coding period, I will be needing to submit a final report of my work, I will complete and submit it before the deadline.