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])+Ω13 (-2 ρ11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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] &)]
Eliminate
? $\endgroup$Eliminate
seems complicated it a lot rather than simplify it in this case. $\endgroup$