Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

Filter by
Sorted by
Tagged with
0
votes
0answers
30 views

Matrix Vector multiplication

I have a rather simple question which surprisingly i could find the answer theres a matrix $U $ whith is $4*4$ and a vector $A$ which is $4*1$ and when I wand to multiply them by $U.A$ operator i get ...
8
votes
3answers
250 views

Create Array from list of indices/values

Is there is a performat way to convert something like {{0,0},a},{{0,1},c},{{1,0},d},{{1,1},e} into {{a,b},{c,d}} The ...
0
votes
0answers
36 views

How to save a all matrices renewed in each iteration?

I have a (n by m) matrix , in which the elements are recalculated and replaced by new ones in each iteration. (In other words I have a loop in which the elements of the mentioned matrix are being ...
0
votes
1answer
47 views

Matrix Function Evaluation [on hold]

The following matrix of functions is a general gate (U3) used for programming quantum computers $$ u(\theta \_,\phi \_,\lambda \_)\text{:=}\left( \begin{array}{cc} \cos \left(\frac{\theta }{2}\right)...
7
votes
2answers
160 views

Multiply vectors in a matrix by a matrix

I have a matrix of vectors e.g. mat1 = Table[Table[RandomReal[1], 2], n, n]; which is actually a matrix of cartesian coordiantes ...
5
votes
1answer
48 views

MatrixConditionNumber does not work in version 12.0

A = {{1., 0.}, {0., 2.}}; LinearAlgebra`MatrixConditionNumber[A]
17
votes
1answer
361 views

Efficiently defining a SparseArray function

I've got a fairly large SparseMatrix (~60,000 entries in a ~10,000-by-10,000 matrix) that depends on two parameters (im1 and <...
6
votes
3answers
559 views

How to convert diagonal matrix to rectangular matrix

Suppose you have the following diagonal matrix: $\left( \begin{array}{cc} a & 0 \\ 0 & \{b,c\} \end{array} \right)$ How can the above matrix be converted to the following rectangular one?...
1
vote
1answer
32 views

Identification of linear combinations in a matrix

I have a matrix R which is having a dimension of 20 cross 20. When I extracted the rank of this matrix I got 16. I just wanted to which are these four rows are or columns which are dependent on each ...
9
votes
5answers
1k views

How can I define a very large matrix efficiently?

Here's a 7x7 matrix: ...
0
votes
0answers
54 views

Matrix transformation

Let an expression $X^T AX+B^TX$, how can I transform it as $Y^T C Y$; where $Y=[X, 1]$, find $C$ in terms of $A$ and $B$ using Mathematica?
0
votes
0answers
38 views

Why doesn't this evaluate further [duplicate]

The figure above shows the code as typed into Mathematica. In the fourth last line (or In[15] as you prefer) the expression is not evaluated to the fullest extent possible. Why does this occur? I ...
1
vote
1answer
55 views

Inverse matrix not computing [closed]

Hi just wondering why my Inverse of matrix will not compute? I don't believe its wrapped from //MatrixForm because I copied it by hand into a new document and it still would not work. Any ides? ...
4
votes
2answers
113 views

How to import latex matrices into Mathematica?

I have a lot of $\LaTeX$ matrices, and I want to find their eigenvalues and eigenvectors. I tried to import them to Mathematica with: ...
1
vote
0answers
25 views

Computing the invariant factors of a sparse matrix

Let M be a sparse $n\times m$ integral matrix, where $nm$ is very large. The goal is to compute its invariant factors. The naïve approach ...
1
vote
2answers
57 views

Error in Assignment

I want to create a matrix with each element updated as per the formula, whose inputs are dependent on the location of element in the matrix. ...
0
votes
0answers
43 views

Solving a system of linear equations with complex unknown

I am trying to solve the system of equations which is given by $ABA^*=-B$, where A is $2\times2$ matrix, $A^*$ is a conjugate transpose of $A$ and $B$ is a $2 \times 2$ unitary matrix. Entries of both ...
6
votes
3answers
639 views

List Manipulation : {{{a,b},{c,d}},{{e,f},{g,h}}} into {{a,b},{c,d},{e,f},{g,h}}

Hi I'd like to transform the matrix : ...
0
votes
0answers
32 views

How to reduce large matrix to a multidimensional matrix?

I have a large matrix $h$ with dimension $N_x N_y\times N_x N_y $. it is related to matrix $a$ by this formula,where $i,i_1=1..N_x$ and $j,j_1=1..N_y$. ...
7
votes
1answer
72 views

SparseArray: how to efficiently extract/delete many entries?

This is a follow-up of this question. We have a large $m\!\times\!n$ matrix stored as a SparseArray a and a list of positions pos...
0
votes
0answers
32 views

FullSimplify does not simplify at all

I have some problems simplifying things with FullSimplify. Suppose a matrix ...
0
votes
0answers
49 views

Eigenvectors of Hermitian matrices [duplicate]

I asked a similar question in the physics stack exchange, but realized my question is probably more suited here. For any Hermitian matrix $H = H^{\dagger}$ we can write $H = P DP^{\dagger}$ where $P$ ...
5
votes
1answer
274 views

Buliding a larger matrix from a smaller one

I have my matrix $h$ of size $2N\times 2N$ in this form $$h=\begin{pmatrix} a & b \\ c & d \end{pmatrix} $$ where $a,b,c,d$ are smaller matrices which i don't know. Is there any simple way to ...
1
vote
1answer
52 views

Interpreting the solution for a nonlinear system in a matrix form

I have an issue of how to interpret the solution of the following nonlinear system in a matrix: $F=PX^{-1}AX+wL$ where $w>0$ is a scalar, $F=(F_1,F_2)$, $P=(P_1,P_2)$, and $L=(L_1,L_2)$ are all a ...
1
vote
1answer
47 views

Calculation of the average of the values of a column in a matrix [closed]

I am trying to have a list of values which corresponds to the mean of the values of each column of a matrix. Here I show a quick example (my current matrix has a dimension of 1000 * 1000) If I have ...
0
votes
1answer
35 views

Conditions to make unitary a given matrix

Suppose I have some symmetric matrix W = {{c[1, 1], c[1, 2], c[1, 3]}, {c[1, 2], c[2, 2],c[2, 3]}, {c[1, 3], c[2, 3], c[3, 3]}}; where the c's are complex and I ...
1
vote
1answer
135 views

How do you solve a Lyapunov equation with given parameters? [closed]

The following matrix equation is a Lyapunov equation, $$ mA.x+ x.mA^T=-mC,$$ the matrix $mA$ is given by $$ mA= \begin{pmatrix} \frac {\gamma}{2} & \omega_{m} & 0 & 0\...
5
votes
4answers
192 views

Maximum of determinant of $n\times n$-matrix with elements 0 and 1

Generalizing https://math.stackexchange.com/questions/3265627/largest-value-of-a-third-order-determinant-whose-elements-are-0-or-1 I'd like to propose two related problems (a) find the maximum value ...
6
votes
3answers
275 views

How to append a matrix element by element?

Consider if I have some matrices constructed as such: ...
0
votes
0answers
81 views

Problem with fitting

So I have a very simple question related to a simple topic, but also directly related to a fitting problem. I see that my question is related to this question but I don't manage to make the bridge ...
0
votes
0answers
28 views

How to smooth and rotate a matrixplot?

I have a matrixplot with datarange included which is broadly pixeleted. I also want to frametick both the edges of x-axis. How can I possibly smooth it?
0
votes
1answer
57 views

Multiply function-valued matrices

I would like to create a notebook for calculations in supersymmetric quantum mechanics. The basic building blocks are two functions (or maybe better: operators): ...
0
votes
1answer
66 views

How do I make a RegionPlot for a matrix? [closed]

I have a 9 x 8 matrix containing values 0, 1, 2 and 3. I want to plot the region of matrix with value 3 with my parameters x -> {0, 0. 4} and ...
3
votes
1answer
42 views

How can I make a scatter plot from a matrix with many y-axis values for each x-axis value?

Consider matrix A = {{0, 2.54343, 3.566, 4.2323, 2.3434}, {0.1, 6.432, 4.6465, 5.656, 1.34}, {0.2, 0.3423, 1.6342, 3.323, 2.04}}; The x-axis values ...
4
votes
2answers
204 views

Help with coding a matrix

I have a $n \times n$ matrix $A$ with a full set of eigenvalues $\lambda$ including repetitions. I want to create the following $i \times i$ matrix: $$\left(\sum_{a=2}^i (a-1) |a-1⟩⟨a| \right) + \...
1
vote
1answer
47 views

How to get a more efficient solution for the mode shape?

With 3 degrees of freedom m, k, and w ...
4
votes
1answer
96 views

Selecting unique column position of a non-zero value for each row of a matrix

I have a matrix in this case of 3x11, but I want this to work for any dimension matrix. I want per row a column position on a non-zero value in that row, but that this value should be different than a ...
1
vote
0answers
35 views

Print 4x4x4x4 tensor as 4x4 matrix of 4x4 matrices [closed]

I'd like to print the LeviCivitaTensor[4] tensor as 4x4 block matrix of 4x4 matrices The following code works to display the LeviCivitaTensor[3] tensor as a 3x1 vector of 3x3 matrices. ...
2
votes
1answer
45 views

How to import a part of an Excel file?

I'm trying to import a part of an excel, the column 20 and the row between 6-59 in this column. I tried : tab = Import[ "file.xlsx"]; time = tab[[20, 6 ;; 59]] ...
0
votes
2answers
67 views

How to get eigenvectors of a 4x4 matrix? [closed]

MatrixForm[m = {{2, 9, 0}, {3, 8, 9}, {3, 9, 1}}] Eigensystem[m] I am facing problem in finding eigenvectors using ...
10
votes
3answers
524 views

Optimising subdiagonal shift matrix generation time

I want a square matrix $A$ such that $$A_{i,i-1} = 1 \ \forall i\\ A_{i,j} = 0 \text{ for } \ j \ne i-1$$ I have tried ...
1
vote
2answers
34 views

NSolve cannot find solution to system of trig equations

I was making a program to convert a rotation matrix to a set of euler angles. I wanted to do this for any valid rotation order that the euler angles were made with, and I did not want to do it the ...
4
votes
5answers
153 views

Generate random non-zero “island” in matrix of zeros

I'm trying to write a code which will generate a 3 dimensional array of 0s, then pick some random location in the array, and subsequently expand contiguously to random neighboring sites until a set of ...
0
votes
2answers
42 views

Mathematica doesn't evaluate/simplify arithmetic expression in its output [closed]

I have two matrices, A := {{1, 2, -4}, {2, -2, -2}, {-4, -2, 1}} and ...
0
votes
0answers
14 views

Solve, store, and access eigenvalues and eigenstates of M[x,y], for various points {x,y}

I'm interested in solving a position dependent eigenvalue problem for matrix M[x,y], where {x,y} is some discretized set of points. I may need to access the eigenstates and eigenvalues multiple times ...
0
votes
0answers
36 views

How to export a multidimensional array in which each element is also an array?

I have a {15,5,2} dimensional array and each element is itself a {14,16} dimensional array. When I export/import my file as an excel file I get a {15,,5,2} dimensional array but with {} dimension for ...
1
vote
0answers
26 views

Bug in SmithDecomposition?

While trying to calculate the SmithDecomposition of an integer 293x329 matrix with less than 3000 non-zero elements in the range -4 to 3 several errors occur, none of them which seem to make any sense ...
3
votes
1answer
43 views

How can I arrange the columns of a transposed matrix in an special way?

How can I do the below process on a matrix in a straightforward way: Firstly, change the rows with columns and secondly, arrange the columns of the matrix in a way that for a N*N matrix, the first ...
0
votes
1answer
38 views

I am asserting a variable in Mathematica as Real yet it is not implementing it!

Element[\[Theta], Reals]; Ga = g; Gb = g*Exp[I*\[Theta]]; {{Conjugate[Gb], Ga}, {Ga, Gb}} I have a code as such for a matrix as given above. as ...
0
votes
1answer
49 views

Time used by Mathematica to calculate tridiagonal matrix

I have a question. I need to find the eigenvalues and eigenvectors of a tridiagonal matrix of size NxN. Can you tell me how much time does Mathematica need to do that in minutes? for Size N ...