4
$\begingroup$

I am trying to calculate the Hessenberg decomposition of a symbolic matrix

$$ A= \begin{pmatrix} 0 & -\mathrm ia & 0 & b \cos x \\ \mathrm ia & 0 & \mathrm ic \sin x & 0 \\ 0 & -\mathrm ic \sin x & 0 & -\mathrm ia \\ b \cos x & 0 & \mathrm ia & 0 \end{pmatrix}, $$

where $a,b,c,x$ are symbolic variables. Computing the Hessenberg decomposition for a numerical matrix A can be easily obtained using

{P, T} = HessenbergDecomposition[A];   

How can I obtain P and T for my symbolic matrix A?

$\endgroup$
  • $\begingroup$ Might consider instead using Eigensystem. $\endgroup$ – Daniel Lichtblau Mar 5 at 15:43
  • $\begingroup$ Eigensystem gives eigenvectors (full matrix) and eigenvalues (diagonal matrix) but not the Hessenberg form of my matrix. $\endgroup$ – Shasa Mar 6 at 7:44
  • $\begingroup$ Right, Eigensystem returns an eigensystem. But it can serve in similar use cases to a Hessenberg decomposition and moreover works for symbolic input. HessenbergDecomposition is strictly numeric. Another alternative might be JordanDecomposition by the way. $\endgroup$ – Daniel Lichtblau Mar 6 at 15:16
3
$\begingroup$

It is not overly difficult to write a simple (but inefficient) method for symbolically performing Hessenberg decomposition, based on repeated similarity transformations with Householder matrices. It is interesting to compare the routine for QR decomposition in this answer with the Hessenberg decomposition function given below:

hesdec[mat_?SquareMatrixQ] := Module[{h = mat, r, n, q, v, v2},
   n = Length[h]; q = IdentityMatrix[n];
   Do[v = PadLeft[h[[k + 1 ;;, k]], n];
      v2 = v - SparseArray[{k + 1 -> Norm[v]}, n];
      r = If[! TrueQ[Norm[v2, ∞] == 0], ReflectionMatrix[v2], IdentityMatrix[n]];
      q = q.r; h = r.h.r, {k, n - 2}];
   {q, h}]

Applied to your matrix,

{qq, hh} = hesdec[{{0, -I a, 0, b Cos[x]}, {I a, 0, I c Sin[x], 0},
                   {0, -I c Sin[x], 0, -I a}, {b Cos[x], 0, I a, 0}}];

one however obtains expressions of horrendous complexity:

LeafCount[hs = Simplify[ComplexExpand[hh, TargetFunctions -> {Re, Im}]]]
   3583

LeafCount[qs = Simplify[ComplexExpand[qq, TargetFunctions -> {Re, Im}]]]
   134

What to do with these matrices afterwards is up to you. But you might appreciate a little that writing functions like these so that expression swell is minimized is not trivial.

| improve this answer | |
$\endgroup$
  • $\begingroup$ This is what I was looking for. Thanks! $\endgroup$ – Shasa Mar 23 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.