g = 0.9;
H = {{g, I}, {I, -g}};
G = MatrixExp[t*H];
Plot[Norm[G], {t, 0, 20}, AspectRatio -> 1]
FindMaxValue[Norm[G], {t, 1}]
The matrix has a parameter t. Then the norm of G is a function of t, and the Norm[G]-t is plotted above. Then I want to find the maximum of Norm[G] by
FindMaxValue[Norm[G], {t, 1}]
However, there are errors:
Max::nord: Invalid comparison with 0.454874 +2.44073*10^-16 I attempted. >>
Max::nord: Invalid comparison with 2.19841 +2.52506*10^-16 I attempted. >>
FindMaxValue::nrnum: The function value -1. Max[0.454874 +2.44073*10^-16I,2.19841 +2.52506*10^-16 I] is not a real number at {t} = {1.}. >>
It seems that the reason is when t=1, the Norm[G] is calculated based on the maximum of singular values of G. And the two singular values are 0.454874 +2.44073*10^-16I and 2.19841 +2.52506*10^-16 I, which can not be compared. In fact, these two singular values should be real numbers(as shwon have tiny imaginary part).
And why there is no this error in Plot function?
My question is how to edit the code to find the maximum of Norm[G] here.
fn[t_?NumericQ] := Norm[MatrixExp[t {{0.9, I}, {I, -0.9}}]]; FindMaxValue[fn[t], {t, 1}]
should work. See this. $\endgroup$