Hot answers tagged linear-algebra
7
I verified that Mathematica returns the correct set of eigenvalues and eigenvectors for this matrix by comparing them to MATLAB's output. I'll show how to do the comparison, as this might help reveal mistakes in your own comparison, if there were any.
(Note that if there are degenerate eigenvalues, then the eigenvectors are not unique, so there may be ...
5
Update
I got a MatrixRank of 4 with the original approximate data, but with the updated exact data, the rank is 3.
The basic idea is that Orthogonalize will return an orthonormal basis for the subspace spanned by the vectors, along with some zero vectors interspersed. (Orthonormal means unit length vectors that are pairwise perpendicular.) Deleting the ...
5
Not too hard; all that's needed is a simple application of matrix identities:
ColumnHermiteDecomposition[mat_ /; MatrixQ[mat, IntegerQ]] :=
Transpose /@ HermiteDecomposition[Transpose[mat]]
Test:
mat = {{1, 2, 3, 2, 2}, {1, 2, 3, 4, 0}, {0, 5, 4, 2, 1}, {3, 2, 4, 0, 2}};
{u, t} = ColumnHermiteDecomposition[mat];
u
{{8, 24, 22, ...
5
StateSpaceModel will linearize the equations. The system is nonlinear. So let's look at the nonlinear solution first.
The parameters:
a1 = {{-3, 2}, {-0.25, 1}};
a2 = {{-1.9, -0.4}, {-2.24, -4.7}};
b1 = {{0.25}, {1}};
b2 = {{-2.5}, {1}};
c = {{1, 0.5}, {0, 1}};
Subscript[ρ, 1] = (1 - Tanh[Subscript[x, 1][t]])/2;
Subscript[ρ, 2] = 1 - Subscript[ρ, 1];
Set ...
5
Well, you certainly can if you have version 9 and don't mind using the (quite verbose) tensor notation:
Assuming[
{b ∈ Complexes, (x | y) ∈ Matrices[{n, n}]},
TensorReduce@
TensorContract[
b TensorContract[TensorProduct[x, y, y], {{2, 3}, {4, 5}}] +
b TensorContract[TensorProduct[y, x, y], {{2, 3}, {4, 5}}],
{{1, 2}}
]
]
(* -> 2 b ...
4
Yes, you can simplify the trace this way. First, Tr[x.y.z] is invariant under cyclic permutations, so Tr[x.y.z] = Tr[y.z.x] = Tr[z.x.y], as described in Wikipedia's entry on trace of a product. For the case of interest, this means Tr[y.x.y] is equal to Tr[x.y.y]. Hence
Tr[b x.y.y + b y.x.y] = Tr[b x.y.y] + Tr[b y.x.y]
= b Tr[x.y.y] + ...
4
I verified that for your matrix (which I name m) holds:
m.ev = λ ev or m.ev - λ ev = 0:
(es[[1, #]] es[[2, #]] - m.es[[2, #]]) & /@ Range[Length@es[[1]]] // Chop
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0}, << >> {0, 0, 0, 0, 0, 0, 0, 0, 0, ...
2
Since I'm being credited with the method (which I do appreciate), let me point out that your use of Block is being needlessly complicated with Hold and ReleaseHold. The same behavior can be had with:
Block[{PauliMatrix}, Cross[s, {1, 2, 3}]]
{{{-2, -3 I}, {3 I, 2}}, {{1, -3}, {-3, -1}}, {{0, 2 + I}, {2 - I, 0}}}
We can make the Unevaluated method, ...
2
Directly define a cross function should be the easiest.
cross3[{x_, y_, z_}, {a_, b_, c_}] := {c y - b z, -c x + a z, b x - a y}
then no matter
cross3[PauliMatrix[Range[3]],{1,2,3}]
or
cross3[{1,2,3},PauliMatrix[Range[3]]]
will be OK. No ordering problem in Jens' LeviCivitaTensor method.
Only top voted, non community-wiki answers of a minimum length are eligible


