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.
323
questions
6
votes
1
answer
231
views
SemidefiniteOptimization for operator norms: Stuck at the edge of dual feasibility
Can someone give a workaround and/or explanation why Problem 1/Problem 2 fail to solve through SemidefiniteOptimization? Problem 3 works. (I'm using 12.1.0 on Mac). ...
6
votes
2
answers
4k
views
Can the CholeskyDecomposition function in Mathematica be made to work on non-symmetric matrices?
The CholeskyDecomposition[m] function in Mathematica requires a symmetric and positive definite matrix m.
For instance, the ...
6
votes
3
answers
367
views
Is there a way to view all two-dimensional arrays in matrix form?
Is there a way to ensure that every time I perform an operation such as RowReduce, Linear Solve, Null Space, Inverse, Eigenvectors, etc. that the matrix is displaying in MatrixForm instead of applying ...
6
votes
1
answer
162
views
Efficiently fill sparse matrix involving BSpline
Context
In order to implement regularised fitting in 2 or 3 dimensions (as is done say here) using BSplineBasis one needs to evaluate a basis over a set of data.
...
6
votes
1
answer
2k
views
Finding the characteristic polynomial of a matrix modulus n
Given a square matrix, is it possible to calculate its characteristic polynomial modulo n?
Unfortunately, this function ...
5
votes
1
answer
997
views
Finding the eigenvalues (diagonalizing) of a block-diagonal matrix
I have a large $2^N \times 2^N$ matrix. It is the exact Hamiltonian of a spin chain model which I have generated with code I wrote in Fortran. The code block diagonalizes the Hamiltonian into constant ...
5
votes
2
answers
1k
views
Finding the similarity transformation between two matrices
I have difficulty in finding the transformation matrix of two similar matrices.
It is known that matrix $A=\left(\begin{array}{ccc}
-2 & -2 & 1 \\
2 & x & -2 \\
0 & 0 & -2
\end{...
5
votes
1
answer
111
views
How can I tell `Dot` to behave automatically linear?
I would like the number $a$ to be taken out:
...
5
votes
3
answers
2k
views
Solution for equation system with piece-wise defined functions
As I could swear this worked just yesterday, I am probably just doing something stupid here and I am sorry to bother you :)
I am trying to find the point where a curve crosses a line. In this case, ...
5
votes
1
answer
1k
views
How to speed up band matrix-matrix multiplication?
I have a band matrix
...
5
votes
0
answers
581
views
Documentation for LinearAlgebra`LAPACK`?
Does anybody use the functions provided in the context LinearAlgebra`LAPACK directly? Is there any documentation out there? Guessing the argument patterns for these function by trial and error is ...
5
votes
1
answer
2k
views
Linear Solve with Modular Arithmetic
I am interested in using LinearSolve[m,b] which will find a solution to the equation $m.x=b$, where I am in mod 2 arithmetic. Is there any way to perform this ...
5
votes
1
answer
363
views
Plotting conformal mappings: $(x, y) \mapsto (x^2, y)$
I'm currently studying transformation geometry, and I've been trying to figure out a good way to plot conformal mappings on $\mathbb{R}^2$ of the form
$$ \mathbf{f} : \pmatrix{x \\ y} \mapsto \pmatrix{...
5
votes
1
answer
106
views
Can a certain pair of expressions be compressed into one?
I've been employing this pair of statements
...
5
votes
1
answer
5k
views
How to obtain the orthogonal matrix that diagonalize a symmetric matrix [closed]
I have a real symmetric matrix H which is in symbolic form, I need a matrix P that can diagonalize H; also P is orthogonal and its columns are the eigenvectors of H.
How can I doing this in ...
5
votes
4
answers
393
views
Approximate strictly positive solution to a linear set of equations?
Consider a positive matrix M and a positive vector b, e.g.
...
5
votes
0
answers
569
views
Change of basis of polynomials
Suppose I have a favourite basis for polynomials in $x_1,\dotsc,x_n$, say non-symmetric Macdonald polynomials to be specific.
I can easily compute these, and thus the change-of-basis matrix that takes ...
5
votes
1
answer
196
views
Why do ReplaceAll and With give different results?
I expected both results to be $0_3$:
...
5
votes
2
answers
2k
views
How can I get Mathematica to recognize equality of symbolic matrix expressions?
I have two matrix expressions:
X.Transpose[T].Transpose[X]
and
X.T.Transpose[X]
I want Mathematica to recognize that ...
5
votes
1
answer
4k
views
Transform linear system into a matrix form
I have a system of linear equations in variables $A_n$ of form:
$$
\sum _{k=-K}^K h_k A_{n-k} J_{n-k}\left(\frac{(1-i) \text{$\eta
$Sqrt}(n-k)}{\sqrt{2}}\right)+A_n\left(\frac{(1-i) \eta \sqrt{n-...
5
votes
1
answer
409
views
How do I disable that Mathematica orders terms in lexicographic order?
I have matrices with entries where the order of the entries is important. Unfortunately Mathematica resorts terms in products in a lexicographic order. For example,
...
4
votes
4
answers
291
views
Cholesky/LDLt that works for singular matrices?
TLDR
When given $A=X'X$ decomposition, user298737 works by relying on QRDecomposition on $X$. If we didn't have this decomposition, one could use QR to get full-rank part of $A$ and use Cholesky on ...
4
votes
1
answer
413
views
Finding an Integer, Unimodular Matrix that connects two given matrices
I have two symmetric, integer matrices, $K$ and $K_2$ which have the same determinant and the same signature (number of positive - number of negative eigenvalues). I want to find an integer valued ...
4
votes
1
answer
440
views
Numerically computing the eigenvalues of an infinite-dimensional tridiagonal matrix
I have one infinite dimensional tridiagonal matrix whose eigenvalues I have to compute. How can that be done numerically using Mathematica?
Let me expose the concrete case I want to do it. I shall ...
4
votes
2
answers
800
views
Using LinearSolve instead of Inverse does not give a good enough precision
If I want to calculate $B^{-1}A$, then instead of using Inverse, I should in theory just be able to use LinearSolve[B,A].
Now ...
4
votes
3
answers
1k
views
How to find a unitary transform between two matrices?
Given two matrices,
G1={{0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}, {0, 1, 0, 0}}
and
...
4
votes
4
answers
932
views
Double contraction between 2nd and 4th rank tensor
I would like to compute the double dot product between a 2nd and 4th rank tensor in mathematica $A_{kl}A_{ijkl}$
$if \, A_{kl}=\begin{pmatrix} 1& 0 & 0\\ 0 & 1 & 0\\ 0&0 & 1 \...
4
votes
2
answers
271
views
MATLAB to Mathematica CorrelationMatrix implementation
This question focuses on translating/adapting custom defined MATLAB code for creating a CorrelationMatrix to Mathematica.
Software and hardware used:
Mathematica Version 10.3.0.0
Computer: Mac Pro (...
4
votes
2
answers
3k
views
Row echelon form question
I am wondering if there is a Mathematica command that will put a matrix in row echelon form. That is, put
$$
\begin{bmatrix}
1 & 2 & 3\\
2 & 3 & 4\\
-1 & 0 & 2
\end{bmatrix}
$$
...
4
votes
3
answers
368
views
Basis for multivariable polynomials
I have a bunch of two-variable polynomials and as part of a larger algorithm need to find a basis for them and express them in terms of this basis.
As an illustrative example, for one case my ...
4
votes
2
answers
463
views
How to return multiplicity of each eigenvalue?
I could not find the information so maybe someone know if it possible.
I have a matrix which has several degenerated eigenvalues and I would like Mathematica to return the multiplicity of each ...
4
votes
1
answer
349
views
LieArt --- 3 different 8 dimensional irreducible representation of $\mathrm{SO}(8)$ and their decompositions
I am using the LieArt which you can download freely online https://arxiv.org/pdf/1206.6379.pdf
There are three different 8 dimensional $\mathrm{SO}(8)$ irreducible representations, formally it is ...
4
votes
2
answers
1k
views
How to collect eigenvectors corresponding to only positive eigenvalues?
Let us consider a matrix of order $n \times n$ with $n/2$ positive and $n/2$ negative eigenvalues. How to collect $n/2$ eigenvectors corresponding to positive eigenvalues in a matrix of order $n \...
4
votes
1
answer
402
views
How do I plot Numerical Range of two hermitian matrices
Let $A_1$ and $A_2$ be two $3\times 3$ hermitian matrices. Then their numerical range is defined as two-dimensional set
\begin{align}
\mathbb{S}=\{\left[u^HA_1u,u^HA_2u\right]\in \mathbb{R}^2,u^Hu=1\}...
4
votes
4
answers
465
views
Calculating the equilibrium value of a discrete time system in matrix form?
Context:
I am hoping to calculate the equilibrium of the following discrete time system.
$x(t)=Ax(t-1)$, where
...
4
votes
3
answers
442
views
Eigenvectors are divided by zero depending on evaluation, 4x4 matrix
I calculated the Eigenvectors of the $4\times 4$ matrix $m$ with parameters $(a,b,c,d)\in \mathbb{R_{\ge 0}}$. If I set e.g. $b\rightarrow 0$ after calculation, then some of the Eigenvectors are ...
4
votes
2
answers
2k
views
Linear Programming Using Dual Simplex method
I want to solve an optimization problem using the Dual Simplex Method. Although Mathematica gives the result directly when I use the command Minimize but I want to ...
4
votes
1
answer
1k
views
Calculate the algebraic multiplicity of known eigenvalues of a large, sparse matrix
I have a large (and sparse) matrix with size 1000x1000 -- 10000x10000. I believe i know all eigenvalues for the matrices. All entries are integers and so are the eigenvalues.
I want to check this by ...
4
votes
1
answer
500
views
Nonnegative Least Squares Algorithm (NNLS) [closed]
Can anyone optimize the code below which is developed in an old version of Mathematica (2003) both in terms of efficiency and adaption to the latest versions of Mathematica?
Description of the code:
...
4
votes
3
answers
1k
views
How to plot the field of values (numerical range) of a matrix
I found some difficulties in plotting the set
$$W(\mathbb{A}):=\{\langle x,\mathbb{A}x \rangle \mid \|x\|=1\},$$
where $\mathbb{A}\in\mathbb{C}^{n,n}$ is a given complex matrix and $\langle\cdot,\cdot\...
4
votes
1
answer
2k
views
eigenvalues of symbolic Hermitian 3X3 matrix
My question is similar to Get rid of imaginary parametric eigenvalues of a Hermitian matrix
However I find it puzzling that the situations is so complicated, since in my case I discuss only a $3\...
4
votes
1
answer
510
views
Sporadic bug in Mathematica 7.01.0 MatrixPower and/or Eigensystem functions on floating-point symmetric matrices with repeated eigenvalues
Note: From the comments submitted below by other StackExchange users it appears that this apparent bug was fixed sometime after version 7.0.1.
I asked a vague variant of this question a few days ago, ...
3
votes
1
answer
436
views
Solve an eigensystem faster and eliminate Root[...] from the solution
I have a symbolic, 2-parameter, 8x8 matrix to solve, but Mathematica takes something like 20 minutes to solve it and returns a very large output containing expressions of the form ...
3
votes
2
answers
575
views
Defining a*b=-b*a
I am fairly new to using Mathematica and was wondering if it's possible to define something along the lines of:
$a*b=-b*a$
a sort of antisymmetry or skew symmetry if you will. I would like to do ...
3
votes
1
answer
188
views
How to find selected elements of inverse of a banded matrix without inverting it?
Is it possible to find some selected elements of the inverse of a large sparse matrix without inverting it?
For example consider this Hermitian matrix (as a general case).
...
3
votes
1
answer
175
views
Construction of an additive compound matrix
I want to construct an additive compound matrix which has the following form as output :
...
3
votes
2
answers
208
views
How to efficiently check if a matrix is a Toeplitz Matrix
With ToeplitzMatrix we can create a Toeplitz matrix from a list of values. I have a question going in the opposite direction, namely, how to efficiently check if a ...
3
votes
1
answer
267
views
Efficiently computing current flow betweenness centrality for graphs
Definitions:
Given a graph $G=(V,E),$ the current flow betweenness is a node-wise measure that captures the fraction of current through a given node with a unit source (s) sink (t) supply $b_{st}$ (1 ...
3
votes
2
answers
1k
views
Finding specific eigenvalues
Given an $n\times n$ matrix $Q$ (with e.g. $n\approx10^4$) I am only interested in the 3rd smallest eigenvalue of $Q,$ and not the entire spectrum (assume all eigenvalues are real, e.g. a Hermitian ...
3
votes
1
answer
170
views
Is there a good way to check, whether a small value produced numerically is a symbolic zero?
I have a complicated 4x4 matrix and need to know the eigenvalues. I expect a zero eigenvalue for physical reasons.
Giving numerical values first gives me an eigenvalue of $\mathcal O(10^{-15})$. Now ...