Hot answers tagged

6

yourlist = {a, b, c}; mat = ReplacePart[Outer[Times, #, #]&@Prepend[yourlist, 1], {1, 1} -> state] Change yourlist to the list of your interest. Or, taking @mikado 's idea of symbolically diagonalizing: matfunc[1, 1] = state; matfunc[1, a_Integer] := yourlist[[a - 1]]; matfunc[a_Integer, 1] := yourlist[[a - 1]]; matfunc[a_Integer, b_Integer] := ...


4

Set your matrix and take the eigensystem: a = {{5, 0.1, 0.1}, {2, 60, 1}, {1, 0, 9}}; {eigVal, eigVec} = Eigensystem[a]; Find the max values in each eigenvector, and find their positions in order: maxes = Max /@ Abs[eigVec]; ord = Flatten@Table[Position[Abs[eigVec[[i]]], maxes[[i]]], {i, Length[eigVal]}] {2, 3, 1} Then use the ordering to permute the ...


3

With Times: avec = Array[a, 4]; m = Outer[Times, avec, avec] /. {a[1] -> 1}; m[[1, 1]] = s; MatrixForm[m] Eigenvalues[m] Here a[2] is your a, a[3] is your b, etc. Change the 4 to 900 if you wish. There are two nonzero eigenvalues.


1

This gives you the entries for such a matrix: mat = {{a, b}, {c, d}}; SolveAlways[CharacteristicPolynomial[mat, λ] == (λ - α) (λ - β), λ] However, it is probably preferable to choose mat such that it has only as many unknowns as the matrix dimension.


1

Timing results in Mathematica 10.1.0 under Windows 7 x64: {0.0660777, Null} {0.0303608, Null} {0.190943, Null} {1.46382, Null} {1.41635, Null} {0.183233, Null} So I confirm MatrixExp[s1, v] and MatrixExp[s1, v, Method -> "Krylov"] as being slower on my system. ( Use this Community Wiki to share any other timing results of interest. )


1

Sort[MapThread[{First@Ordering[-Abs[#2], 1], #1} &, Eigensystem[A]]][[All, 2]] {4.97199, 60.0037, 9.02434}


1

Use RandomComplex[{-1 + -r*I, 1 + r*I}, {n^2, n^2}] instead of Table, generate a random n*n matrix is much faster than generate a random number n^2 times. MatrixExp[mat, v] equal to MatrixExp[mat].v, and MatrixExp[mat] will be use for many times. So you can store it to avoid repeating calculation. (because of the floating error, the result of MatrixExp[...


1

The matrix desired is at most rank two and can be easily expressed as the product of a matrix and its transpose. I will number the elements for convenience and assume that state > 1 (otherwise we have imaginary elements, which would require further thought). n = 3; v1 = Prepend[Array[a, n], 1]; v2 = Prepend[Array[0 &, n], Sqrt[state - 1]]; M1 = ...


1

You might want to consider giving an appropriate second argument (inner product function) to Orthogonalize. For example, In[66]:= vs2 = Orthogonalize[{x1, x2}, Dot[##]*Norm[#] &, Method -> "GramSchmidt"] Out[66]= {{1/2^(3/4), 1/2^(3/4), 0}, {-(1/3^(3/4)), 1/3^(3/4), 1/3^(3/4)}} In[67]:= Outer[Dot, vs2, vs2, 1] Out[67]= {{1/Sqrt[2], 0}, {0, 1/Sqrt[...



Only top voted, non community-wiki answers of a minimum length are eligible