Skip to main content
10 votes
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 ...
Roman's user avatar
  • 48.7k
7 votes

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. ...
Bob Hanlon's user avatar
  • 160k
5 votes

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: ...
Daniel Huber's user avatar
  • 53.6k
5 votes

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] ...
A. Kato's user avatar
  • 1,460
4 votes

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 ...
houzw's user avatar
  • 811
4 votes

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 ...
Michael E2's user avatar
  • 239k
4 votes

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 ...
zeraoulia rafik's user avatar
4 votes

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

Try Reduce ...
Ulrich Neumann's user avatar
4 votes
Accepted

Using Mathematica to perform matrix operations which depend on variables

You can use MatrixPower for exponentiation as: ...
Daniel Huber's user avatar
  • 53.6k
3 votes

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. ...
Daniel Lichtblau's user avatar
3 votes

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 ...
user64494's user avatar
  • 27.3k
3 votes
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 ...
A. Kato's user avatar
  • 1,460
2 votes

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 ...
E. Chan-López's user avatar
2 votes

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
eldo's user avatar
  • 81.3k
2 votes

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: ...
E. Chan-López's user avatar
2 votes

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) ...
eldo's user avatar
  • 81.3k
2 votes

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: ...
Willem Nielsen's user avatar
2 votes

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: ...
ubpdqn's user avatar
  • 62.8k
2 votes

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 ...
eldo's user avatar
  • 81.3k
2 votes

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 ...
eldo's user avatar
  • 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 ...
eldo's user avatar
  • 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: ...
E. Chan-López's user avatar
1 vote

Nonzero element positions of a matrix

m = {{1, 2, 0}, {4, 0, 9}}; Using Array and Cases : ...
E. Chan-López's user avatar
1 vote

Nonzero element positions of a matrix

Using SelectIndices by Taliesin Beynon SelectPositions = ResourceFunction["SelectIndices"]; ...
eldo's user avatar
  • 81.3k
1 vote

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

...
eldo's user avatar
  • 81.3k

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