Tag Info

Hot answers tagged

5

TL;DR; myArrayFlatten = Flatten /@ Flatten[#, {{1, 3}}] & {x,y,z} or {{x},{y},{z}} is considered column vector. Usage example: v1 = {1, 2, 3}; vNew = {{4, 5}, {6, 7}, {8, 9}}; v4 = {10, 11, 12}; v5 = {13, 14, 15}; v6 = List /@ {16, 17, 18}; { {v1, vNew, v1}, {v4, v5, v6, v1}, {vNew, vNew} } // myArrayFlatten // MatrixForm Flatten ...


5

First a simpler way to get your first example: (m = ArrayFlatten[Transpose /@ {{v1, v2, v3}, {v4, v5, v6}}, 1]) // MatrixForm An alternative way to do @bill's undoing trick: (m2 = ArrayFlatten[Transpose /@ {{v1, ## & @@ Transpose[vNew]}, {v4, v5, v6}}, 1]) // MatrixForm Using ArrayReshape as an alternative to ArrayFlatten: ...


5

You could define it with Array[Subscript[a, Min[##], Max[##]] &, {4, 4}]


5

Okay, following the "bare bones" approach for dropping rows and columns here are a few ideas. Starting matrix: m = Array[Times, {5, 6}] $\left( \begin{array}{ccccc} 1 & 2 & 3 & 4 & 5 \\ 2 & 4 & 6 & 8 & 10 \\ 3 & 6 & 9 & 12 & 15 \\ 4 & 8 & 12 & 16 & 20 \\ \end{array} \right)$ Part ...


4

Using the built-in matrix manipulation commmands mat = Array[Subscript[a, ##] &, {4, 4}]; LowerTriangularize[mat] + Transpose[LowerTriangularize[mat]] - DiagonalMatrix[Diagonal[mat]] gives the same answer. This takes the lower triangular part and adds it to the transpose of itself, giving a symmetric matrix in which the diagonal entries have been ...


4

You can apply a rule using Condition: mat2 /. Subscript[a, i_, j_] :> Subscript[a, j, i] /; j > i giving $$\left( \begin{array}{cccc} a_{1,1} & a_{2,1} & a_{3,1} & a_{4,1} \\ a_{2,1} & a_{2,2} & a_{3,2} & a_{4,2} \\ a_{3,1} & a_{3,2} & a_{3,3} & a_{4,3} \\ a_{4,1} & a_{4,2} & a_{4,3} & a_{4,4} \\ ...


3

It depends on how PBS and the cluster environment are set up. Ideally, if cpuset support has been compiled in to PBS, and if you start Mathematica directly inside the PBS job, you should find that it uses all processors allocated by PBS (on that node--Eigensystem is not MPI-parallelized). If cpuset support isn't provided, then you risk starting as many ...


3

How about just breaking up the matrix and then reconstructing the same way. Here are your source vectors v1 = {1, 2, 3}; vNew = {{4, 5}, {6, 7}, {8, 9}}; v4 = {10, 11, 12}; v5 = {13, 14, 15}; v6 = {16, 17, 18}; So now define and reconstruct: {v2, v3} = Transpose[vNew]; ArrayFlatten[{Transpose@{v1, v2, v3}, Transpose@{v4, v5, v6}}, 1] // MatrixForm If ...


2

With a = {{0.1, 0}, {0, 0.1}}; b = {{2, 3}, {-3, 1}}; c = {{0.2, 0.6}, {0.2, 0}}; i = {{1, 0}, {0, 1}}; and s[t_] := {{s11[t], s12[t]}, {s21[t], s22[t]}} one can see that s12 and s21 don't depend on t by evaluating c + a*s[t + 1]*Inverse[i - b*s[t + 1]]*a Therefore I set s[11] = {{0, 0.6}, {0.2, 0}} Redefining s with s[t_] := s[t] = c + a*s[t ...


2

mat = Table[i^2 + i j + j^3, {i, 4}, {j, 4}] Det[Drop[mat, {#}, {#}]] & /@ Range[Length@mat] {-36, -288, -252, -24} Timings for random 100X100 real and integer matrices: tstmat = RandomReal[100, {100, 100}]; (res1 = Det[Drop[tstmat, {#}, {#}]] & /@ Range[Length@tstmat]); // AbsoluteTiming // First (* 0.156253 *) (res2 = Diagonal@Minors[tstmat]); ...


2

Seeing you asked about how to drop the first or last rows/columns, you can do that conveniently with Most and Rest: Most@m (* drops last row *) Most/@m (* drops last column *) Rest@m (* drops first row *) Rest/@m (* drops first column *)


2

A barebones example for the desired cropping is: m = Array[Subscript[a, ##] &, {4, 4}]; MatrixForm[m] $$\left( \begin{array}{cccc} a_{1,1} & a_{1,2} & a_{1,3} & a_{1,4} \\ a_{2,1} & a_{2,2} & a_{2,3} & a_{2,4} \\ a_{3,1} & a_{3,2} & a_{3,3} & a_{3,4} \\ a_{4,1} & a_{4,2} & a_{4,3} & a_{4,4} \\ ...


1

A = {{0.1, 0}, {0, 0.1}}; B = {{2, 3}, {-3, 1}}; c = {{0.2, 0.6}, {0.2, 0}}; d = {2, 3}; e = {1, 0}; i = {{1, 0}, {0, 1}}; g[11] = {0, 0}; g[t_] := A.S[t+1].Inverse[i-B.S[t+1]].(B.g[t+1]-d)+A.g[t+1]+e; p[11] = {0, 0}; p[t_] := S[t].X[t] - g[t]; S[11] = {{0, 0}, {0, 0}}; S[t_] := c + A.S[t + 1].Inverse[i - B*S[t + 1]].A ; X[1] = {1, 0}; X[t_] := Inverse[i - ...


1

a = {{a1, a2}, {a3, a4}}; b = {{b1, b2}, {b3, b4}}; c = {{c1, c2}, {c3, c4}}; s[11] = {{0, 0}, {0, 0}}; s[10] = c + a.s[11].Inverse[IdentityMatrix[2] - b.s[11]].a which immediately returns {{c1, c2}, {c3, c4}} Trying to use upper case characters, like C, for variable names results in errors. Trying to use "abstract" vectors and matricies results in ...


1

Try f[x_, y_] = Block[{x, y}, Assuming[x ∈ Reals && y ∈ Reals, Log[Det[V[x, y]\[ConjugateTranspose].V[x, y]]] /. e : Conjugate[EllipticTheta[a_, z_, q_]] :> EllipticTheta[a, Conjugate[z], q] // Simplify ] ]; Chop[N[Q[1, 1]]] (* 2.10739 *)



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