In this example we use the package IntroToSymmetry.m to work out the point group of the 1-D Compressible Euler equations for isentropic flow

Ut+U*Ux+(1/rho)*Px=0,

Pt+U*Px+3*P*(Ux)=0,

(rho)t+U*(rho)x+rho(Ux)=0.

This next command turns off spurious spelling error warnings.

Off[General::spell]

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","t"};

Enter the list of dependent variables.

dependentvariables={"U","P","rho"};

Enter the list of function and/or constant names that have to be preserved when the equations are expressed in terms of generic variables.

frozennames={};

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

porder=1;

The maximum derivative order that the infinitesimals are assumed to depend on is specified by the input parameter rorder. 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 rorder=0.

rorder=0;

When searching for Lie-Backlund groups (rorder=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 equations with respect to all independent variables producing derivatives of order porder+rorder. 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;

Construct the array of rules to be applied to the invariance condition.

rulesarray=
{"D[U[x,t],t]->-U[x,t]*D[U[x,t],x]-(1/rho[x,t])*D[P[x,t],x]",
"D[P[x,t],t]->-U[x,t]*D[P[x,t],x]-3*P[x,t]*D[U[x,t],x]",
"D[rho[x,t],t]->-U[x,t]*D[rho[x,t],x]-rho[x,t]*D[U[x,t],x]"};

Enter the momentum equation as a string.

inputequation1=
"D[U[x,t],t]+U[x,t]*D[U[x,t],x]+
(1/rho[x,t])*D[P[x,t],x]";

Enter the pressure equation as a string.

inputequation2=
"D[P[x,t],t]+U[x,t]*D[P[x,t],x]+
3*P[x,t]*D[U[x,t],x]";

Enter the continuity equation as a string.

inputequation3=
"D[rho[x,t],t]+U[x,t]*D[rho[x,t],x]+
rho[x,t]*D[U[x,t],x]";

Now work out the determining equations of the Lie point group which leaves equation1 invariant. The Mathematica function Timing outputs the time required for the FindDeterminingEquations function to execute.

Timing[FindDeterminingEquations[
independentvariables,dependentvariables,frozennames,porder,rorder,xseon,
inputequation1,rulesarray,internalrules]]

zdeterminingequations

In a long calculation it is very useful to save intermediate results in a file so that certain calculations do not have to be repeated. This way one can close the notebook then reopen it and return to the point where the calculation left off. The next line saves the array zdeterminingequations in a file called zdeterminingequations1file. The file is located in the Mathematica folder.

Save["zdeterminingequations1file",zdeterminingequations]

As a demonstration of how this works we now clear the definition of zdeterminingequations generated by FindDeterminingEquations.

Clear[zdeterminingequations]

yes the definition has been cleared.

zdeterminingequations

Now restore the definition of zdeterminingequations by reading in the file zdeterminingequations1file.

<<zdeterminingequations1file;

Here it is exactly as before.

zdeterminingequations

Now continue the calculation as before. The determiningequations of equation1.

zdeterminingequations1=zdeterminingequations;

Now work out the determining equations of the Lie point group which leaves equation2 invariant.

Timing[FindDeterminingEquations[
independentvariables,dependentvariables,frozennames,porder,rorder,xseon,
inputequation2,rulesarray,internalrules]]

The determiningequations of equation2.

zdeterminingequations2=zdeterminingequations;

Now work out the determining equations of the Lie point group which leaves equation3 invariant.

Timing[FindDeterminingEquations[
independentvariables,dependentvariables,frozennames,porder,rorder,xseon,
inputequation3,rulesarray,internalrules]]

The determiningequations of equation3.

zdeterminingequations3=zdeterminingequations;

Now collect all the determining equations together.

zdeterminingequations4=
Join[zdeterminingequations1,
zdeterminingequations2,zdeterminingequations3];

How many determining equations are there altogether?

Length[zdeterminingequations4]

Here is the correspondence between z-variables and conventional variables.

ztableofrules

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,rorder,xseon,zdeterminingequations4,order=4]]

Here are the infinitesimal transformation functions for the independent variables.

xsefunctions

and for the dependent variables.

etafunctions

infinitesimalgroups1=infinitesimalgroups/.
{z1->x,z2->t,z3->U,z4->P,z5->rho};

Check the groups. xse's are on the left, eta's are on the right.

Column[infinitesimalgroups1]

Check the infinitesimals in the determining equations.

Simplify[ToExpression[zdeterminingequations4]]

Create the commutator table.

MakeCommutatorTable[
independentvariables,dependentvariables,infinitesimalgroups1]

MatrixForm[commutatortable]

MaxMemoryUsed[ ]