In this example we use the package IntroToSymmetry.m to work out the invariant groups of the nonlinear second-order ODE 

x(Subscript[Y, xx])+(Subscript[Y, x])+xExp[Y]=0. 

This notebook illustrates the use of Mathematica built-in functions to find the final form of the infinitesimals that turn out to contain the logarithm.

Clear all symbols in the current context.

ClearAll[Evaluate[Context[]<>"*"]]

First read in the package which is located in User Home Folder/Library/Mathematica/Applications/SymmetryAnalysis.

Needs["SymmetryAnalysis`IntroToSymmetry`"]

Enter the list of independent variables.

independentvariables={"x"};

Enter the list of dependent variables.

dependentvariables={"y"};

Enter the input equation as a string. Don't include the ==0 at the end.

inputequation=
"x*D[y[x],x,x]+D[y[x],x]+x*Exp[y[x]]";

The function y[x] is a solution of the equation and this constraint must be applied in the form of a rule to the invariance condition. Be sure to check signs. Note that the rule is carefully set up to replace one isolated term. Note, for example, the replacement rule,    x*D[y[x],x,x]->-D[y[x],x]+x*Exp[y[x]] would not give the correct set of determining equations because it would only replace the particular product  x*D[y[x],x,x] wherever it appears rather than replacing, say, the second derivative everywhere. The rule    D[y[x],x,x]->-(1/x)*D[y[x],x]+Exp[y[x]] will give the correct set of determining equations.  Enter the rule as a string.

rulesarray=
{"D[y[x],x,x]->-(1/x)*D[y[x],x]-Exp[y[x]]"};

Internally the package uses StringReplace to convert all of the user defined variables to generic x1,x2,x3..., y1,y2,y3... variables. When this is done it is important that function names and constant names that might appear in the equation are not erroneously modified. Enter the array of names that must be preserved when the equation is converted to generic (x1,y1) variables.

frozennames={"Exp"};

Enter the maximum derivative order of the equation.

p=2;

The maximum derivative order that the infinitesimals are assumed to depend on is specified by the input parameter r. This parameter is only nonzero when the user is looking for Lie contact groups or Lie-Backlund  groups. For the usual case where one is searching for point groups one sets r=0.

r=0;

When searching for Lie-Backlund groups (r=1 or greater) one can, without loss of generality, leave the independent variables untransformed. The corresponding infinitesimals (the xse's) are set to zero by setting xseon=0. If one is searching for point groups then set xseon=1. The choice xseon=1 is also an option when looking for Lie-Backlund groups and this can be useful when looking for contact symmetries.

xseon=1;

When searching for Lie-Backlund groups, it is necessary to differentiate the input equation r times producing derivatives of order p+r. These higher order differential consequences are appended to the set of rules applied to the invariance condition. This process is carried out automatically when internalrules=1. For point groups the equation or equation system is the only rule or set of rules needed and one sets internalrules=0.

internalrules=0;

Now work out the determining equations of the Lie point group that leaves the equation  invariant. The output is available as a table of strings called zdeterminingequations.

Timing[FindDeterminingEquations[independentvariables,dependentvariables,frozennames,p,r,xseon,
inputequation,rulesarray,internalrules]]

equationgenericvariables

invarconditiontable

ztableofrules

ztableofrulesxy

Here are the determining equations expressed in terms of z-variables. This output may be quite long.  The equations in the table can be distinguished by the ==0 at the end of each item.

zdeterminingequations

ToExpression[zdeterminingequations]/.ztableofrules

How many determining equations are there?

imax=Length[zdeterminingequations]

Lets look at the determining equations in a slightly more readable form.

zdeterminingequationscolumn=Column[ToExpression[zdeterminingequations],{Left,Below}]

zdeterminingequationscolumn=TraditionalForm[Column[ToExpression[zdeterminingequations],{Left,Below}]]

Now try to solve the determining equations in terms of multivariable polynomials of a selected order. The Mathematica function Solve uses Gaussian elimination to solve a large number of linear equations for the polynomial coefficients.  The time roughly follows

time/timeref=((number of equations)/(number of equationsref))^n

where the exponent is between 2.4 and 2.7. The Mathematica function Timing outputs the time required for the SolveDeterminingEquations function to execute.

Timing[SolveDeterminingEquations[independentvariables,dependentvariables,r,xseon,
zdeterminingequations,order=4]]

Here are the infinitesimals for the independent variables.

xsefunctions

and the infinitesimals for the dependent variables.

etafunctions

Express the xse functions in terms of x,y variables.

ToExpression[xsefunctions]/.ztableofrules

Express the eta function in terms of these variables.

ToExpression[etafunctions]/.ztableofrules

This process has correctly captured the group (xse,eta)=(-x/2,1) corresponding to the parameter b10.  But the expressions multiplying b15 do not correspond to any relevant group of the equation. See Example 8.2  in the text Introduction to Symmetry Analysis for the correct solution. The problem here comes from the exponential terms that arise in the determining  equations. The determining equations themselves are correct and should be compared with Example 8.2 in the  text but the SolveDeterminingEquations function is incapable of identifying the second group of this equation which  contains the logarithm.

Close examination of the third and fourth determining equations suggests that we try the following simplification of the infinitesimals.

xse1[z1_,z2_]:=-a*(z1/2)+f[z1]

eta1[z1_,z2_]:=a+g[z1]

Substitute these functions into the expression form of the determining equations.

Simplify[zdeterminingequationscolumn]

The first and second determining equations are satisfied. The second determining equation is uncoupled from the first. Mathematica has the capability of solving such equations.

DSolve[z1^2*f''[z1]-z1*f'[z1]+f[z1]==0,f[z1],z1]

Now try a a more refined form of the infinitesimals.

xse1[z1_,z2_]:=-a*(z1/2)+b*z1*Log[z1]

eta1[z1_,z2_]:=a+g[z1]

Substitute these functions into the expression form of the determining equations.

zdeterminingequationscolumn

Simplify[%]

The third equation can only be satisfied if the terms multiplying Exp[z2] are zero. This requires g[z1]=-2b-2bLog[z1] which also satisfies z1g'+z1^2g''=0. So now let's try a third form of the infinitesimals.

xse1[z1_,z2_]:=-a*(z1/2)+b*z1*Log[z1]

eta1[z1_,z2_]:=a-2*b-2*b*Log[z1]

Substitute these functions into the expression form of the determining equations.

zdeterminingequationscolumn

Simplify[%]

Let's check the original determining equations.

ToExpression[zdeterminingequations]/.{
xse1[z1_,z2_]->-a*(z1/2)+b*z1*Log[z1],
eta1[z1_,z2_]->a-2*b-2*b*Log[z1]}

Simplify[%]

Finally, the infinitesimals that leave the original ODE invariant are
xse[x,y]=-ax/2+b(xLog[x])
eta[x,y]=a+b(-2-2Log[x])
This is the two parameter group described in Example 8.2.

Let's generate a commutator table for the group. First set up an array of the groups.

infinitesimalgroupsxy={{{-x/2},{1}},{{x*Log[x]},{-2-2*Log[x]}}}

Column[infinitesimalgroupsxy]

MakeCommutatorTable[
independentvariables,dependentvariables,infinitesimalgroupsxy]

MatrixForm[commutatortable]

It looks like some terms in this last result should cancel.

MatrixForm[Simplify[commutatortable]]

This is a two dimensional solvable Lie algebra that can be used to reduce the original ODE to quadrature.

MaxMemoryUsed[ ]