# Tag Info

Accepted

### Is it possible for Mathematica to output the name of a matrix as opposed to its matrix form?

You can decompose any Hermitian 2×2 matrix $A$ into a sum over Pauli matrices, $$A=c_1\mathbb{1}+c_x\sigma_x+c_y\sigma_y+c_z\sigma_z$$ and the coefficients $(c_1,c_x,c_y,c_z)$ can be computed by the ...
• 48.7k

### Is it possible for Mathematica to output the name of a matrix as opposed to its matrix form?

This is a partial answer addressing only the first example given. If you Set the value of a symbol, the symbol can never appear in the output, only its value. ...
• 160k

### Is it possible for Mathematica to output the name of a matrix as opposed to its matrix form?

To print some name instead of an object may be achieved by \$PrePrint. E.g. your example: ...
• 53.6k

### How to ask Mathematica to find the nontrivial (nonzero) solution of a homogeneous system of equations?

The answer will depend how the determinant vanishes: mat = {{a, b, 0}, {c, d, e}, {0, f, g}}; Det[mat] (* -a e f - b c g + a d g *) cases = Solve[% == 0] ...
• 1,460

### Why does Mathematica consider (0, 0, 0) as an eigenvector?

In fact, the documentation for Eignvectors has already addressed this question. For an n×n matrix, Eigenvectors always returns ...
• 811

### Is it possible for Mathematica to output the name of a matrix as opposed to its matrix form?

My original idea was to use MakeBoxes[] to accomplish the formatting of the OP's example: You can, in fact, have Mathematica output a certain variable name when ...
• 239k

### Fitting Eigenvalues of a 8*8 matrix to experimental data

You may fit the eigenvalues of an 8x8 parameterized matrix to your experimental data by defining a function that computes the eigenvalues based on given parameter values. Then, define a cost function ...
• 1,049

Try Reduce ...
• 54.9k
Accepted

### Using Mathematica to perform matrix operations which depend on variables

You can use MatrixPower for exponentiation as: ...
• 53.6k

### Fitting Eigenvalues of a 8*8 matrix to experimental data

Here is an artificial example, where we have a given set of eigenvalues and want to fit the matrix parameters to obtain eigenvalues as close to the set as possible. ...
• 59.6k

### Why does Mathematica consider (0, 0, 0) as an eigenvector?

Let us look in the documentation (Details and Options) to Eigenvectors For an nxn matrix, Eigenvectors always returns a list of ...
• 27.3k
Accepted

### Find the diagonalizing matrix for a general 2*2 real valued symmetric matrix

Since the size of this matrix is 2x2, some elementary facts from linear algebra will help you a lot. I assume the matrix is real. Since it is symmetric, its eigenvalues, mm and mp, are real. Let me ...
• 1,460

### How to add rows to a matrix to achieve a given order?

Grabbing the @eldo's matrix: mat = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16}}; We can use ArrayPad as ...
• 27.7k

### How to add rows to a matrix to achieve a given order?

c = 4; r = 3; mat = Partition[Range[4 c], c]; Join[mat, Array[a &, {r, n}]] // MatrixForm
• 81.3k

### Canonical way to map a function to diagonal elements of a square matrix?

A = {{E, 0, 0}, {0, E, 0}, {0, 0, E}}; Using SubsetMap: ...
• 27.7k

### Help with sum specific elements of a matrix in mathematica

list = {{1, 2, 3, 3}, {4, 5, 6, 6}, {7, 8, 9, 9}, {1, 5, 9, 7}}; p = {{2, 1}, {4, 3}}; Using MapApply (new in 13.1) ...
• 81.3k

### How to measure the degree of concentration for a matrix

I ran into a similar problem and was able to solve it using variance. So one way would be to just take the variance across the columns and the rows: ...

### Function to replace values of elements of matrix with 0 unless the value is -1

For something different (an example that can be generalized): The test matrix: mat = RandomInteger[{-4, 4}, {10, 6}]; The approach: ...
• 62.8k

### Function to replace values of elements of matrix with 0 unless the value is -1

SeedRandom[1]; m = RandomInteger[{-3, 3}, {4, 7}]; Using MapIf by Taliesin Beynon ...
• 81.3k

### Replace a column/row of a matrix under a condition by a random number

m = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; Using Cases ...
• 81.3k
1 vote

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

mat = ArrayPad[{{1, 2, 3}, {0, 0, 0}, {7, 8, 0}}, {{1, 2}, {2, 3}}]; mat Using ArrayCrop by Ed Pegg Jr ...
• 81.3k
1 vote

### Function to replace values of elements of matrix with 0 unless the value is -1

SeedRandom[1]; m = RandomInteger[{-3, 3}, {4, 7}]; Using SubsetMap: ...
• 27.7k
1 vote

### Nonzero element positions of a matrix

m = {{1, 2, 0}, {4, 0, 9}}; Using Array and Cases : ...
• 27.7k
1 vote

### Nonzero element positions of a matrix

Using SelectIndices by Taliesin Beynon SelectPositions = ResourceFunction["SelectIndices"]; ...
• 81.3k
1 vote

### How to compare and remove x-coordinates (and the associated y-coordinates) that are less than previous x-coordinates?

...
• 81.3k

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