This is in continuation with this one but it is more general. I will try to make it self contained.
I have a program and I need to take the Dot
product of many matrices. But while taking the MatrixExp
, I am facing the numeric problem(which I am familiar with, unfortunately don't know how to go out of it). However, I come up with one technique(not good at all).
MatrixExp::eivn: Incorrect number 0 of eigenvectors for eigenvalue -1. Sqrt[1.405 E^(2 I k)+0.9 E^(I k) Cos[t]+0.9 E^(3 I k) Cos[t]+0.405 E^(2 I k) Cos[2. t]] with multiplicity 1.
This is my program,
a = 1;
tI = 0.0001;
dt = 0.0001;
NStep=30000;
T1[t_] = j1 (Cos[t]);
T2[t_] = j2 ;
cond = {j1 -> 0.9, j2 -> 1.};
HSm[t_,k_] = ({{0, -(T1[t] + T2[t] Cos[k])}, {-(T1[t] + T2[t] Cos[k]),0}})//. cond;
HStDig[t_, k_Real] = MatrixExp[HSm[t,k]]
us = ParallelTable[(tI + j dt) * HStDig[tI + j dt,k], {j, NStep, 0, -1}];
us1 = Apply[Dot, us];
How to go about this problem? Is there a way to speed up the program?
Note:
Diagonalization can't be taken for the matrix!
k
is supposed to be given value from a list of numbers
Cosh
andSinh
in its components. This might speed up the computation. $\endgroup$FullSimplify[MatrixExp[mat]]
wheremat={{0,a},{a,0}}
. Your matrix is of this type. Another problem of your code is that you add the scalartI
to a matrix. $\endgroup$HStDig[t_, k_] = FullSimplify[MatrixExp[HSm[t, k]]]
your code works. $\endgroup$