I have a very stupid question, but I don't use Mathematica very often, so here it goes:
I'm trying to solve some "matrix" ODE using NDSolveNDSolve
. The matrix in question is 2x2, with each element being a function of time. After using NDSolveNDSolve
, I obtain four interpolating functions corresponding to the four elements of the matrix. However, I'm having trouble figuring out how to extract and plot only one specific element of the matrix.
For instance, in the code snippet below, I'm getting the correct solution, but it plots the entire first row of the matrix instead of just the element at position (1,1):
ClearAll["Global`*"]
Clear[\[Rho]Clear[ρ, \[Rho]eeρee, \[Rho]egρeg, \[Rho]geρge, \[Rho]ggρgg, \[Alpha]α, \[CapitalGamma]cΓc, \[CapitalGamma]0Γ0, \[Sigma]plusσplus, \[Sigma]minus];σminus];
\[Rho][t_]
ρ[t_] = {{\[Rho]ee[t]ρee[t], \[Rho]eg[t]ρeg[t]}, {\[Rho]ge[t]ρge[t], \[Rho]gg[t]ρgg[t]}};
\[Sigma]plusσplus = {{0, 1}, {0, 0}};
\[Sigma]minusσminus = ConjugateTranspose[\[Sigma]plus];ConjugateTranspose[σplus];
\[Alpha]α = 5;
\[CapitalGamma]0Γ0 = 1;
\[CapitalGamma]cΓc := \[Alpha]*\[CapitalGamma]0;α*Γ0;
\[Rho]0ρ0 = {{1, 0}, {0, 0}};
sol = NDSolve[{\[Rho]'[t]ρ'[t] == ((\[CapitalGamma]cΓc + \[CapitalGamma]0Γ0)/2) (2*\[Sigma]minus2*σminus.\[Rho][t]ρ[t].\[Sigma]plusσplus -
\[Sigma]plus σplus.\[Sigma]minusσminus.\[Rho][t]ρ[t] - \[Rho][t]ρ[t].\[Sigma]plusσplus.\[Sigma]minusσminus), \[Rho][0]ρ[0] == \[Rho]0ρ0}, \[Rho][t]ρ[t], {t, 0, 1}];
Plot[Evaluate[{\[Rho]ee[t]ρee[t], \[Rho]eg[t]ρeg[t]}/.sol] ,{t,0,0.5}]
I've tried using the PartPart
function and referencing only [Rho]ee[t],ρee[t]
but without success. Any assistance would be greatly appreciated.
Thank you!