# Tagged Questions

Questions on the manipulation of matrices in Mathematica.

57 views

### Fast arithmetic on matrix elements

I have a square matrix $U$ of dimension $L\times L$, I am interested in the following quantity $U_{1,j}U_{2,k}U_{3,l}U_{4,m}\cdots U_{L,q}$ summed over all permutations of the letter indices, e.g.,...
104 views

### How to map the second highest value in each row of a matrix

I have a matrix with three or more columns called mat. I would like to map the second highest value in each row of mat into its ...
132 views

### How to parallelize this code?

Initialize a matrix a with value of $\alpha$ in central cell as "ice", and $\beta$ in every other cell. ...
616 views

### more numerically accurate inverse matrix

I encountered the following matrix mat = {{2, 2.161209223472559 + 1.682941969615793 I}, {2.161209223472559 - 1.682941969615793 I, 2}} and ...
63 views

### How to fill a tensor with matrices one by one?

I have this tensor: nn = 4; tableToFill = Table[x, {p, 1, nn}, {q, 1, nn}, {i, 1, nn}, {j, 1, nn}]; that I want to fill with a matrix one by one with a matrix ...
52 views

### FindInstance of Matrices

I'm trying to use FindInstance to find examples of matrices that complete an expression. However, it seems like I need to specify atomics as my variables to the function. So, here's a really simple ...
61 views

### Can't operate on vector within a list of rules

I'm trying to set up a list of rules which includes the following: ...
48 views

### LatticeReduce question

Does LatticeReduce work with arbitrary precision arithmetic? That is, if I give it a linearly independent integer basis, but the integers are 40 decimal digits long ...
153 views

...
154 views

### FindMaximum “is not a real number at” nrnum problem

I'm experiencing a problem using FindMaximum that I don't understand (due to my newbie knowledge of Mathematica's syntax). That is, FindMaximum sometimes returns a (correct) answer, but sometimes ...
141 views

### Generate random Hermitian matrices [duplicate]

I want to generate random Hermitian matrices. For now, random Hermitian matrices with size 2 are obvious to construct. But elegant methods for higher dimension would be nice! Are there methods besides ...
34 views

122 views

### List consisting of positions of the matrix elements and the elements themselves

Given a 2D matrix I would like to make a list with elements consisting of positions of the matrix elements and the elements themselves. Let the matrix be ...
118 views

### How can I make custom accumulated sequences like the following?

First of all, I don't really know how to formulate the question, so if you understand my question and know a better way to phrase it, please revise. I have the following Matrixes: ...
84 views

### How can I create a dynamic Matrix inside a function?

I have a function where a n parameter is handed and a list of values is calculated inside of it. I then need to solve a linear system of equations that require me ...
67 views

### How to multiply a row to multiple rows in a matrix

I have the Following Matrixes; ...
114 views

### Precision of Eigensystem? [closed]

I was using Eigensystem to obtain the rotation matrix. However, I find out Mathematica does not fully diagonalize my matrix (or say not precise enough). My matrix ...
106 views

### Visualizing Matrix that represents a network

I have a nxn matrix $A$ that represents a network. I have $n$ nodes in the network, and the matrix $A$ represents the number of connection (edges) between the different nodes. For example, if $A$=0, ...
68 views

### errors in simple for loops

Im trying to run the following code, which I have translated from Matlab. I created a for loop nested inside another for loop. mW is a matrix, and ...
47 views

### Output of Coefficientrules into Jacobian matrix

I have a pair of large polynomials in u, v, a1...a9 and b1...b9, generated by ...
49 views

### Enlarge a matrix and fill in zeros [closed]

Suppose I have a dynamically generated 4-dimensional matrix L in the shape shape={d1, d2,d3,d4}, and ...
42 views

### Tolerance of PositiveSemidefiniteMatrixQ [closed]

I believe the following should be True but returns False for me: ...
74 views

### Reliably computing the signature of a matrix with small eigenvalues

When asked to compute the eigenvalues of the following matrix ...
141 views

### Extract part of a matrix

I have imported a matrix from a .txt file (it could be better from an Excel file): ...
211 views

### how can i associate the headings of columns/rows with content of itself and then recall what i want after i've imported the excel file in mathematica

Hello, i make another try... I have to import a file like this below (it is an excel file, i show you just the beginnig. it should have thousend of rows and columns). After i've imported the file i ...
59 views

### Interpret hexadecimal sequence as a binary matrix that can be used in AdjacencyGraph

I have a database of hex sequences stored as blob. Each of them is a binary matrix representing the adjacency matrix of a directed graph. I want to use the ...
61 views

### Calculating in the group ring $Q[GL_n(Z)]$

I am trying to use Mathematica to check some identities in the group ring $Q[GL_n(Z)]$. Is there a package/function of Mathematica to do this? Thanks a lot in advance!
176 views

103 views

### Finding matrix given null space

Suppose I input a very large $n$ integer vectors and I wish to compute the matrix whose nullspace is spanned uniquely by these vectors. Is there an appropriate command/module to do this using ...
73 views

### How to merge 2 columnar matrices into a row matrix? [duplicate]

if i have two columnar matrices A,B . then how can i merge both matrices into a row matrix. ...
62 views

### Count and NMinimize don't seem to work together

Initially I write down a 2x2 unitary (Uni) , make a tensor product 4 times (LocalUni) and apply it to an initial numerical matrix Rho, to obtain RhoLU, that depends on 12 parameters. This is my code: ...
41 views

### How to combine two matrices.? [duplicate]

let A, B are any 4 by 2 Matrices , i want to know whether it is possible to obtain a 4 by 4 matrix by using equation A=B Thanks in advance
48 views

### Assigning sections of a matrix to lists based on row value

I'm working with a very large (4x41355) matrix and I'm trying to make lists out of sections of rows based on the value in the fourth row. It's like this: ...
59 views

...
123 views

### Efficient solution of huge sparse linear system

I'm trying to improve efficiency of my code in which main task is a solution to huge (~$10^4\times 10^4$) but sparse linear system $$Ax=b$$ (In fact my aim is to solve nonlinear equations $F(x)=0$, ...
143 views

### Getting mathematica to factor out constants and apply euler's identity to a table

I'm doing some quantum mechanics homework that I'm going to eventually generalize to higher spin states, so the solutions are going to need to be decently independent of the dimensions of the table ...
85 views

### Merge two trees into a rectangular matrix in Mathematica

How can I merge two trees, t and s, so as to form a square matrix below, where both trees starts from top-left (as shown), and ...
217 views

### Speeding up generation of block diagonal matrix

I'm struggling with the following problem. I have $48$ square matrices (full, filled with real machine precision numbers, thus are packed, all different) of size $128$. I wolud like to place them on a ...
273 views

### Extract left-upper triangular data from a square matrix-form list

Hopefully, this question is not too basic or obscure. I'd like an idea on how to extract this {{1}, {5, 2}, {9, 6, 3}, {13, 10, 7, 4}} from ...
How can I use Map over two indices with a condition? I am trying to calculate second derivative of an eigenvalue, $\lambda_i(x)$, of $n \times n$ matrix $M(x)$ ...