In this example we use the package IntroToSymmetry.m to work out, first the point group of the Heat equation, 

Uxx-Ut=0.

then a nonclassical symmetry. References:
 
Bluman and Cole 1969 The general similarity solution of the heat equation, J. Math. Mech. 18: 1025-1042.

Baumann, Gerd 2000 Symmetry Analysis of Differential Equations with Mathematica Springer-Verlag (see Section 6.3).

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 input equation as a string. Don't include the ==0 at the end.

heatequation=
"D[U[x,t],x,x]-D[U[x,t],t]";

The function u[x,t] is a solution of the equation and this constraint must be applied in the form of a rule to the invariance condition. Be careful to check signs.

rulesarray=
{"D[U[x,t],x,x]->D[U[x,t],t]"};

Enter the list of independent variables.

independentvariables={"x","t"};

Enter the list of dependent variables.

dependentvariables={"U"};

Enter the list of function and/or constant names that must be preserved when the equation is converted to generic y1[x1,x2] variables.

frozennames={};

Enter the maximum derivative order of the input equation(s).

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 with respect to each of the independent variables 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,heatequation,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;

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

How many determining equations are there?

Length[zdeterminingequations]

Now solve the determining equations in terms of multivariable polynomials. 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=3]]

Here are the infinitesimals for the independent variables expressed in terms of z-variables.

xsefunctions

and the infinitesimals for the dependent variables.

etafunctions

infinitesimalgroups1=infinitesimalgroups/.{z1->x,z2->t,z3->U}

List the groups.

Column[infinitesimalgroups1]

(********************************************************************)

This is the classical group of the heat equation. Now let's look for a nonclassical symmetry. Let G=U-f[x,t]. The function G[x,t,U] is an invariant solution of the Heat equation if and only if it satisfies the invariance condition 

xse1(∂G/∂x)+xse2(∂G/∂t)+eta1(∂G/∂U)=0.

We will introduce this condition to the problem by adding it to rulesarray but with the infinitesimals xse1, xse2 and eta1 initially treated as arbitrary functions of (x,t,U) to be identified with infinitesimals later.

rulesarraynew=
{"D[U[x,t],x,x]->D[U[x,t],t]","D[U[x,t],t]->(eta1prime[x,t,U[x,t]]/xse2prime[x,t,U[x,t]])-(xse1prime[x,t,U[x,t]]/xse2prime[x,t,U[x,t]])*D[U[x,t],x]"};

frozennames={"xse1prime","xse2prime","eta1prime"};

Timing[FindDeterminingEquations[independentvariables,dependentvariables,frozennames,p,r,xseon,heatequation,rulesarraynew,internalrules]]

Length[zdeterminingequations]

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

Now change eta1prime, xse1prime and xse2prime to the infinitesimals eta1, xse1 and xse2.

eta1prime[z1_,z2_,z3_]:=eta1[z1,z2,z3]

xse1prime[z1_,z2_,z3_]:=xse1[z1,z2,z3]

xse2prime[z1_,z2_,z3_]:=xse2[z1,z2,z3]

zdeterminingequationsexpressions=ToExpression[zdeterminingequations]

These are the full nonlinear determining equations. This is an extremely complex system and the only reasonable way to make progress is to look for simplifying assumptions that lead to interesting solutions. To begin set xse2=1 (without loss of generality - see the text section 9.3).

zdeterminingequationssimplified=zdeterminingequationsexpressions/.
{xse2[z1,z2,z3]->1,
D[xse2[z1,z2,z3],z1]->0,
D[xse2[z1,z2,z3],z2]->0,
D[xse2[z1,z2,z3],z3]->0,
D[xse2[z1,z2,z3],z1,z1]->0,
D[xse2[z1,z2,z3],z1,z2]->0,
D[xse2[z1,z2,z3],z1,z3]->0,
D[xse2[z1,z2,z3],z2,z2]->0,
D[xse2[z1,z2,z3],z2,z3]->0,
D[xse2[z1,z2,z3],z3,z3]->0};

Column[zdeterminingequationssimplified,{Left,Below}]

zdeterminingequationssimplified1=zdeterminingequationssimplified/.
{D[xse1[z1,z2,z3],z3,z3]->0};

Column[zdeterminingequationssimplified1,{Left,Below}]

