# Lie Group hint for SymPy

Hi, this week started with two of my previous PR’s getting merged (finally).

1.  The heuristics PR – https://github.com/sympy/sympy/pull/2308
2. The variable coefficient PDE – https://github.com/sympy/sympy/pull/2346

I started working on the integration of the infinitesimals to the present dsolve architecture. Before telling about the issues I ran into (a number of them actually), let me explain the algorithm in a few lines.

As you know (If you have been following my blog),the past few weeks my focus was on solving this monster PDE.
$\frac{\partial \eta}{\partial x} + (\frac{\partial \eta}{\partial y} - \frac{\partial \xi}{\partial x}) * h(x, y) - \frac{\partial \xi}{\partial y}*h(x,y)^{2} - \xi*\frac{\partial h}{\partial x} - \eta*\frac{\partial h}{\partial y}$
Why? Well, without going too much into detail, the solution to this PDE, $\xi$ and $\eta$, give the infinitesimals of the ODE $\frac{dy}{dx} = h(x, y)$. After getting the infinitesimals, this method is adopted.
1] One has to solve the Partial Differential Equations (again?)
a] $\xi\frac{\partial r}{\partial x} + \eta\frac{\partial r}{\partial y} = 0$
b] $\xi\frac{\partial r}{\partial x} + \eta\frac{\partial s}{\partial y} = 1$
2] Now one knows $r$ and $s$ in terms of $x$ and $y$, doing $\frac{ds}{dr} = \frac{\frac{\partial s}{\partial x} + \frac{\partial s}{\partial y}*h}{\frac{\partial s}{\partial x} + \frac{\partial s}{\partial y}*h}$ and converting the R.H.S in terms of $r$ and $s$, reduces into a quadrature, which can be solved quite easily with the ode_separable hint
3] After solving the ODE, it can be converted back into the original coordinates.

On a scale of optimism to pessimism, I am somewhere in between a realist and a pessimist, and I have to admit I was slightly disappointed with the effectiveness of the hint, since I was running into various issues, with a few ODEs that I had tested. These were some of them that I had identified.

1] Problem with Integral: I was testing an ODE in which, $r = x$, and I had to integrate a huge expression, which couldn’t be integrated, something like $\frac{1}{\sqrt{a0 + a1*r + a2*r^{2} + a3^r{3}}}$, it gave me an output of the form Integral, and when I substitued $r$ as $x$, it gave me a definite value, this is because doing subs on an Integral object, doesn’t substitute for the variable with respect to which you are integrating to. I was pointed to this issue by Aaron, which I haven’t looked at yet.

2] Assumptions: When I was applying to SymPy for Google Summer of Code, I saw this awesome proposal by Tom Bachmann, which seemed Greek and Latin to me then (Some parts of it does still, but never mind). The bottom line, is $\frac{dr}{ds}$ simplifies to a quadrature, sometimes only when, there are certain assumptions on $r$ and $s$. Lets take a random example, suppose $\frac{dr}{ds} = log{r^{s}} - s*log{r}$ reduces to zero only when $r > 0$, Since the input variable is $x$, giving assumptions on $x$, doesn’t seem to affect the assumptions on $r$.

3] There are some cases when the final expression, cannot be solved explicitly for $y$ like this https://gist.github.com/Manoj-Kumar-S/6201842 . I think the best way would be to return it as it is.

4] Recursion: Take the case of this wonderful ODE, $x^{2}*(-f(x)^{2} + \frac{df}{dx})- a*x^{2}*f(x) + 2 - a*x$, calculating the infinitesimals, give me $\xi = x^{2}$ and $\eta = a*x^{2}*f(x) - 2 + a*x + x^{2}*(-f(x)^{2})$. Since the first step in solving the PDE, $\frac{dy}{dx} = \frac{\eta}{\xi}$ , it gives the same ODE again.

Apart from this I believe rest of the code is good.

P.S: First ten days of college is over. There have been huge disappointments, but apart from that I have enjoyed either roaming outside, and working on my SymPy project, and I have done nothing other than that.