Tag Info

Hot answers tagged

4

One way is shown below. Alternatives include using Simplify with Assumptions, again on testing that the eigenvalues are nonnegative. Resolve[ ForAll[p, 0 <= p <= 2, And @@ Thread[ Eigenvalues[{{1, 0, 0, Sqrt[1 - p]}, {0, 0, 0, 0}, {0, 0, p, 0}, {Sqrt[1 - p], 0, 0, 1 - p}}] >= 0]]] (* Out[9]= True *)


4

Here's a simple way to enumerate all the conditions: fs = {x, y, z, 0}; conds = Table[{Equal @@ fs1, And @@ Table[First@fs1 >= f, {f, Complement[fs, fs1]}]}, {fs1, Subsets[fs, {2}]}] (* {{x == y, x >= 0 && x >= z}, {x == z, x >= 0 && x >= y}, {x == 0, x >= y && x >= z}, {y == ...


3

Small example on 5x5 matrix: pp = Table[p[i, j], {i, 5}, {j, 5}] One way: pp[[#, #]] &@Insert[Rest@Range[5], 1, -2] Or another: pp[[;; 4, ;; 4]] = RotateLeft[pp[[;; 4, ;; 4]], {1, 1}];


2

I have toyed with code (notice that I use only first solution for Replace). eqs = {S Mex'[ t] == ω e Mey[t] + λ ω e Mny[ t] - Γ R e Mex[t], S Mey'[t] == -ω e Mex[t] - λ ω e Mnx[ t] - Γ R e Mey[t], Mnx'[t] == λ ω n Mey[t] + ω n Mny[ t] - Γ Rnt Mnx[t], Mny'[t] == -λ ω n Mex[t] - ω n Mnx[ t] - Γ Rnt Mny[t], Mex[0] ...


1

Any square matrix can be put into Jordan normal form via a similarity transformation; and for a matrix in Jordan normal form, the geometric and algebraic multiplicities of the eigenvalues are determined by its block structure. So you could take the following approach: generate a Jordan matrix with the appropriate multiplicities, and then perform a random ...


1

I'm a bit late coming in here with this, but let there be a different approach anyway. It so happens, that the permutation you describe is simply Cycles[{Range@20}]: Permute[Range@21,Cycles[{Range@20}]] (* {20, 1, 2, ..., 19, 21} *) With mat = Table[p[i,j],{i,0,20},{j,0,20}] You can try this: Transpose@ MapAt[Permute[#, Cycles[{Range@20}]] &, ...


1

I think LUDecomposition should be able to do this. Using code from help in Mathematica docs: a = {{1, 2, 3}, {2, 3, 4}, {-1, 0, 2}}; {lu, p, c} = LUDecomposition[a] (u = lu SparseArray[{i_, j_} /; j >= i -> 1, {3, 3}]) // MatrixForm If you want all pivots to be +1, this can now be easily done. d = Position[Diagonal[u], -1] (u[[First@#]] = ...



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