This is still a fairly complex nonlinear system for xse1 and eta1. To make further progress let eta1=0 and D[xse1,z2]=0 and D[xse1,z3]=0.

zdeterminingequationssimplified2=zdeterminingequationssimplified1/.
{eta1[z1,z2,z3]->0,
D[eta1[z1,z2,z3],z1]->0,
D[eta1[z1,z2,z3],z2]->0,
D[eta1[z1,z2,z3],z3]->0,
D[eta1[z1,z2,z3],z1,z1]->0,
D[eta1[z1,z2,z3],z1,z2]->0,
D[eta1[z1,z2,z3],z1,z3]->0,
D[eta1[z1,z2,z3],z2,z2]->0,
D[eta1[z1,z2,z3],z2,z3]->0,
D[eta1[z1,z2,z3],z3,z3]->0,
D[xse1[z1,z2,z3],z2]->0,
D[xse1[z1,z2,z3],z2,z1]->0,
D[xse1[z1,z2,z3],z2,z2]->0,
D[xse1[z1,z2,z3],z2,z3]->0,
D[xse1[z1,z2,z3],z3]->0,
D[xse1[z1,z2,z3],z3,z1]->0,
D[xse1[z1,z2,z3],z3,z2]->0,
D[xse1[z1,z2,z3],z3,z3]->0};

Column[zdeterminingequationssimplified2,{Left,Below}]

Simplify[%]

Finally with a series of simplified assumptions we have pared the determining equations to a simple result although other solutions to the full nonlinear system are certainly possible. Use Mathematica to solve the remaining determining equation.

DSolve[2*xse1[z1]*xse1'[z1]-xse1''[z1]==0,xse1[z1],z1]

D[a*Tan[a*x+b],x]

D[a*Tan[a*x+b],x,x]

2*a*Tan[a*x+b]*D[a*Tan[a*x+b],x]-D[a*Tan[a*x+b],x,x]

D[-a*Tanh[a*x+b],x]

D[-a*Tanh[a*x+b],x,x]

2*(-1)*a*Tanh[a*x+b]*D[-a*Tanh[a*x+b],x]-D[-a*Tanh[a*x+b],x,x]

This is a nonclassical symmetry of the heat equation,

xse1[z1, z2, z3_]:=-Sqrt[a^2]*Tanh[z1*Sqrt[a^2]+b*Sqrt[a^2]]
xse2[z1, z2, z3]:=1
eta1[z1, z2, z3]:=0

with group operator

X=-(Sqrt[a^2]*Tanh[z1*Sqrt[a^2]+b*Sqrt[a^2]]) ∂/∂x+(∂/∂t).

Let's check this result in the original invariance condition.

n=2;

m=1;

r=0;

xse1[z1_,z2_,z3_]=-Sqrt[a^2]*Tanh[z1*Sqrt[a^2]+b*Sqrt[a^2]]

xse2[z1_,z2_,z3_]=1

eta1[z1_,z2_,z3_]:=0

eta1t=PthInfinitesimal[
n,m,yindex=1,plocal=1,r,xseon,j1=2]

eta1xx=PthInfinitesimal[
n,m,yindex=1,plocal=2,r,xseon,j1=1,j2=1]

invariancecondcoefficients={
0,0,0,0,eta1t,eta1xx,0,0}

invarianceconditionsum=
Expand[
invarconditiontable.invariancecondcoefficients]/.
{D[y1[x1,x2],x1,x1]->D[y1[x1,x2],x2]}

Simplify[%]

%/.{D[y1[x1,x2],x2]->-(-Sqrt[a^2]*Tanh[x1*Sqrt[a^2]+b*Sqrt[a^2]])*D[y1[x1,x2],x1]}

Simplify[%]

The heat equation is indeed invariant under the nonclassical symmetry

xse1[x, t, U]:=-Sqrt[a^2]*Tanh[x*Sqrt[a^2]+b*Sqrt[a^2]]
xse2[x, t, U]:=1
eta1[x, t, U]:=0

with group operator

X=-(Sqrt[a^2]*Tanh[x*Sqrt[a^2]+b*Sqrt[a^2]]) ∂/∂x+(∂/∂t).

over the set of solutions that satisfy the condition XU=0.

MaxMemoryUsed[ ]