Questions tagged [linear-algebra]

Questions about Mathematica functionality related to manipulating vector spaces and linear mappings between such spaces. This includes determination of matrix properties, matrix transformations, decompositions, and factoring.

Filter by
Sorted by
Tagged with
5
votes
1answer
110 views
+100

Finding invariant matrix given group elements

I have a question about speeding up / optimising the following calculation. I have a feeling there is a way to rewrite it but I can't quite see what to do. In $d=3$ dimensions, given a set of ...
0
votes
0answers
25 views

How to select the column of a matrix the proper way

One thing that is annoying in Mathematica is, selecting parts of a Matrix creates lists that do not retain the matrix structure. For example, in MATLAB if you do: A=rand(10,10) and then a=A(:,1) You ...
2
votes
0answers
57 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: ...
15
votes
2answers
470 views

Factorize trigonometric matrices

Consider two square matrices $A_1$ and $A_2$. Consider the following matrix involving matrix trigonometric functions: \begin{equation} M_1(t)=\begin{bmatrix} \cos(tA_1) & t\mathrm{sinc}(t A_1) \\ ...
2
votes
0answers
30 views

finding a transpose matrix [duplicate]

sample = MatrixForm[ RandomVariate[NormalDistribution[0, 1.2], {3, 2, 2}]] Tranp = Transpose[MatrixForm[sample]] This is my attempt to find the transpose of ...
2
votes
1answer
408 views

Request for clarification of Eigensystem::eivn message

Bug introduced in 9.0 or earlier and fixed in version 11.0.1 What causes the problem of "two eigenvectors associated to one single multiplicity eigenvalue" that I am experiencing? After ...
6
votes
1answer
697 views

Speeding up the matrix exponential computation for sparse matrices

I want to compute the action of matrix exponential on a vector. My matrix $B$ is of a very large size and it is sparse, e.g., it is written as follows: ...
4
votes
2answers
137 views

How do I reduce to a basis?

I'm doing some computation with symbols X, Y, Z, XX, XY, ..., which are linearly independent elements in some larger vector space. For example, consider the ...
2
votes
5answers
923 views

What is the correct way to perform the Gram-Schmidt process?

I'm trying to do a simple processing in Mathematica. My original code was in MATLAB. Part of the computation is the Gram-Schmidt process, which is an iterative calculation. Every vector is changed ...
6
votes
3answers
276 views

Speed up the computation of the trace of a matrix

I have a symbolic symmetric $6\times6$ matrix: dim = 6; SetAttributes[s, Orderless] S = Array[s, {dim, dim}]; I want to compute the trace of $S^{12}$: ...
1
vote
0answers
14 views

Estimating Zeta from Hv and Hu , system of equations, estimation problem [migrated]

