1
$\begingroup$

I have a set of equations that I want to simplify using a list of rules:

eqns={
I (ρ12'[t]+ρ21'[t])==ω1 (ρ12[t]-ρ21[t])+ω2 (-ρ12[t]+ρ21[t])+Ω23 (-ρ13[t]+ρ31[t])+Ω13 (-ρ23[t]+ρ32[t])+Ω24 (-ρ14[t]+ρ41[t])+Ω14 (-ρ24[t]+ρ42[t]),
I (ρ13'[t]+ρ31'[t])==Ω23 (-ρ12[t]+ρ21[t])+ω1 (ρ13[t]-ρ31[t])+ω3 (-ρ13[t]+ρ31[t])+Ω14 (-ρ34[t]+ρ43[t]),
I (ρ14'[t]+ρ41'[t])==Ω24 (-ρ12[t]+ρ21[t])+ω1 (ρ14[t]-ρ41[t])+ω4 (-ρ14[t]+ρ41[t])+Ω13 (ρ34[t]-ρ43[t]),
I (ρ23'[t]+ρ32'[t])==Ω13 (ρ12[t]-ρ21[t])+ω2 (ρ23[t]-ρ32[t])+ω3 (-ρ23[t]+ρ32[t])+Ω24 (-ρ34[t]+ρ43[t]),
I (ρ24'[t]+ρ42'[t])==Ω14 (ρ12[t]-ρ21[t])+ω2 (ρ24[t]-ρ42[t])+ω4 (-ρ24[t]+ρ42[t])+Ω23 (ρ34[t]-ρ43[t]),
I (ρ34'[t]+ρ43'[t])==Ω14 (ρ13[t]-ρ31[t])+Ω24 (ρ23[t]-ρ32[t])+Ω13 (ρ14[t]-ρ41[t])+Ω23 (ρ24[t]-ρ42[t])+ω3 (ρ34[t]-ρ43[t])+ω4 (-ρ34[t]+ρ43[t]),
I ρ12'[t]-I ρ21'[t]==ω2 (-ρ12[t]-ρ21[t])+ω1 (ρ12[t]+ρ21[t])+Ω23 (-ρ13[t]-ρ31[t])+Ω13 (ρ23[t]+ρ32[t])+Ω24 (-ρ14[t]-ρ41[t])+Ω14 (ρ24[t]+ρ42[t]),
I ρ13'[t]-I ρ31'[t]==Ω23 (-ρ12[t]-ρ21[t])+ω3 (-ρ13[t]-ρ31[t])+ω1 (ρ13[t]+ρ31[t])+Ω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ρ34[t]+ρ43[t]->k6[t],ρ12[t]-ρ21[t]->k7[t],ρ13[t]-ρ31[t]->k8[t],ρ14[t]-ρ41[t]->k9[t],ρ23[t]-ρ32[t]->k10[t],ρ24[t]-ρ42[t]->k11[t],ρ34[t]-ρ43[t]->k12[t],-ρ11[t]+ρ22[t]->k13[t],-ρ22[t]+ρ33[t]->k14[t],-ρ22[t]+ρ44[t]->k15[t],ρ33[t]-ρ11[t]->k13[t]+k14[t],ρ44[t]-ρ11[t]->k13[t]+k15[t]}

and its derivative D[rules,t].

I want to simplify the eqns so that it is free of ρ variables.

I tried something like this but not work

ρls = 
 Flatten@Table[
   ToExpression["ρ" <> ToString[i] <> ToString[j] <> "[t]"], {i, 
    1, 4}, {j, 1, 4}];
trans[expr_] := expr /. rules /. D[rules, t]
Simplify[eqns, 
 TransformationFunctions -> {Automatic, trans}, 
 ComplexityFunction -> (LeafCount[#1] + 
     If[And @@ Table[FreeQ[#, x], {x, ρls}], 0, 10^3] &)]
$\endgroup$
2
  • $\begingroup$ Why not try Eliminate? $\endgroup$ Commented Jul 14, 2013 at 2:19
  • $\begingroup$ Eliminate seems complicated it a lot rather than simplify it in this case. $\endgroup$ Commented Jul 14, 2013 at 2:34

1 Answer 1

1
$\begingroup$

Help others would come up with a more canonic solution, but here is one (brute force) way:

First construct rules that covers both shapes like a-b->c and -a+b->-c

rules1 = rules /. Rule[x_, y_] :> Rule[-x, -y]; 
totRules = Join[rules, rules1, D[rules, t], D[rules1, t]];

then transfer equations to lists to avoid simplify moving terms across the == sign.

transCoff = Transpose[eqns /. x_ == y_ :> {x, y}];

Define a function that simplify each sub-expression, especially to transform terms like a(b*c-b*d) to a*b*(c-d)

mysimplify[expr_] := 
 Module[{expr1 = 
    Collect[expr, {\[Omega]1, \[Omega]2, \[Omega]3, \[Omega]4, \
\[CapitalOmega]13, \[CapitalOmega]14, \[CapitalOmega]23, \
\[CapitalOmega]24, I }, Simplify]},
  Head[expr1] @@ Simplify /@ List @@ expr1
  ]

replace the rules

Apply[Equal, 
 Transpose@
  Map[Collect[#, ToExpression@Table["k" <> ToString@i, {i, 1, 15}], 
     Simplify] &, 
   Map[mysimplify, 
     Simplify[(Collect[#, {\[Omega]1, \[Omega]2, \[Omega]3, \
\[Omega]4, \[CapitalOmega]13, \[CapitalOmega]14, \[CapitalOmega]23, \
\[CapitalOmega]24, I }, Simplify] & /@ transCoff) /. 
       totRules], {2}] /. totRules, {2}], {1}]

and get the result free of rho**

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.