# Tag Info

### Taxicab Geometry

Mathematica has a large set of graph functions. Here's a 10-by-10 graph of labeled nodes. We can use the graph to find every path that has a length of 9 between two nodes, and to display the paths. <...
• 5,215

### Visualizing diagrams needed to compute $\operatorname{Tr}(A^3 (A^T)^3)$

Explanation why some graphs appear more than ones: It depends on the number of possible paths - some graphs have only one possibility, the graph below has four. Functions definitions: I borrowed <...
• 16.9k

### Why is Mathematica not simplifying eigenvalues?

The trick is to move the exp inside the sqrt and use the double angle trig rule. A = {{x*Exp[I*y], z}, {z, x*Exp[(-I)*y]}} {v1, v2} = Eigenvalues[A] ...
• 144k

### Taxicab Geometry

Certainly a very wasteful method to generate all possible maths, but it's a start: ...

### Taxicab Geometry

Let's start with an abstraction: routes = Permutations[{up, up, up, up, right, right, right, right, right}]; We now have 126 paths to get from {2,5} to {7,9} by ...
• 28.1k

### Element-wise vector-matrix exponentiation

Times @@@ Map[x^# &, A] {x1, x1 x2, x2}
• 70k
Accepted

### Fill a matrix with randomly placed elements that are a certain distance apart

If you really want to sample randomly (and uniformly), I believe you should first construct the set of all possible rows (or ensure the uniformness in some other way). Here is an approach using ...
• 24.9k

### Computing log-determinant?

The determinant of a matrix may be outside the usual 64-bit floating point range, even if the log determinant isn't. Hence using Log[Det[...]] to compute the log ...
• 101

### Why is Mathematica not simplifying eigenvalues?

Eigenvalues[{{x*Exp[I*y], z}, {z, x*Exp[(-I)*y]}} // ComplexExpand]//FullSimplify ...
• 26.4k

### Element-wise vector-matrix exponentiation

Inner[ReverseApplied[Power], A, x, Times] (* {x1, x1 x2, x2} *)
• 18.2k

### Element-wise vector-matrix exponentiation

You can do it directly: Times @@ (x^Transpose@A) (* {x1, x1 x2, x2} *)
• 23.5k

### Visualizing diagrams needed to compute $\operatorname{Tr}(A^3 (A^T)^3)$

Here is a very very stupid, naive and brute-force approach. Unfortunately, I don't know how to control the position of graph edges, so the graphs are not as pretty as the ones you have. ...
• 24.9k

...
• 54k

### Fill a matrix with randomly placed elements that are a certain distance apart

Using a RelationGraph projection: ...
• 3,471

### Element-wise vector-matrix exponentiation

x = {x1, x2}; A = {{1, 0}, {1, 1}, {0, 1}}; Using Table: ...
• 23.9k

### Element-wise vector-matrix exponentiation

x = {x1, x2}; A = {{1, 0}, {1, 1}, {0, 1}} Pick[x, #, 1] & /@ A // Map[Apply[Times]] {x1, x1 x2, x2}
• 54k

### How to concatenate an array of matrices?

a = IdentityMatrix[2]; b = 2 * IdentityMatrix[2]; MapThread[Join, {a, b}] {{1, 0, 2, 0}, {0, 1, 0, 2}}
• 70k

### How do I flatten a matrix of lists while maintaining the structure of the list?

matrix = {{{a, b, c}, {e, f, g}}, {{h, i, j}, {k, l, m}}}; Using ArrayRules and GatherBy: <...
• 23.9k

### How do I flatten a matrix of lists while maintaining the structure of the list?

matrix = {{{a, b, c}, {e, f, g}}, {{h, i, j}, {k, l, m}}}; A variant of bmf's 2nd answer using MapApply (new in 13.1) ...
• 70k

### Finite Differences:

We can use Difference[#,n] to get n order difference. Flatten[#,{{2},{1}}] can be use to ...
• 72.9k

### Finite Differences:

The sole purpose of this post is to illustrate DifferenceDelta (and DiscretePlot): in-built function(s) for discrete calculus ...
• 60.8k

### Using DeleteCases to delete vectors with particular index as 0

list = {{0, 1, 1, 0, 1}, {1, 0, 1, 1, 1}, {1, 1, 1, 1, 0}, {1, 0, 0, 1, 0}}; Pre-define pattern for better readability ...
• 70k

### Extract left-upper triangular data from a square matrix-form list

m = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}}; Another way using Reap and ...
• 23.9k

### Split matrix by all-zero columns

mat = {{0, 0, 0, 0, 0, 1}, {1, 0, 0, 1, 0, 1}, {0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1}, {1, 1, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 1}}; Using ...
• 70k

### Prepend 0 to sublists

list = {{7, 4, 9, 9, 7}, {4, 2, 5, 5, 2}, {6, 5, 9, 2, 4}, {1, 9, 4, 7, 2}}; Using the operator-form of Insert ...
• 70k

### Matrix crop (remove leading and trailing zeroes in matrix)

mat = ArrayPad[{{1, 2, 3}, {0, 0, 0}, {7, 8, 0}}, {{1, 2}, {2, 3}}]; Using SequenceSplit: ...
• 23.9k

### How to replace anti diagonal elements of a matrix

m = {{100, 9, 3, 8, 0}, {4, 200, 6, 4, 9}, {5, 2, 300, 7, 8}, {7, 9, 6, 400, 5}, {6, 1, 4, 2, 500}}; ...
• 70k

### How do I flatten a matrix of lists while maintaining the structure of the list?

Plus @@ ArrayFlatten[matrix, 1] (* {a + e + h + k, b + f + i + l, c + g + j + m} *)
• 18.2k
1 vote

...
• 158k
1 vote

### Visualizing diagrams needed to compute $\operatorname{Tr}(A^3 (A^T)^3)$

This just an extended comment. When $d=3$ $A$ is a $n \times n$ array of independent unit Gaussian random variables, the trace of $A^d (A^T)^d$ is the sum of products of the form A_{i_1,j_1}A_{i_2,...
• 41.7k

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