Does anyone here know how $\beta$ could be estimated in terms of $H_u, H_v $ in the below equations, $$ H_u = \left | \zeta\; \left(\frac{ e^{-j\cdot 2\cdot\pi}-e^{-j\cdot 2\cdot\pi(1/T)(T-\Delta t)}...
5
votes
2answers
3k views

What is the efficient way to code Successive Over-relaxation (SOR) method in Mathematica?

I have written a SOR method (SOR is this method) code using C-style procedural loops. However, I think there might be (much) better ways to achieve the same end in Mma avoiding these loops. So my ...
4
votes
1answer
133 views

How can I direct sum matrices into the middle of one another another?

I would like to execute the mathematical operation of the direct sum of matrices in the case where the matrices are not appended one after the other along the diagonal, but instead mixed among one ...
0
votes
1answer
45 views

How I can find the eigenvalues and eigenvectors of 500 matrices with 3x3 dimensions? [closed]

I can apply the Eigensystem command to a single matrix and it worked fine. But it takes me too much time. I want to get the eigenvalues and eigenvectors of multiple 3x3 matrices at the same time. ...
1
vote
0answers
45 views

SchurDecomposition returns matrices which are not a Schur decomposition [closed]

A Schur decomposition is a decomposition $M = Q T Q^\dagger$ where $Q$ is unitary, and $T$ upper triangular. It is implemented in Mathematica by ...
4
votes
1answer
677 views

Are there any more time-efficient ways to solve a matrix equation than with SparseArray and LinearSolve?

I am trying to solve a matrix equation, with the matrix being tridiagonal. The problem I am having is that a message keeps appearing that I don't have enough memory. Here is the code: ...
0
votes
1answer
95 views

How to transform a matrix into a diagonal matrix by Schmidt orthogonalization

I want to diagonalize a matrix by orthogonalization, but the following method cannot get the correct result: ...
0
votes
0answers
34 views

Converting Tensor product to Matrix

I have a basic question regarding matrices and tensor product forms. Given $N > 0$, I am interested in the tensor product series $\sum_{i}^{N} X_i$, where $X_i$ is the Pauli $X$ spin operator at ...
0
votes
0answers
55 views

Appending to a list in a For-loop

I am new to Mathematica. Here is my problem: Given the matrix $\qquad M = \begin{pmatrix} 2 & -1 \\ 1 & 2 \end{pmatrix}$, sum the overlap (inner-product) of it's eigenvectors $\qquad \bigg\{\...
3
votes
2answers
283 views

Speedup calculation of the largest eigenvalue and eigenvector of a 400×400 matrix? [duplicate]

Actually, the matrix is an adjacency matrix of a network. The code is: ...
0
votes
1answer
201 views

Obtaining eigenvectors without using Eigenvectors

Introduction I am trying to obtain the eigenvectors of a unitary matrix $M(k)$ which depends on a parameter k. This matrix $M(k)$ has dimension 6, and while for general matrices of dimension 6 it's ...
2
votes
1answer
45 views

Obtain needed Kronecker products from output of Eigensystem[]

Eigensystem[M] gives a list of the eigenvalues and eigenvectors of the square matrix M, i.e. ...
11
votes
1answer
1k views

Incorrect Left and Right Eigenvectors in Mathematica

I'm trying to find the left and right eigenvectors of a pretty straightforward matrix, but Mathematica doesn't seem to be able to do it for even a 200 dimensional matrix. Background: Given an ...
1
vote
1answer
75 views

How to get Mathematica to return more accurate symbolic eigenvectors

This code: Eigenvectors[{{Cos[t], Sin[t]}, {Sin[t], -Cos[t]}}] returns this output: ...
1
vote
1answer
92 views

Implementation of ShearingMatrix

How does Mathematica implement ShearingMatrix? In other words given the parameters $\theta$, $n$ and $v$, what is the formula behind it?
2
votes
0answers
42 views

Matrix regularization, how to pick $\lambda$

Since v12 FindFit[] now supports regularisation, such as Tikhonov regularization. Do there exist statistics to help guide the choice of the hyper-parameter $\...
0
votes
1answer
49 views

RowReduce with parameter, strange output (?) [closed]

I am facing some "strange" (?) output when using RowReduce with the following matrix $$ \begin{pmatrix} 1 & 2 & 2 \\ 2 & k & 1 \\ k+1 & 6 & 5 \end{pmatrix} $$ for it ...
2
votes
1answer
46 views

Problem with the precision while plotting a figure

I am trying to plot eigenvalues of a 16x16 matrix. Below you can see the code. I get some errors like “precision may be lost”, and “Eigenvalues at some positions are expected to be the same”. As a ...
1
vote
1answer
62 views

Maximize a function over several variables [closed]

I want to maximize the function, $$S_{v}=\sum_{a \in\{1,-1\}^{n}}\left\|\sum_{i=1}^{n} a_{i} v_{i}\right\|$$ over $v_{i}$ and a given $n$ (say $n$=3). $v_i$ are unit vectors. $a$ are lists with $n$ ...
4
votes
2answers
283 views

Plotting an image of a discrete dynamical system

I am trying to plot a discrete dynamical system of the form $$\vec{x}_{k+1} = A \vec{x}_k$$ where $A$ is a $2\times 2$ matrix in the form $$\begin{pmatrix}a&b\\c&d\end{pmatrix}$$ where $a$, $b$...
3
votes
1answer
62 views

Getting different eigenvectors for same matrix? [closed]

I have the same two matrices, one has the input values as integer and the other as real numbers. Mathematica shows the eigenvectors are completely different for the two same matrices and wondering ...
7
votes
4answers
261 views

FindInstance won't compute this simple expression

I want to find instances where this standard 3x3 symmetric matrix has only positive eigenvalues. So I run ...
4
votes
2answers
254 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 ...
5
votes
1answer
93 views

How to compute the trace distance of a density matrix

I am trying to compute the trace distance of two general $4 \times 4$ density matrices as such: $D=\frac{1}{2} \, \mathrm{tr} \, |\Delta\rho|_1$ where $\Delta\rho$ is the difference between two ...
0
votes
1answer
42 views

How to solve three simultaneous equations on Mathematica to get N in terms of X,Y and Z?

I am trying to solve a system with 3 equations 3 unknowns. My code is following X = A1*S + N1 Y = A2*S + N1 Z = N1^2 + A1N1S + A2N1S + 2A1A2*S^2
0
votes
1answer
86 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/<...
0
votes
0answers
47 views

How to constrain symbols to be (non-) commutative?

I have an expression that contains both matrices and scalars: H0 and H[k] are (non-commuting) matrices, and all the ...
1
vote
1answer
43 views

Ordering eigenvectors for basis transformation

Let's say I have a matrix $H$ represented in some basis, $a$, and I'd like to transform this to be represented in a different basis, $b$. The only difference between the bases is that $b$ is a basis ...
1
vote
1answer
68 views

Lowest Eigenvalue of a large sparse matrix without choking up the RAM (Corrected) [closed]

I am trying to find the lowest eigenvalue of a large sparse matrix of dimension N (=$3^n$, where n is number of particles in system ) using ...
3
votes
2answers
493 views

Deleting a row or column of an adjacency matrix while maintaining the associated label

I am currently working with a weighted adjacency matrix for a directed graph, and it contains several 0 columns and rows. With the unaltered matrix, I am able to monitor the relations between vertices ...
0
votes
1answer
41 views

Why does `Solve` repeat the same solution twice?

I have the system of matrix equations {s.n == n.s, n.n == 0, s + n == f} where ...
0
votes
0answers
39 views

Difference Equation system

I am new in Mathematica and I have a very large system of difference equations like: ...
1
vote
0answers
37 views

Solving Kronecker-structured linear equations

I need to approximately solve the following underdetermined system of $n$ linear equations $$y_i=a_i^T X b_i$$ Where $X$ is $d\times d$ unknown matrix, $a_i$ and $b_i$ are given vectors and $n=d$. Is ...
4
votes
1answer
314 views

Implementing positivity constraints over a six-dimensional hypercube

This question involves the same subject matter as my previous one (How can one achieve the most accurate estimates of certain six-dimensional integrals under specific constraints?), but with another (...
3
votes
1answer
86 views

How to compute matrices in Einstein notation:

I would like to compute $ r_{ii'} = \sum_{kk'} A_{ii'}^{kk'} r_{kk'} $ where all indices vary from 0 to 1 to yield a vector / matrix.
3
votes
2answers
257 views

How to solve a linear system like that

I'm trying to reproduce the following result: with ...
-3
votes
1answer
54 views

Having trouble coding my own QR decomposition using Gram Schmidt [closed]

I have this code for Gram Schmidt: ...
1
vote
2answers
95 views

QR decomposition using Gram Schmidt [closed]

First of all I don't want to use the reflection method, only Gram-Schmidt. So here's the program for Gram-Schmidt: ...
0
votes
0answers
28 views

Speed up my own Orthogonalize and QRDecomposition [duplicate]

I defined Gram-Schmidt like this: ...
0
votes
0answers
39 views

Hi! I'm trying to do SVD decomposition but I'm having some problems

So I have this code for QR Householder decomposition: ...

1
2 3 4 5
26