Yathartha Joshi Open Source Enthusiast

GSoC 2018 - Week 6 - Continuing with transolve Part-III

For the sixth week, I started working on a few things as per the discussions with Amit:

  • Improving the API of transolve.

As transolve grew over the past few weeks the API became a bit messy, which was against the plan. So Amit suggested on to work on it to make it look clean. For this I added two internal functions add_type() and pow_type(), to handle expressions having add or power terms respectively. This could help us in achieving what we planned of: making the API extensible without it getting affected from the changes done in the function itself. If new solvers are to be added the modifcation has to be done in either of the internal functions.

  • Improved the working of _check_expo.

The implementation of the check_expo had a probelm, of not being generalised, only equations having two terms were checked. So the task was to make it generalised, so I implemented it using atoms, filtered the equations having Pow or exp with the help of .atoms() and then checked whether the variable that needs to be solved is present in the exponent or not but this too possesed a problem: asking for atoms was not a great choice as they can come from anywhere like cos(2**x).atoms(Pow, exp) would give 2**x and consequently the helper would return True, which is wrong. For this smichr suggested even better method of using .make_args(). We will seperate out all the Add arguments and then in each of them we will look for Mul arguments which will give us the atomic argument of the expression, now this term can be tested to have variable in the exponent.

  • Changes in the documentation

Also there were a few things that needed to fixed in the documentation. The docstring of expo_solver and check_expo were improved. Few changes were also done in transolve's documentation.

  • Worked on improvement of log solver

Apart from this I did some improvement in check_log to handle corner cases. As per the current logic check_log would return a “logcombined” equation to be further solved by log_solver, but this lead to a problem that the some equation (log(x**y) - y*log(x)) might get reduced to 0 and the check would fail, therefore this was handled by improving the condition as if condition not False. Apart from this single term expression needs to be properly handled.

Also I started getting familiar with lambert equations.

So these were the things that I worked on this week. The PR needs a bit more improvement to get merged, I will try to get it finished by mid of the coming week and start working on implementation of other solvers.

Follow @Yathartha22