# Difference in using the MatrixExp of diagonalized and the non-diagonalized Matrix

I have a matrix and would like to calculate the exponential of it, using MatrixExp.
The problem I am facing is when I am using the non-diagonalized version of the matrix then I am coming across the error.

MatrixExp::eivn: Incorrect number 0 of eigenvectors for eigenvalue -1. Sqrt[0.00897287 E^(I k)+0.0180552 E^(2 I k)+0.00897287 E^(3 I k)] with multiplicity 1.


Here is the code.
It gives value for the diagonalized version but not for the non-diagonalized version(I suppose to use this, not diagonalized).

a = 1;
tI = 0.0001;
dt = 0.0001;
NStep = 3000;
T1[t_] = j1 (Cos[t]);

T2[t_] = j2;

cond = {j1 -> 0.9, j2 -> 1.};

HSm[t_] = ({{0, -(T1[t] + T2[t] Exp[I k])}, {-(T1[t] +
T2[t] Exp[-I k]), 0}}) //. cond;

nondiagonal = ParallelTable[(tI + j dt) * MatrixExp[HSm[tI + j dt]], {j, NStep, 0, -1}];

HStDig[t_] = MatrixExp[t *DiagonalMatrix[Eigenvalues[HSm[t]]]]

diagonal = ParallelTable[HStDig[tI + j dt], {j, 0, NStep}];

ResNonD = Apply[Dot, nondiagonal];
ResDiag = Apply[Dot, diagonal];


Is there a way to use the MatrixExp for non-diagonalized version without incurring this error?
k is a parameter(supposed) to be given value from a list of numbers.

Success:
(i) I got some good success after writing Exp[I k a] = Cos[ k a] + I Sin[k a] in HSm[t] definition, same for Exp[-I k a].(no Idea why it worked)
(ii) Some new problems.

Mathematica 11.1.0
Ubuntu 16.04

• Which version of Mathematica are you using? There were some strange bugs in mixing symbolic matrices and inexact numbers (see mathematica.stackexchange.com/q/127783/36788) that have been fixed in the latest version. – mikado Apr 7 '17 at 15:29
• It looks as if your definition is incomplete - HSm is defined with one argument but called with two – mikado Apr 7 '17 at 15:34
• @mikado I updated my question(latest version), it was a typo. Thanks – L.K. Apr 7 '17 at 16:10