Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

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

How to export matrices in `MatrixForm` into png files (in a for loop) [closed]

I would like to export the png file of the output of Table in MatrixForm. The code is in the ...
  • 285
1 vote
1 answer
67 views

Sorting by power

I want to sort this table by column "d" such that Mathematica should also take the exponential values into account. Can somebody help me here?
  • 61
6 votes
3 answers
387 views

How can I check if the matrix is of the following form?

$\left( \begin{array}{cccccc} -a & 0 & 0 & 0 & 0 & 0 \\ 0 & a & 0 & 0 & 0 & 0 \\ 0 & 0 & -a & 0 & 0 & 0 \\ 0 & 0 & 0 & a &...
  • 3,399
2 votes
1 answer
42 views

Plot elements of a time dependent matrix

The matrix that I wanna plot the elements are complicated, this matrix is just an example: ...
3 votes
1 answer
97 views

Computing the unitary operator that diagonalizes a matrix

Hello. I am learning in Mathematica how to obtain the unitary operator that allows us to diagonalize the matrix M. Although with U^{-1}.M.U am able to obtain the answer: why doesn't the program ...
  • 133
-1 votes
0 answers
21 views

Travelling Tournament Problem (TTP) IL.P [closed]

"I am attempting to solve the Travelling Tournament Problem (TTP) using the Python library Pulp. However, I encountered a problem with the scheduling constraint, which was not accepted. All the ...
1 vote
1 answer
93 views

How to export a matrix in a `.txt` file?

I have the following matrix: ...
  • 285
2 votes
0 answers
61 views

Singular value decomposition of a matrix over the complex plane using parallel table

I have a big matrix $M(z)$ where $z$ is a complex number. The matrix is also dense. I am trying to compute the smallest singular value of the matrix over the complex plane. Since the computation at ...
  • 321
1 vote
0 answers
18 views

How to use RowReduce with AugmentedMatrix [duplicate]

I have used code in this post to reach the following for a classroom example that involves a 2d abstraction framed in a 3d illustration ...
  • 714
1 vote
2 answers
132 views
+50

Avoid condensing and use original terms in result of RowReduce

Can I force MMA to use original expressions in a result of RowReduce instead of displaying only the condensed result? For better understanding I give a simple ...
0 votes
2 answers
63 views

One-way "cross" of function between two matrices

I'm trying to create a sort of one way "cross" of a function between two matrices, such that every pair in one matrix is mapped to every pair in the other, but not the other way around; for ...
  • 101
4 votes
1 answer
98 views

How to find the common eigenvectors of these commuting matrices?

Given matrices P and Q defined as P = {{x - I y, z}, {z, x + I y}}; Q = {{0, 1}, {1, 0}}; ...
  • 387
5 votes
1 answer
101 views

Minimizing computational time for a quantum walk problem

Any suggestions as to how to speed up the computational time for this quantum walk problem which is coded using a normalized SparseArray coin operator as follows: ...
  • 3,128
2 votes
2 answers
125 views

Entering matrices interactively

I am looking for a way to enter an m*n matrix interactively using a dialog or a Graphical User Interface(GUI). Further, I would like to use this matrix later for ...
2 votes
1 answer
81 views

Find possible solutions with matrix notation

Many years ago a friend of mine solved a product package problem for me. Now I am struggling to recreate the notation. The problem was there were product bundles including plane, hotel and car rental ...
  • 123
1 vote
1 answer
62 views

Simple SDP using Hermitian matrices

I would like to run the following semidefinite program $$ \textrm{Minimize}\,\, \textrm{tr}\big({AX}\big)\\ \textrm{subject to}\,\, X \geq B_1\,, X \geq B_2\,, $$ where $A$, $B_1$ and $B_2$ are ...
0 votes
0 answers
40 views

Hadamard’s Theorem from Gradshteyn and Ryzhik's handbook [migrated]

In the book http://fisica.ciens.ucv.ve/~svincenz/TISPISGIMR.pdf on page 1077 I found one interesting theorem: I took an arbitrary matrix and tested this theorem. The result is the following: ...
  • 2,304
3 votes
2 answers
124 views

How to correctly identify a series of adjacency matrices in a text?

I would like to read the strongly regular graphs on at most 64 vertices from http://www.maths.gla.ac.uk/~es/srgraphs.php ...
  • 1,495
6 votes
1 answer
158 views

How to use Slater Type Orbitals as a basis functions in matrix method correctly?

This question is a continuation of my previous series of questions about basis functions. I would like to find the minimum energy of Coulomb potential motion using matrix method. $H=-\frac{1}{2}\Delta-...
  • 781
3 votes
2 answers
180 views

Find a vector in the null space of a large dense matrix, where elements in the matrix are not directly accessible

I am working with Conjugate Gradient method to solve for $Ax = b$, where $A$ is an extremely large PSD and Singular matrix. I cannot directly access the elements of $A$, but I can compute $Av$ for any ...
-1 votes
0 answers
36 views

Obtain all possible state space equations in the circuit of Systemmodeler?

How to obtain the state space equation of the Buck circuit switch closing and opening in Mathematica when drawing this circuit on Systemmodeler only? Or can only draw the switch closed or open ...
0 votes
0 answers
82 views

Mathematica parses `Log[a,b]` as `Log[b]/Log[a]` automatically, before any rules

I use the following code to realize quaternions (this allows more flexibility than the quaternions package): ...
  • 3,399
4 votes
3 answers
163 views

Compile code involving two matrix multiplications

Consider the following simple matrix operation ($a_j, b_j, z, w$ are matrices) $$ w=\sum_j a_j\cdot z\cdot b_j$$ For performance reasons I am compiling the code ...
  • 17k
0 votes
1 answer
72 views

Use the RSolve command of Mathematica to solve difference equations in matrix form?

For example, if $A$ is a matrix, the following is its difference equation representation. How can I rewrite the code to use the RSolve command correctly? ...
1 vote
0 answers
89 views

Why is the dot operator not just matrix multiplication?

It seems to me Mathematica does not have an inbuilt matrix multiplication operator. The dot operator fails as such, as is even noted under "Possible Issues" in its documentation it ...
3 votes
2 answers
63 views

How I delete one row and one column of a matrix? [duplicate]

I think the title says it all. I am looking for a function f[A_matrix, r_Integer, c_Integer] that will return the matrix A with the row r and column c deleted. I know how to delete rows but how about ...
  • 265
0 votes
0 answers
49 views

How to perform Z transformation on this difference equation?

The difference equation is as follows: $$E(i+1)=(I-AT)E(i)+1/2(AT)^2$$ Where, $E$ and $A$ are matrices. This is part of the code I wrote using Mathematica: ...
6 votes
3 answers
446 views

Fast pairwise difference

I'm trying to construct a matrix $A_{ij}=X_i-Y_j$ where $X$ and $Y$ are vectors with thousands of real numbers. The fastest and closest thing I found is ...
1 vote
1 answer
77 views

Why is generating normalized random $1000 \times 1000$ matrices and plotting the eigenvalues so slow?

For each of the distributions $N(0,1)$ and $\pm 1$ equal probability and for each of $N \in \{5,10,20,50,100,200,1000\},$ I want to generate an $N \times N$ matrix with entries chosen from the ...
12 votes
3 answers
278 views

Efficient eigendecomposition of DPR1 matrices

I'm finding that the following bit is the bottleneck in my code ...
3 votes
2 answers
243 views

Givens rotation: What is the Mathematica equivalent to MATLAB's planerot function?

Matlab has a function called planerot which takes a two-component column vector $x$ as input and returns a $2 \times 2$ matrix $G$ and a two component column vector ...
  • 321
2 votes
3 answers
305 views

Plotting a complex matrix with phase dependent color

I want to plot a complex matrix, i.e., a matrix with complex number entries. I want the matrix to be plotted as DiscretePlot3D as shown in the figure (top figure). But, I also want each bar to be ...
2 votes
1 answer
86 views

Why QR-decomposition returns transpose of Q?

In the documentary we read about QRDecomposition (Link) QRDecomposition[m] yields the QR decomposition for a numerical matrix m. The result is a list {q,r}, where ...
0 votes
0 answers
27 views

Why occur a giant increasing of absolute value of minimal eigenvalue with rise of the basis functions number?

I have the following code: code 1 ...
  • 781
6 votes
1 answer
90 views

Schur decomposition: What is the Mathematica equivalent to MATLAB's rsf2csf function?

MATLAB has a function rsf2csf that can convert real Schur form to complex Schur form. The description of the function can be found here. How can I do this in ...
  • 321
4 votes
1 answer
145 views

How to export a matrix with complex entries having arbitrary precision from Mathematica to Matlab?

I am trying to export a large matrix with complex entires having arbitrary precision (~ roughly 200 digits after the decimal point) from Mathematica to Matlab. I have used ...
  • 321
2 votes
1 answer
98 views

Partial pivoting in row reduction

I have a large $m \times 2m$ numerical matrix which I obtained from NullSpace. I expect that the matrix is equivalent under row operations to a sparse matrix with ...
5 votes
1 answer
73 views

How to Find a Weighing Matrix of Size n?

Weighting matrices appear in the statistical design of experiments (Weighting Matrices and Statistical Design of Experiments. A weighting matrix is a generalization of Hadamard matrices, e.g., ...
  • 3,140
8 votes
4 answers
583 views

How can I "multiply" nested lists?

Given two nested lists alist={{a,b,c},{d,e,f}} blist={{r,s,t},{x,y,z}} How can I get ...
  • 717
2 votes
1 answer
118 views

Schmidt Measure of a Graph State

Based on the definition of the Schmidt measure in this work https://www.arxiv-vanity.com/papers/quant-ph/0307130/, the following code was set up, but appears to generate errors. Is there a better way ...
  • 3,128
1 vote
1 answer
115 views

Matrix difference equation

How to use Mathematica's RSolve command to solve the difference equation in matrix form? RSolve[{a[n + 1] - 2 a[n] == 1, a[0] == 1}, a[n], n] For example, the ...
0 votes
2 answers
70 views

How to find nontrivial solution for $\Psi$ in the given matrix equation? [closed]

I have the matrix equation $\mathbf M\mathbf \Psi=\mathbf 0$ where $\mathbf M$ and $\mathbf \Psi $ are given below. I check that that $\det \mathbf M=\mathbf 0$; that is, ...
  • 361
0 votes
1 answer
60 views

Animating unit basis transformations

I am not sure if my mental block here is conceptual or mechanical (edit below suggests it is conceptual). Suppose I want to show all possible unit basis transforms of a matrix. There are 81 possible ...
  • 714
8 votes
2 answers
347 views

Efficient way to store the terms of a summation in a list?

I have two matrices, A and B of the same dimension $Nr\times Nc$, with $Nr\gg Nc$. Essentially, I am trying to put all the terms ...
3 votes
1 answer
63 views

What is the optimal way to get selected elements from a matrix?

I have a 2x2 matrix "M", and a list "ind" containing pairs of indices. M = {{a, b, c}, {d, f, g}, {h, i, j}}; ind = {{1, 2}, {1, 1}, {3, 1}}; I ...
3 votes
2 answers
142 views

Generate real random matrix with some pure imaginary eigenvalues

I want to generate a random 4x4 matrix with real entries, one or some of whose eigenvalues is the pure imaginary number I or some other imaginary number. NOTICE The ...
  • 1,719
1 vote
0 answers
42 views

Finding the similarity transformation between two symbol matrices

I have two symbol matrices mA and mB, which are similar matrices. ...
  • 1,719
0 votes
1 answer
97 views

How to work on "Do" loop?

let's say ...
4 votes
1 answer
97 views

"Information about the undocumented function Internal`DiracGammaMatrix"

Searching for information on undocumented functions here, I found that there are no references about the use of the undocumented function Internal`DiracGammaMatrix. Does anyone in the community have ...
3 votes
1 answer
76 views

Verifying matrix exponential identity

I wish to verify the following matrix exponential identity using Mathematica: $$ \mathbb{e}^{i.x.\hat{n}.\sigma}= \cos{x}.\mathbb{I}+ i\sin{x}(\hat{n}.\sigma) $$ where $\mathbb{I}$ is the $2\times2$ ...

1
2 3 4 5
68