# Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

2,844 questions
Filter by
Sorted by
Tagged with
9answers
65k views

### Elegant operations on matrix rows and columns

Question The Mathematica tutorial has a section 'Basic Matrix Operations', describing operations like transpose, inverse and determinant. These operations all work on entire matrices. I am missing a ...
4answers
5k views

### Flatten command: matrix as second argument

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...
6answers
6k views

### Does Mathematica have advanced indexing?

I have two $M \times K$ arrays $L, T$ where I would like to set all the elements in $L$ to zero whenever the corresponding element of $T$ is greater than 15. The ...
4answers
10k views

### Why does MatrixForm affect calculations?

This is a really newbie question, but it has me confused. Why does this code work without // MatrixForm and doesn't work with ...
3answers
15k views

### How to form a block-diagonal matrix from a list of matrices?

For example, like this: I know Join works, but it is a bit troublesome for multiple matrices. I also tried DiagonalMatrix, but ...
6answers
3k views

### How to visualize/edit a big matrix as a table?

Is it possible to visualize/edit a big matrix as a table ? I often end up exporting/copying big tables to Excel for seeing them, but I would prefer to stay in Mathematica and have a similar view as in ...
5answers
8k views

### Fastest way to calculate matrix of pairwise distances

It is a very common problem that given a distance function $d(p_1,p_2)$ and a set of points pts, we need to construct a matrix ...
2answers
16k views

### How to enter matrices in block matrix format?

Example: I have a matrix $R = \left( \begin{array}{cc} A & \mathbf{t} \\ 0 & 1 \end{array} \right)$ where $A$ is 3-by-3 and $\mathbf{t}$ is 3 by 1. Or in Mathematica ...
5answers
20k views

### What is the most efficient way to add rows and columns to a matrix?

Say I have a matrix m and a vector v. ...
3answers
2k views

### Tiling a square

I wondered if there was a way to automate the process of finding a way to tile a tile into a square. The idea is to represent the tile with a matrix of $0$s for blank space and $1$s for filled spaces ...
2answers
2k views

2answers
824 views

### How to speed up RotationMatrix`?

I frequently run into the situation that I have to apply RotationMatrix to a huge bunch of 3D vectors and angles for numerical computations. On one hand, the syntax ...