Reduce


Description

  • Reduce(equations, vars) reduces a system of tensorial equations to a system of symbolic equations.
  • Reduce(equations, vars, options) allows to pass additional options .
  • Reduce allows to completely solve a system of equations using external system (Maple or Mathematica).

Examples

Reduce a system of tensorial equations:

def eq1 = 'F_mn + F_nm + A_mn + A_nm = 0'.t
def eq2 = 'F_mn/2 + A_nm/2 = F_nm + A_mn '.t
def reduced = Reduce([eq1, eq2], ['F_mn'])
println reduced
   > [F_{mn} = C[0]*g_{mn}+C[1]*A_{mn}+C[2]*A_{nm}, 1+C[1]+C[2] = 0,
       1+C[1]+C[2] = 0, 2*C[0] = 0, -1-C[2]+(1/2)*C[1] = 0,
       1/2-C[1]+(1/2)*C[2] = 0, -(1/2)*C[0] = 0]

Solve it using Wolfram Mathematica:

def options = [ExternalSolver: [Solver: 'Mathematica', Path: '/usr/local/bin']]
println Reduce([eq1, eq2], ['F_mn'], options)
   > [[F_{mn} = -A_{nm}]]


Solve a system of equations with special symmetries of unknown tensor: \[ \left\{ \begin{array}{l} T^{abe}{}_{rba}-x\,T^{bea}{}_{rba} = 8\,d_{r}^{e}\\ T^{pqr}{}_{klm} T^{abc}{}_{pqr} = d^{a}_{m}\,g^{bc}\,g_{lk} \end{array} \right. \] where \(x\) and \(T^{abe}{}_{rba}\) are unknown variables and the last one has symmetry [1, 5, 0, 4, 3, 2] (in one-line notation).

Redberry code:

//setting up symmetries
addSymmetry 'T^abc_pqr', [1, 5, 0, 4, 3, 2].p

def eq1 = 'T^{abe}_{rba}-x*T^{bea}_{rba} = 8*d_{r}^{e}'.t
def eq2 = 'T^{pqr}_{klm}*T^{abc}_{pqr} = d^{a}_{m}*g^{bc}*g_{lk}'

def options = [Transformations: 'd_n^n = 4'.t, ExternalSolver:
                  [Solver: 'Mathematica',
                   Path: '/usr/local/bin']]

def s = Reduce([eq1, eq2], ['T^abc_pqr', 'x'], options)
println s
   > [[T^{abc}_{pqr} = -d^{a}_{r}*g^{cb}*g_{qp}, x = 12],
      [T^{abc}_{pqr} = d^{a}_{r}*g^{cb}*g_{qp}, x = -4]]


Generate and find projection operator: \[ \left\{ \begin{array}{l} J_{ab cd}\,J^{ab pq} = J_{ab}{}^{pq}\\ J_{abcd}\,J^{acbd} = \frac{1}{2}\,J^a{}_{ba}{}^b\\ J_a{}^{abc} = 0 \end{array} \right. \] with symmetries \[J_{abcd} = J_{cd ab} \quad \mbox{and} \quad J_{ab cd} = J_{ba cd}\]

Redberry code:

//setting up symmetries of tensors
addSymmetry 'J_abcd', 1, 0, 2, 3
addSymmetry 'J_abcd', 2, 3, 0, 1

//generate solution of the most general tensorial form
// and store the coefficients
def coefs = []
def genTensor =
    GenerateTensor('_{ab cd}'.si, ['g_mn', 'k_m'],
     [GeneratedParameters: { i -> coefs << "C$i".t; "C$i".t }])

def equations = [
   'J_{ab cd}*J^{ab pq} = J_{cd}^{pq}',
   'J_abcd*J^acbd = J^a_ba^b/2',
   'J_a^acd = 0',  
   'J_abcd'.eq(genTensor)] 

def options = [
    Transformations: 'd_m^m = 4'.t & 'k_m*k^m = M**2'.t, //additional simplifications
    ExternalSolver: [
        Solver: 'Maple',
        Path: '/home/stas/maple13/bin']]

def s = Reduce(equations, ['J_abcd'.t, * coefs], options)
def result = s.collect { it[0] }
println result
   > [J_{abcd} = 0, 
          J_{abcd} = -2*M**(-4)*k_{a}*k_{b}*k_{c}*k_{d} 
           +(1/2)*M**(-2)*g_{bc}*k_{a}*k_{d}
           +(1/2)*M**(-2)*g_{ac}*k_{b}*k_{d}
           +(1/2)*M**(-2)*g_{ad}*k_{b}*k_{c}
           +(1/2)*M**(-2)*g_{bd}*k_{a}*k_{c}]

Options

  • Transformations: specify transformation rules that will be used in Reduce to simplify the resulting system.
    Consider system:\[ \left\{ \begin{array}{l} J_{ac} J^{ab} + 3\,J_c{}^b = -2\,d^{b}_{c}\\ k^a J_{ab} = -k_b \\ J_{ab} J^{ab} = 9 \end{array} \right. \]This system have solutions only for particular space dimensions.
    Redberry code:
    def eq1 = 'J_ac*J^ab + 3*J_c^b = -2*d^{b}_{c}'.t
    def eq2 = 'k^a*J_ab = -k_b'.t
    def eq3 = 'J_ab*J^ab = 9'.t
    
    def options = [Transformations: 'd_n^n = dim'.t, //here we specify dimension
                   ExternalSolver: [
                        Solver: 'Mathematica',
                        Path: '/usr/local/bin']]
    
    def s = Reduce([eq1, eq2, eq3], ['dim', 'J_ab'], options)
    println s
    

   > [[dim = 9, J_{ab} = -g_{ab}],
           [dim = 3, J_{ab} = -2*g_{ab}+(k^{c}*k_{c})**(-1)*k_{a}*k_{b}]]

  • SymmetricForm:
    by default, there is no assumptions on the symmetries of the solution. If SymmetricForm is true, then each unique term in the general solution will be putted into a symmetrized form.\\Consider equation:\[ \frac{2}{3} \left( g_{cd} J_{b}{}^{bpq}+J_{dc}{}^{pq}+J_{cd}{}^{pq} \right)= \frac{1}{2} \left(d_{c}{}^{q} d_{d}{}^{p}+ d_{c}{}^{p} d_{d}{}^{q}\right) + 2\,g_{cd} g^{pq} \]By default its general solution contains a free parameter (C[0] in the following example):
    def eq = '''(2/3)*(J_{b}^{bpq}*g_{cd}+J_{dc}^{pq}+J_{cd}^{pq}) =
              (1/2)*(d_{c}^{q}*d_{d}^{p}+d_{c}^{p}*d_{d}^{q})
                                          +2*g_{cd}*g^{pq}'''.t
    
    def options = [Transformations: 'd^m_m = 4'.t,
                   ExternalSolver: [
                        Solver: 'Mathematica', 
                        Path: '/usr/local/bin']]
    
    def s = Reduce([eq], ['J_abcd'], options)
    println s
    
       > [[J_{abcd} = 
               (-C[0]+3/4)*g_{ac}*g_{bd}+C[0]*g_{ad}*g_{bc}+(3/8)*g_{ab}*g_{cd}]]
    
    If SymmetricForm is true then a unique symmetric solution will be found:
    def options = [Transformations: 'd^m_m = 4'.t,
                   SymmetricForm: [true],
                   ExternalSolver: [
                        Solver: 'Mathematica', 
                        Path: '/usr/local/bin']]
    
    def s = Reduce([eq], ['J_abcd'], options)
    println s
    

   > [[J_{abcd} = 
            (3/8)*(g_{ad}*g_{bc}+g_{ab}*g_{cd}+g_{ac}*g_{bd})]]

  • GeneratedParameters:
    Reduce introduces new parameters to represent the solution:
    println Reduce(['F_mn + F_nm + A_mn + A_nm= 0'], ['F_mn'])
    
       > [F_{mn} = C[0]*g_{mn}+C[1]*A_{mn}+C[2]*A_{nm},
               2*C[0] = 0, C[2]+C[1]+1 = 0, C[2]+C[1]+1 = 0]
    
    Use GeneratedParameters to control how the parameters are generated:

println Reduce(['F_mn + F_nm + A_mn + A_nm= 0'],
            ['F_mn'], [GeneratedParameters: { i -> "X$i" }])
   > [F_{mn} = X0*g_{mn}+X1*A_{mn}+X2*A_{nm},
            2*X0 = 0, X2+X1+1 = 0, X2+X1+1 = 0]

  • ExternalSolver:
    should be specified to solve the symbolic system produced by Reduce. External sover have several options:
    • Solver :(required) At the moment there are two supported external systems: Maple and Mathematica.
    • Path :(required) Path to directory that contains external solver executables.
    • KeepFreeParams : By default the most general solution will be returned, which can contain some free parameters. If KeepFreeParams set to false, then only one representative from each family of solutions will be taken.
    • TmpDir : Path to temporary directory where generated Maple (or Mathematica) files wil be putted.

See also