# Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

2,926 questions
Filter by
Sorted by
Tagged with
66 views

### Numerical sum optimization

I need to compute the following sum as fast as possible: $$P_{ijkl}=\sum_{p,q,r,s}^nW_{sqpr}H_{js}G_{rl}A_{ipkq}$$ I came up with this code: ...
84 views

### Help in solve the matrix

I have written the following code. I have two main problems. The first is how to solve the matrix for different Omega, and the second is that if I put letters instead of numbers for k or m, the values ...
76 views

### Periodical sum of rows by a certain step

I've been struggling with one problem. I have a classic matrix in this example 12x4 such as: matrix = Table[i, {i, 12}, {4}] ...
116 views

### Creating adjacency matrix from another matrix

I'm trying to write a code which takes any $10\times10$ matrix as the input, assigns value of $i$ and $j$ to its elements based on their position in the matrix. Then using those values of $i$ and $j$ ...
303 views

### Matrix multiplication of non-commuting objects

I have two matrices, $A$ and $B$. The elements of these matrices are some abstract non-commuting objects, which I'm just representing as variables. For now, I don't care about having Mathematica know ...
44 views

### Getting message Set::setps: Kpr[x,y] in the part assignment is not a symbol

I use a loop to create a set of matrixes Subscript[k[x, y], i], depending on variables x, y. Then I create a large matrix ...
258 views

### Check if rows and columns of matrices have more than one non-zero element?

I am given a list of square matrices (with non numeric entries but abstract symbols which are assumed to take real values) and I want to write a function that returns True if the following condition ...
51 views

### Adding lists to specific elements in a list

I have compiled lists of non-diagonal and diagonal entries for a matrix. I'm trying to add elements from the diagonal-entry lists into certain entries of the non-diagonal lists. Is there a feasible ...
55 views

### Why the “Sum” function becomes extremely slow at a specific size of matrix? How to AVOID it? [duplicate]

Three methods("Sum", "Total@Table" and "Do") have been used to do the same work. The "Sum" and "Total@Table" function becomes extremely slow at num=...
32 views

### Manipulation of a symbolic matrix expression

I have the following code: ...
32 views

### How to speed up this code (finding eigenvector with smallest eigenvalue)? [closed]

I have following code. The function TraceSystem is to take partial trace of matrix and I think this part is fine. The main code is below in dd and I think the main problem is in here for Eigenvector. ...
25 views

### Solving quadratic eigenvalue problem [duplicate]

I am trying to solve a quadratic eigenvalue problem using Mathematica similar to Matlab command "polyeig" https://www.mathworks.com/help/matlab/ref/polyeig.html How to do it using ...
74 views

### What is the fastest way to get the lowest eigenvalue and corresponding eigenstate in Mathematica?

I tried to use the Arnoldi method to get the smallest eigenvalue and corresponding eigenstate for large matrix. However, Arnoldi did not give me the desired result: ...
35 views

### How to change an element in matrix, based on equality of other elements?

I have following problem. I can solve it without any real troubles using 2 for cycles. Knowing it is not really a Mathematica friendly approach, can you give me suggestions of a nice Mathematica code? ...
32 views

### Function isn't adding the 2 matrix [closed]

Having an issue where my function rotMatfromVec won't add the 2 Matrices at the end. It takes in 2 inputs, R and theta, where R is a unit vector. ...
52 views

### Sorting of eigensystem accroding to specific eigenvector

I have a matrix, I want to sort it with respect to specific eigenvectors. Here, I provided an example of a matrix HT: ...
89 views

### Having problem in evaluating the eigenvalues of an $11\times11$ symmetric matrix in Mathematica [closed]

I am solving an $11\times11$ matrix in Mathematica. I am facing problem when I try to find the determinant or eigenvalues of this matrix. The error (Det::matsq/<...
51 views

### How To Define An Outer Product (in xAct)?

I am working with xAct / xCoba / xTras and I would like to construct a matrix out of a vector. So, I have a vector V on a manifold ...