3
$\begingroup$

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

$\endgroup$
10
  • $\begingroup$ The matrix exponential of your matrix can be computed by hand and gives you a matrix with Cosh and Sinh in its components. This might speed up the computation. $\endgroup$
    – user46676
    Commented Apr 6, 2017 at 19:39
  • $\begingroup$ @marmot I didn't get. $\endgroup$
    – L.K.
    Commented Apr 6, 2017 at 19:42
  • $\begingroup$ Try FullSimplify[MatrixExp[mat]] where mat={{0,a},{a,0}}. Your matrix is of this type. Another problem of your code is that you add the scalar tI to a matrix. $\endgroup$
    – user46676
    Commented Apr 6, 2017 at 19:48
  • $\begingroup$ @marmot I edited my question, thanks for the valuable points. Let me go through them $\endgroup$
    – L.K.
    Commented Apr 6, 2017 at 20:11
  • 1
    $\begingroup$ If you use HStDig[t_, k_] = FullSimplify[MatrixExp[HSm[t, k]]] your code works. $\endgroup$
    – user46676
    Commented Apr 6, 2017 at 20:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.