4
$\begingroup$

I have a $n \times n$ matrix $A$ with a full set of eigenvalues $\lambda$ including repetitions.

I want to create the following $i \times i$ matrix:

$$\left(\sum_{a=2}^i (a-1) |a-1⟩⟨a| \right) + \sum_{j=1}^i d_j \sum_{b=j}^i |b⟩⟨b-j+1| $$

where $|1⟩,...,|i⟩$ is the standard basis and $d_j (\lambda) = \sum_{c=1}^n \lambda_c^j$.

Any help with coding this matrix in Mathematica would be greatly appreciated.

$\endgroup$
  • $\begingroup$ You must give an explicit mathematical formula for $|b \rangle \langle b-j+1|$ and other terms. $\endgroup$ – David G. Stork Jun 16 at 15:45
  • $\begingroup$ @DavidG.Stork I added a missing definition and believe I have defined all the other terms. Please let me know if any definition is unclear. $\endgroup$ – jacobi16 Jun 16 at 15:56
  • $\begingroup$ The first term $\delta_{i,0}$ is a scalar, not a matrix, and does not fit into the formula. Does it mean that for $i=0$ you want to get the scalar 1 as the answer? $\endgroup$ – Roman Jun 16 at 16:43
  • $\begingroup$ Does $d_j(\lambda)$ depend on $j$ at all? $\endgroup$ – Roman Jun 16 at 17:13
  • $\begingroup$ @Roman Thanks for your comments. I had mistakenly written the superscript of $x$ as $q$ instead of $j$. $\delta_{i,0}$ would be the identity matrix when $i=0$, which makes this term irrelevant now that I think about it. Sorry for the mistake with the definition of $d_j$ and thanks for spotting out the unnecessary $\delta_{i,0}$ factor. I have edited my question to reflect these changes. $\endgroup$ – jacobi16 Jun 16 at 21:47
4
$\begingroup$

You can define the matrix with

M[1] = {{d[1]}};
M[i_Integer /; i >= 2] := SparseArray[{Band[{1, 2}] -> Range[i - 1],
                                       {a_, b_} /; a >= b -> d[a - b + 1]},
                                      {i, i}]

With the $d$-elements

λ = RandomReal[{0, 1}, 10];
d[j_] = Total[λ^j];

(replace the $\lambda$-vector by your eigenvalues).

M[5] // MatrixForm

enter image description here

$\endgroup$
6
$\begingroup$

You can also use a combination of ToeplitzMatrix, DiagonalMatrix, LowerTriangularize and SparseArray:

ClearAll[mat]
mat[n_] := Module[{dd = Array[d, n]}, 
  LowerTriangularize[ToeplitzMatrix[dd, SparseArray]] + 
   DiagonalMatrix[SparseArray@Range[n - 1], 1]]

mat[5] // MatrixForm // TeXForm

$\left( \begin{array}{ccccc} d(1) & 1 & 0 & 0 & 0 \\ d(2) & d(1) & 2 & 0 & 0 \\ d(3) & d(2) & d(1) & 3 & 0 \\ d(4) & d(3) & d(2) & d(1) & 4 \\ d(5) & d(4) & d(3) & d(2) & d(1) \\ \end{array} \right)$

$\endgroup$

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.