# Tagged Questions

Questions on the manipulation of matrices in Mathematica.

78 views

### Plotting eigenvalues smoothly

I am trying to plot how the eigenvalues of a matrix change by changing a given a parameter t. Of course the ordering of the eigenvalues does not matter mathematically but it does when I want to make ...
61 views

### Creating a transformation matrix with respect to given bases? [closed]

Let's say I have a linear transformation $T:V\to W$, along with some bases $\{v_1,v_2\}$ and $\{w_1,w_2,w_3\}$ of each respectively. Let's say all the information I have about the transformation and ...
53 views

### Efficiently Invert a Square, Block Diagonal Matrix

I am generating an n x n matrix where n is specified by DIM: ...
51 views

### Extending matrix (x,y-axis + data) via Interpolation. Looking for elegant & efficient way to write

Please, feel free to edit the title, if necessary. Hi, this is my code working, but actually, the size of my real dataset is 100x100. So, this is very inefficient way. What would be the most ...
141 views

### How can I assign matrix values in below form? [closed]

I want to create matrix as the below fig. shows. How can I do it with a do-loop, for-loop, if-loop, or any other way? Thanks a lot...
77 views

### Replacing negative components of a matrix with zeros [closed]

How can I replace the negative components of a matrix with zeros?
23 views

### Finding the percent difference between elements of a matrix and a list/vector [duplicate]

I have a large matrix of 24 columns, 11 rows, and a vector in the form of a one column, 11 row table. What would be the best method of finding the percent difference between each element of the matrix ...
141 views

### Non-rectangular pick of elements of a matrix

How to pick elements of a matrix that are inside a circle centered at the center of the matrix?
130 views

62 views

### Creating a tensor from matrices

I have 3 nxn matrices that I'd like to combine into a nxnx3 tensor. Basically, I want a new nxn matrix where each element is a 3 tuple of the elements of the other 3 matrices at that same position. ...
104 views

### Matrix Diagonalization programming

I have a very simple problem, with me misunderstanding the use of Modules and Functions in general, in mathematica. I have a function of which I want to input a Matrix, and in the function I want ...
134 views

### Summing matrix products

I need to compute a double sum over a weighted matrix product: $L[M]=\sum_{i,j}^{N}\Lambda[[i]]\;\omega[[i]].M.\omega^{\dagger}[[j]]$. $\Lambda$ is a list of with N complex values(weights) and ...
78 views

### How to Extract and Rearrange Elements in Doubly-Nested Lists

Hopefully any easy problem for you guys to help me with! I'm currently having an issue with writing some Mathematica code that will extract the each nth element in each array within a matrix, and then ...
453 views

69 views

### How to convert a matrix into a sparse matrix [duplicate]

If I have a matrix: row 1)1 0 0 4 row 2)0 0 0 0 row 3)5 1 0 0 row 4)0 5 0 0 row 5)0 0 0 9 How would I put it in a sparse matrix format: ...
86 views

### A few tuples at a time?

I want to generate $n$ by $n$ binary arrays, and then reduce the output from those arrays by performing a number of permutations and eliminating duplicates. The problem is that the number of arrays ...
242 views

### Speed-up the computation of this sum of small matrices

Given a matrix mat with a large number of rows (a few thousands) and a few columns (between 2 and 10), I'd like to compute the sum of the "small" matrices obtained ...
44 views

### Problem with stress transformation using InputField [duplicate]

I want to write a code for application of the transformation matrix onto a second-order stress tensor. I have a problem with showing the results. My steps are as follows: 1) I create a Grid with ...
46 views

### Singular matrices with index 1 [closed]

If $A\in \mathbb{R}^{n\times n}$, the index of $A$ is the smallest integer $k$ such that $rank(A^{k+1})==rank(A^k)$ I want to find a singular (id est $\det(A) == 0$) and non symmetric matrix $A$ ...
52 views

### Importing data, then plotting ListPlot. What's the most efficient way to write a code?

It should be a boring question to ask for someone, but this is very basic need which I haven't resolved by myself. I know I can use MapThread and pure function to make it short and beautiful, but even ...
408 views

### Given a large binary matrix, find the largest submatrix containing non-zero elements

I'm looking for a way to reduce a binary matrix containing zeros at some positions into a matrix that contains no zeros by deleting rows and columns of the original matrix until only non-zero values ...
38 views

### How to build a matrix from blocks [duplicate]

Brief MWE Given ...
243 views

### How to convert a sparse matrix to a list of sparse arrays?

I have a matrix stored as a SparseArray. How can I convert it to a List of its rows, where each row is stored as a ...
72 views

### Is it possible to draw a line on a MatrixPlot that would reflect density of row values? [closed]

I have a MatrixPlot with some data and I'd like to draw a vertical lines representing the "average" (density) of that data for each row. Something like this for ...
118 views

### Finding most general matrices $A$ and $B$ such that $A\cdot B=1$

I would like to find the most general shape of matrices $A$ and $B$ such that $A\cdot B=1_{4\times4}$. Naively, I just define for example ...
60 views

### Varying constant in Matrix calculation to generate 3D plot

As suggested, I rewrite my code to make it simpler and directly showing the problem. Here is a short example. I'd like to generate 3D plot where x,y,z (= a,b,answer) while I am varying a (0 ...
67 views

### Find inverse of the parametric matrix [closed]

I want to calculate the bellow parametric matric but I faced with this error: any suggestion?? ...
277 views

148 views

### Mathematica's Singular Value Decomposition different from another math engine [closed]

I’ve been working with SVD – singular value decomposition. Things weren’t working as expected. Thus, I looked over to Matlab and executed the following code: ...
411 views

### How do I get the inverse of a homogeneous transformation matrix?

I want to get the inverse of this homogeneous transformation matrix: iab = { {1, 0, 0, 0}, {0, 0, -1, 0}, {0, 1, 0, 3}, {0, 0, 0, 1} } ...
101 views

### UnitaryMatrixQ function not returning true for a unitary matrix

So I know this matrix is unitary. It's a well proven fact in quantum mechanics and you can even check for yourself on pen and paper, Heres a quick proof: Assume $H$ is hermitian (i.e. $H^\dagger=H$) ...
44 views

### Array Flattening arrays of matrices given by rules

Fix an $n$ and an $m$ positive integers.I have some set of four $n\times n$ matrices $A$,$B$,$Y$,$Z$ (where $Z$ is the zero matrix). I'd like to input the $nm\times nm$ matrix of block matrices given ...
114 views

### Update: Calculate Tensor products and traces with Mathematica

My goal is to algebraically simplify expressions involving tensor products and taking the trace. That is, I would like to compute $\operatorname{Tr}\left( \prod_i(id+a_i \otimes b_i) \right)$, using ...
629 views

### Brackets around each item in matrix

I have a matrix where every item in the matrix has its own brackets that I do not want. How can I remove the brackets around each item?