I want to plot Sum[E[i]]
verseus t
where E[i]
are the negative eigenvalues of the matrix:
M1 = {{5 t, 0, 0, t^2}, {0, -30 + t, 0, 0}, {0, 0, -30 + t, 0}, {t^2,
0, 0, 1 + 2 t}}
Plot[Evaluate[Eigenvalues[M1]], {t, 0, 10}, PlotLegends -> "Expressions"]
sumofnegativeeigenvalues = Total @ - Ramp @ - Eigenvalues[M1]
-2 Ramp[30 - t] - Ramp[1/2 (-1 - 7 t - Sqrt[1 - 6 t + 9 t^2 + 4 t^4])] - Ramp[1/2 (-1 - 7 t + Sqrt[1 - 6 t + 9 t^2 + 4 t^4])]
Plot[sumofnegativeeigenvalues, {t, 0, 10}, AxesOrigin -> {0, 0}]
Alternatively,
ClearAll[sumNegEigenVals]
sumNegEigenVals = Eigenvalues /* Minus /* Ramp /* Minus /* Total;
sumNegEigenVals @ M1 == sumofnegativeeigenvalues
True
@ -
means.
$\endgroup$