cc.redberry.core.solver
Class InverseTensor
- java.lang.Object
-
- cc.redberry.core.solver.InverseTensor
-
public final class InverseTensor extends java.lang.ObjectThis class provides opportunities to find inverse of tensor. In other words it can be used to solve the the equation of the formT^{ij..}_{kp..}*Tinv^{kp..}_{mn..} = d^{i}_{m}*d^{j}_{m}*.. + ... (combinations of kroneckers),where T is specified tensor, Tinv is unknown tensor and d - kronecker delta. The main goal of this class is to create the tensor Tinv of the most general form with unknown coefficients, and produce a system of linear equations on these coefficients. The resulting equations can then be solved and coefficients values substituted in generated Tinv tensor.
The following example demonstrates the usage of theInverseTensorto find out the photon propagator in Lorentz gauge:... //expression specifies tensor, which need to inverse Expression toInverse = Tensors.parseExpression("D_mn = k_m*k_n-(1/a)*k_i*k^i*g_mn"); //linear equation on the unknown tensor K Expression equation = Tensors.parseExpression("D_ab*K^ac=d_b^c"); //samples from which inverse should be formed Tensor[] samples = {Tensors.parse("g_mn"), Tensors.parse("g^mn"), Tensors.parse("d_m^n"), Tensors.parse("k_m"), Tensors.parse("k^b")}; InverseTensor inverseTensor = new InverseTensor(toInverse,equation,samples); System.out.println(inverseTensor.getGeneralInverseForm()); System.out.println(Arrays.toString(inverseTensor.getEquations()));
The above code displays the inverse of specified tensorK^{ac} = a1*g^{ac}+a0*k^{a}*k^{c}and a system of equations on its coefficients[(-a**(-1)*a0+a0)*k^{i}*k_{i}+a1 = 0, -a**(-1)*a1*k_{i}*k^{i} = 1]
-
-
Constructor Summary
Constructors Constructor and Description InverseTensor(Expression toInverse, Expression equation, Tensor[] samples)Creates theInverseTensorinstance from the equation.InverseTensor(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, Transformation[] transformations)Creates theInverseTensorinstance from the equation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static ExpressionfindInverseWithMaple(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, boolean keepFreeParameters, Transformation[] transformations, java.lang.String mapleBinDir, java.lang.String path)This method calculates the tensor inverse to the specified tensor according to the specified equation using the Maple facilities to solve the system of linear equations.static ExpressionfindInverseWithMaple(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, Transformation[] transformations, java.lang.String mapleBinDir, java.lang.String path)This method calculates the tensor inverse to the specified tensor according to the specified equation using the Maple facilities to solve the system of linear equations.static ExpressionfindInverseWithMathematica(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, boolean keepFreeParameters, Transformation[] transformations, java.lang.String mathematicaBinDir, java.lang.String path)This method calculates the tensor inverse to the specified tensor according to the specified equation using the Wolfram Mathematica facilities to solve the system of linear equations.static ExpressionfindInverseWithMathematica(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, Transformation[] transformations, java.lang.String mathematicaBinDir, java.lang.String path)This method calculates the tensor inverse to the specified tensor according to the specified equation using the Wolfram Mathematica facilities to solve the system of linear equations.Expression[]getEquations()Return the resulting equations on the unknown coefficients.ExpressiongetGeneralInverseForm()Returns the inverse of the tensor with unknown coefficients.SimpleTensor[]getUnknownCoefficients()Returns the array of the unknown coefficients.ReducedSystemtoReducedSystem()
-
-
-
Constructor Detail
-
InverseTensor
public InverseTensor(Expression toInverse, Expression equation, Tensor[] samples)
Creates theInverseTensorinstance from the equation.- Parameters:
toInverse- expression specifies tensor, which need to inverseequation- linear equation on the unknown tensor in the form T^{..}_{...}*Tinv^{...}_{...} = ...samples- samples from which inverse should be formed into account when forming a system of linear equations
-
InverseTensor
public InverseTensor(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, Transformation[] transformations)
Creates theInverseTensorinstance from the equation.- Parameters:
toInverse- expression specifies tensor, which need to inverseequation- linear equation on the unknown tensor in the form T^{..}_{...}*Tinv^{...}_{...} = ...samples- samples from which inverse should be formedsymmetricForm- specifies whether inverse tensor should be symmetrictransformations- additional simplification rules, which can be taken into account when forming a system of linear equations
-
-
Method Detail
-
getEquations
public Expression[] getEquations()
Return the resulting equations on the unknown coefficients.- Returns:
- the resulting equations on the unknown coefficients
-
getGeneralInverseForm
public Expression getGeneralInverseForm()
Returns the inverse of the tensor with unknown coefficients.- Returns:
- the inverse of the tensor with unknown coefficients
-
getUnknownCoefficients
public SimpleTensor[] getUnknownCoefficients()
Returns the array of the unknown coefficients.- Returns:
- the array of the unknown coefficients
-
toReducedSystem
public ReducedSystem toReducedSystem()
-
findInverseWithMaple
public static Expression findInverseWithMaple(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, Transformation[] transformations, java.lang.String mapleBinDir, java.lang.String path) throws java.io.IOException, java.lang.InterruptedException
This method calculates the tensor inverse to the specified tensor according to the specified equation using the Maple facilities to solve the system of linear equations. The Maple code will be placed in the specified temporary directory inequations.maplefile. The solution of the linear system, produced by Maple, will be placed in the specified temporary directory inequations.mapleOutfile.
The following example demonstrates the usage of this method to find out the photon propagator in Lorentz gauge:... //expression specifies tensor, which need to inverse Expression toInverse = Tensors.parseExpression("D_mn = k_m*k_n-(1/a)*k_i*k^i*g_mn"); //linear equation on the unknown tensor K Expression equation = Tensors.parseExpression("D_ab*K^ac=d_b^c"); //samples from which inverse should be formed Tensor[] samples = {Tensors.parse("g_mn"), Tensors.parse("g^mn"), Tensors.parse("d_m^n"), Tensors.parse("k_m"), Tensors.parse("k^b")}; Tensor inverse = InverseTensor.findInverseWithMaple(toInverse, equation, samples, false, new Transformation[0], mapleBinDir, temporaryDir); System.out.println(inverse);
The above code displays the inverse of specified tensorK^ac=-a*g^ac*(k_i*k^i)**(-1)+a**2/(a-1)*k^a*k^c*(k_i*k^i)**(-2)- Parameters:
toInverse- expression specifies tensor, which need to inverseequation- linear equation on the unknown tensor in the form T^{..}_{...}*Tinv^{...}_{...} = ...samples- samples from which inverse should be formedsymmetricForm- specifies whether inverse tensor should be symmetrictransformations- additional simplification rules, which can be taken into account when forming a system of linear equationsmapleBinDir- path to Maple bin directory (e.g. "/home/user/maple14/bin")path- path to your temporary folder- Returns:
- tensor inverse to the specified tensor according to the specified equation and null if inverse does not exist
- Throws:
java.io.IOExceptionjava.lang.InterruptedException- when Maple fails to run
-
findInverseWithMaple
public static Expression findInverseWithMaple(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, boolean keepFreeParameters, Transformation[] transformations, java.lang.String mapleBinDir, java.lang.String path) throws java.io.IOException, java.lang.InterruptedException
This method calculates the tensor inverse to the specified tensor according to the specified equation using the Maple facilities to solve the system of linear equations. The Maple code will be placed in the specified temporary directory inequations.maplefile. The solution of the linear system, produced by Maple, will be placed in the specified temporary directory inequations.mapleOutfile.
The following example demonstrates the usage of this method to find out the photon propagator in Lorentz gauge:... //expression specifies tensor, which need to inverse Expression toInverse = Tensors.parseExpression("D_mn = k_m*k_n-(1/a)*k_i*k^i*g_mn"); //linear equation on the unknown tensor K Expression equation = Tensors.parseExpression("D_ab*K^ac=d_b^c"); //samples from which inverse should be formed Tensor[] samples = {Tensors.parse("g_mn"), Tensors.parse("g^mn"), Tensors.parse("d_m^n"), Tensors.parse("k_m"), Tensors.parse("k^b")}; Tensor inverse = InverseTensor.findInverseWithMaple(toInverse, equation, samples, false, new Transformation[0], false, mapleBinDir, temporaryDir); System.out.println(inverse);
The above code displays the inverse of specified tensorK^ac=-a*g^ac*(k_i*k^i)**(-1)+a**2/(a-1)*k^a*k^c*(k_i*k^i)**(-2)If the produced system of linear equations have infinitely many solutions, some of the coefficient cannot be determined exactly and remain as free parameters. The flagkeepFreeParametersspecifies whether this free parameters should be zeroed.- Parameters:
toInverse- expression specifies tensor, which need to inverseequation- linear equation on the unknown tensor in the form T^{..}_{...}*Tinv^{...}_{...} = ...samples- samples from which inverse should be formedsymmetricForm- specifies whether inverse tensor should be symmetrictransformations- additional simplification rules, which can be taken into account when forming a system of linear equationskeepFreeParameters- specifies whether the free parameters remaining from solution of linear system should be zeroedmapleBinDir- path to Maple bin directory (e.g. "/home/user/maple14/bin")path- path to your temporary folder- Returns:
- tensor inverse to the specified tensor according to the specified equation and null if inverse does not exist
- Throws:
java.io.IOExceptionjava.lang.InterruptedException- when Maple fails to run
-
findInverseWithMathematica
public static Expression findInverseWithMathematica(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, Transformation[] transformations, java.lang.String mathematicaBinDir, java.lang.String path) throws java.io.IOException, java.lang.InterruptedException
This method calculates the tensor inverse to the specified tensor according to the specified equation using the Wolfram Mathematica facilities to solve the system of linear equations. The Wolfram Mathematica code will be placed in the specified temporary directory inequations.mathematicafile. The solution of the linear system, produced by Wolfram Mathematica, will be placed in the specified temporary directory inequations.mathematicaOutfile.
The following example demonstrates the usage of this method to find out the photon propagator in Lorentz gauge:... //expression specifies tensor, which need to inverse Expression toInverse = Tensors.parseExpression("D_mn = k_m*k_n-(1/a)*k_i*k^i*g_mn"); //linear equation on the unknown tensor K Expression equation = Tensors.parseExpression("D_ab*K^ac=d_b^c"); //samples from which inverse should be formed Tensor[] samples = {Tensors.parse("g_mn"), Tensors.parse("g^mn"), Tensors.parse("d_m^n"), Tensors.parse("k_m"), Tensors.parse("k^b")}; Tensor inverse = InverseTensor.findInverseWithmathematica(toInverse, equation, samples, false, new Transformation[0], mapleBinDir, temporaryDir); System.out.println(inverse);
The above code displays the inverse of specified tensorK^ac=-a*g^ac*(k_i*k^i)**(-1)+a**2/(a-1)*k^a*k^c*(k_i*k^i)**(-2)- Parameters:
toInverse- expression specifies tensor, which need to inverseequation- linear equation on the unknown tensor in the form T^{..}_{...}*Tinv^{...}_{...} = ...samples- samples from which inverse should be formedsymmetricForm- specifies whether inverse tensor should be symmetrictransformations- additional simplification rules, which can be taken into account when forming a system of linear equationsmathematicaBinDir- path to Mathematica bin directory (e.g. "/home/user/maple14/bin")path- path to your temporary folder- Returns:
- tensor inverse to the specified tensor according to the specified equation and null if inverse does not exist
- Throws:
java.io.IOExceptionjava.lang.InterruptedException- when Mathematica fails to run
-
findInverseWithMathematica
public static Expression findInverseWithMathematica(Expression toInverse, Expression equation, Tensor[] samples, boolean symmetricForm, boolean keepFreeParameters, Transformation[] transformations, java.lang.String mathematicaBinDir, java.lang.String path) throws java.io.IOException, java.lang.InterruptedException
This method calculates the tensor inverse to the specified tensor according to the specified equation using the Wolfram Mathematica facilities to solve the system of linear equations. The Wolfram Mathematica code will be placed in the specified temporary directory inequations.mathematicafile. The solution of the linear system, produced by Wolfram Mathematica, will be placed in the specified temporary directory inequations.mathematicaOutfile.
The following example demonstrates the usage of this method to find out the photon propagator in Lorentz gauge:... //expression specifies tensor, which need to inverse Expression toInverse = Tensors.parseExpression("D_mn = k_m*k_n-(1/a)*k_i*k^i*g_mn"); //linear equation on the unknown tensor K Expression equation = Tensors.parseExpression("D_ab*K^ac=d_b^c"); //samples from which inverse should be formed Tensor[] samples = {Tensors.parse("g_mn"), Tensors.parse("g^mn"), Tensors.parse("d_m^n"), Tensors.parse("k_m"), Tensors.parse("k^b")}; Tensor inverse = InverseTensor.findInverseWithmathematica(toInverse, equation, samples, false, new Transformation[0], mapleBinDir, temporaryDir); System.out.println(inverse);
The above code displays the inverse of specified tensorK^ac=-a*g^ac*(k_i*k^i)**(-1)+a**2/(a-1)*k^a*k^c*(k_i*k^i)**(-2)- Parameters:
toInverse- expression specifies tensor, which need to inverseequation- linear equation on the unknown tensor in the form T^{..}_{...}*Tinv^{...}_{...} = ...samples- samples from which inverse should be formedsymmetricForm- specifies whether inverse tensor should be symmetrickeepFreeParameters- specifies whether the free parameters remaining from solution of linear system should be zeroedtransformations- additional simplification rules, which can be taken into account when forming a system of linear equationsmathematicaBinDir- path to Mathematica bin directory (e.g. "/home/user/maple14/bin")path- path to your temporary folder- Returns:
- tensor inverse to the specified tensor according to the specified equation and null if inverse does not exist
- Throws:
java.io.IOExceptionjava.lang.InterruptedException- when Mathematica fails to run
-
-
DataMelt 3.0 © DataMelt by jWork.ORG