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

Yxx-(x^a)*Y^2=0 

considered in homework excercise 8.6.

First read in the package which is located in a folder called SymmetryAnalysis inside the Mathematica folder.

Needs["SymmetryAnalysis`IntroToSymmetry`"]

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

\(\(inputequation = 
"D[y[x],x,x]-(x^a)*y[x]^2";\)\)

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.

\(\(rulesarray = 
{"D[y[x],x,x]->(x^a)*y[x]^2"};\)\)

Enter the list of independent variables.

independentvariables = {"x"};

Enter the list of dependent variables.

dependentvariables = {"y"};

Enter the list of function and constant names that need to be preserved under the change to (x1,y1) variables.

frozennames = {"a"};

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 set 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

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

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

zdeterminingequationscolumn = 
      TraditionalForm[
        ColumnForm[ToExpression[zdeterminingequations], Left, 
          Below]]

Now solve the determining equations in terms of multivariable polynomials of some selected order.

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

Notice that Mathematica has returned a warning that when a multivariable polynomial for the infinitesimals is substituted into the determining equations the resulting expansion is not in polynomial form. This is due to the x^a term in the equation where a can be a fractional exponent. In this case the determining equations have to be solved by hand or interactively using Mathematica. Nevertheless, let's press on and see what the package generated.

Here are the infinitesimals that the package produced for the independent variables expressed in terms of z-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

Although the package has generated a solution it is not valid. Note the error message above that the expression generated by substituting the polynomials into the determining equations is not itself a polynomial. The problem is of course the exponent "a" that could be fractional in which case the infinitesimals will involve fractional exponents. The determining equations are correct but a hand calculation is needed to work out the solution. One group that can be determined by inspection is the dilation group (xse, eta)=(x,-(2+a)y).

********************************************

Let's look at the case a=-5.

\(\(equation = 
"D[y[x],x,x]-x^(-5)*y[x]^2";\)\)

\(\(rulesarray = 
{"D[y[x],x,x]->x^(-5)*y[x]^2"};\)\)

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

ztableofrules

zdeterminingequations

Length[zdeterminingequations]

Look at the determining equations in a slightly more readable form.

zdeterminingequationscolumn = 
      TraditionalForm[
        ColumnForm[ToExpression[zdeterminingequations], Left, 
          Below]]

We need to get rid of the powers of z1 that appear in the denominator of the determining eqautions.

zdeterminingequationsnoequalszero=
StringReplace[zdeterminingequations,
{"== 0"->" "}];

zdeterminingequationsnoequalszeroexpression=
Together[(z1^6)*ToExpression[
zdeterminingequationsnoequalszero]]

imax=Length[
zdeterminingequationsnoequalszeroexpression]

zdeterminingequationsmod=Table[
ToString[InputForm[
zdeterminingequationsnoequalszeroexpression[[i]]]]<>
"== 0",
{i,1,imax}]

Timing[
      SolveDeterminingEquations[independentvariables, dependentvariables, 
        r, 
xseon, zdeterminingequationsmod, 
        order = 3]]

xsefunctions

etafunctions

ToExpression[xsefunctions] /. ztableofrules

ToExpression[etafunctions] /. ztableofrules

Here is a list of the various infinitesimal groups for the case a=5.

infinitesimalgroupsxy = 
      infinitesimalgroups /. {z1 -> x, z2 -> y}

ColumnForm[infinitesimalgroupsxy] /. {z1 -> x, 
        z2 -> y}

The package finds two groups. Work out the commutator table of the Lie algebra.

MakeCommutatorTable[
independentvariables, 
      dependentvariables, infinitesimalgroupsxy]

Put the commutator table in readable form.

MatrixForm[commutatortable]

MaxMemoryUsed[ ]