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
62
votes
4answers
16k views

Can Mathematica do symbolic linear algebra?

For instance, is there some way I can say "let A and B be arbitrary real $m\times n$ and $k\times m$ matrices, Simplify[Transpose[Transpose[A].Transpose[B]]]" and ...
8
votes
3answers
1k views

Build a Companion Matrix of a Polynomial?

The eigenvalues of a square matrix $A$ are the roots of its characteristic polynomial $\chi(\lambda)$. Conversely, if we have a monic polynomial $p(\lambda)=a_0 + a_1 \lambda + \cdots + a_{n-1}\lambda^...
5
votes
2answers
1k views

Simplify matrix into an upper triangular matrix

I have a tridiagonal matrix that I am trying to simplify into an upper triangular matrix using Mathematica, so I can use back substitution and solve my linear system. I have found the command ...
2
votes
1answer
140 views

Using ZeroTest method with RowReduce

My goal is to solve this system: \begin{align*} x_1+2x_2+2x_3+2x_4&=a\\ 2x_1+4x_2+6x_3+8x_4&=b\\ 3x_1+6x_2+8x_3+10x_4&=c \end{align*} Setting up the augmented matrix and using RowReduce, ...
1
vote
1answer
335 views

How to track row swap in Gaussian elimination?

How do I track which rows were swapped in the Gaussian elimination using RowReduce? I am doing metabolic control analysis on a mathematical of the energy ...
4
votes
1answer
93 views

How to collect the negative eigenvalues of a matrix?

I want to plot Sum[E[i]] verseus t where E[i] are the negative eigenvalues of the matrix: <...
5
votes
1answer
235 views

Finding the orthogonal diagonalizing similarity of a symmetric matrix

I'm aware that there are some questions similar to this here, but none that could solve my problem. So, I have to diagonalize a symmetric symbolic matrix $m$ (to be seen below) and obtain the ...
6
votes
2answers
145 views

Inconsistency in eigenvalues of matrices in a specific form (sparse & non-Hermitian)

Suppose one has a non-Hermitian sparse matrix defined as: ...
1
vote
2answers
360 views

What is the fastest way to obtain the eigenvalues of a Wishart matrix?

I would like a fast method of creating a sample of random numbers which corresponds to the eigenvalues of a Wishart matrix: For M>N the eigenvalues \lambda_i are given by the jpd Where $K_N$ is a ...
2
votes
1answer
264 views

Returning the matrix which represents the row reductions in Gauss-Jordan Elimination

I have a square matrix A. I want to row reduce it so it is in Upper Triangular form. When row reducing you perform operations which can also be represented with matrices that are just multiplied to ...
4
votes
1answer
96 views

Partial transpose of 8x8 density matrix?

Please could someone help me to knew how to compute the partial partial-transposition of the following matrix? mat = Table[ρ[i, j], {i, 1, 8}, {j, 1, 8}]
5
votes
1answer
1k views

Compute numeric Pfaffians of matrices efficiently?

I have the following code, that computes the Pfaffian of an even dimensional anti-symmetric matrix via direct row expansion: ...
6
votes
1answer
78 views

How to use RiccatiSolve with symbolic matrix

According to the RiccatiSolve documentation the Eigensystem method can apply to symbolic matrices. However, I can not get it to ...
1
vote
0answers
59 views

Finding eigenvalues of a large ( >1000 x 1000) matrix accurately

I'm doing a spectral method-based eigenvalue problem where I create a matrix, A, of size (nr+1)(nz+1)(2nf+1) where nr,nz,nf are integers, composed of a diagonal of (2nf+1) submatrices of size (nr+1)*(...
1
vote
3answers
616 views

How to transform symmetric matrix to diagonal? [duplicate]

I wonder whether there is a way how to transform symmetric matrix to diagonal matrix using symetretric transformation. I could not find any function that performs symmetric transformation in ...
3
votes
2answers
152 views

editing entries of a sparse array + sparse Smith normal form

Why does the following code ...
0
votes
1answer
42 views

Strange numerical values of Eigenvectors

When I calculate Eigenvalues and Eigenvector by using: Eigensystem[{{3.8, 21, 21}, {0.3, 3.5, 2.5}, {-0.8, -6.2, -5.2}}] I get the following result: ...
1
vote
0answers
41 views

What does Eigensystem::geinsl1 mean (a solution for the generalized eigenproblem may be incorrect)?

I'm trying to solve a generalized eigenvalue problem and ran across a warning Eigensystem::geinsl1: Warning: a solution for the generalized eigenproblem may be incorrect. Here's a minimal working ...
4
votes
3answers
472 views

It seems Eigensystem[m] returns vectors that are not eigenvectors

I am new to here so please forgive me if I do something wrong carelessly. I have faced a serious problem in eigensystem method, or more particular, eigenvalue. It seems that the following codes that ...
1
vote
1answer
23 views

No Plot output for function using large output from LinearSolve

I am using least squares approximation to fit the data in Y. However when I attempt to plot the the curve g[x] using the results from LinearSolve, there is no plot output. ...
1
vote
2answers
95 views

Why the difference in the results of MatrixFunction between Mathematica and Maple?

Mastering my Mathematica skills, I consider an example m = {{1., 1., 3.}, {0., 1., 0.}, {0., 1.0*I, 2.}}; cosm = MatrixFunction[Cos, m] $$\left( \begin{array}{...
1
vote
2answers
153 views

What is LyapunovSolve::meig message about?

According to Wikipedia, a Sylvester equation $AX+XB=C$ has a unique solution for $X$ exactly when there are no common eigenvalues of $A$ and $-B$. But the following code gives me a message I don't ...
2
votes
1answer
43 views

`MatrixFunction` is returning a cryptic error message about “the function `1`”

The "Possible Issues" section of the documentation for MatrixFunction lists several possible ways in which a call to ...
1
vote
2answers
147 views

Small error on symbolic eigenvalue of $2\times2$ matrix

I have some computation where I specifically define a 2x2 matrix to have a specific eigenvector v associated with an eigenvalue g, and a second eigenvalue l : ...
3
votes
2answers
180 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 ...
2
votes
1answer
55 views

Calculating Minors of a 3x3 matrix not giving correct output [closed]

The function Minors[] does not return what its suposse to. Example: mat = {{a, b, c}, {l, m, n}, {x, y, z}} mat // MatrixForm Minors[mat] // MatrixForm The ...
14
votes
1answer
386 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) \\ ...
14
votes
4answers
1k views

How to solve this matrix equation

How to solve the following matrix equation? Solve[MatrixRank[{{1, x, 3}, {2, 4, 5}, {2, 4, x}}] == 2, x, Reals]
1
vote
0answers
69 views
3
votes
2answers
139 views

Programming with Mathematica Syntax - Dunford decomposition

I am always amazed while I am reading some solutions of problems in mathematical problems of this site with Mathematica. For instance, look at the problem 48. Whereas I am writing 100 lines of code ...
2
votes
1answer
52 views

multiplying in the reverse order? [duplicate]

I have to multiply the matrices in the reverse order such as f[4].f[3].f[2].f[1] Have to be done by loops, because I have to multiply 10000 matrices all numerical values, for example the below code, ...
23
votes
1answer
578 views

Wrong eigenvalues from a sparse matrix

Bug introduced after 5.0, in or before 8.0 and persisting through 12.0. I notice in the following example that wrong smallest 2 eigenvalues are resulted if calculating from a sparse matrix. But it ...
1
vote
1answer
74 views

SchurDecomposition doesn't work (in a weird way)

I have written a function to get the canonical form of a 3D quadric surface. This involves finding a unitary transformation of the coordinates which eliminates the cross-terms such as $xy$ or $xz$. ...
8
votes
1answer
249 views

Reusing PARDISO symbolic factorization

Is there a way to do this natively in Mathematica? I read in several places that this is possible with LibraryLink, but I don't have a lot of experience with C and so I'm having trouble implementing ...
1
vote
1answer
58 views

Arnoldi method misses eigenvalues degeneracies for very sparse matrices

I am here to signal a problem very very similar to the one already discussed here Wrong eigenvalues from a sparse matrix In particular, I have a very sparse matrix and I am asking just few dominant ...
4
votes
1answer
59 views

How do I perform an LU Decomposition without pivoting? [duplicate]

I know that LUDecomposition in Mathematica does a pivoted decomposition, finding an $LU$ such that $PA = LU$. However, I have a $4 \times 4$ matrix and I need to do ...
0
votes
0answers
53 views

“Greater” function gives me wrong order

When I try to sort the eigenvalues of the matrix (Rho) the results seems to be in the wrong order What is wrong with my code? ...
2
votes
1answer
50 views
1
vote
0answers
63 views

Least Square with quadratic constraint [closed]

I have the following problem:For $\theta \in \mathbb{C}^{n\times1}$, $\quad$ $Y=X\theta+W$ where $W \in \mathbb{C}^{m\times1}$ is the complex additive white Gaussian noise. $X \in \mathbb{C}^{m\...
6
votes
1answer
87 views

Implicit Riccati Equation Solver (to find the anti-stabilizing solution)

I've found that the latest MATLAB icare() solver includes the possibility to find also the anti-stabilizing solution of the Riccati equation. I haven't found a ...
4
votes
1answer
294 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 (...
20
votes
8answers
1k views

How to check if a vector is an eigenvector of a matrix using mathematica?

Here is a vector $$\begin{pmatrix}i\\7i\\-2\end{pmatrix}$$ Here is a matrix $$\begin{pmatrix}2& i&0\\-i&1&1\\0 &1&0\end{pmatrix}$$ Is there a simple way to determine ...
4
votes
2answers
94 views

Inputting values into the variables without having to input the matrix all over again

I'm practicing using LU decomposition on Mathematica. I am able to find the L & U matrices, specifically the variables. However, i find it tedious having to input the newly found values and form ...
13
votes
2answers
599 views

Why is Mathematica eating a row from QRDecomposition

I'm attempting to calculate the QRDecomposition of the following matrix: a = {{1, 3}, {0, 5}, {2, -8}} QRDecomposition[a] ...
0
votes
0answers
36 views

Parameter dependent linear independence check

Suppose I have a rectangular matrix $M(x)$ depending on a real parameter $x$. I want to find out for which $x$ are the columns of $M(x)$ linearly dependent (or equivalently, when $M(x)$ has a ...
2
votes
0answers
692 views

Diagonalization in parallel

I would like to diagonalize one unitary non-sparse matrix of size 12870 with complex number entries (not symbols, this is really a numerical problem). Is it possible to make eigensystem run in ...
0
votes
1answer
66 views

Mathematica's Plot3D function gives me a scrambled plot

When I plot the band structure of the Lieb lattice, which has the Hamiltonian given in this code, I get a scrambled plot in the output. I've tried the exact same procedure with many different lattices ...
3
votes
3answers
77 views

Need help with finding a matrix

Could anyone please help me find a 4 by 4 matrix A such that A.Transpose[A] exactly equals the following matrix: ...
1
vote
2answers
107 views

Finding the square root of a 7*7 matrix with real entries

Suppose that I have the following symbolic 7*7 matrix ...
10
votes
0answers
280 views

Mathematica package for explicit matrix representations of group generators?

While there are several packages that are capable of working with weights and roots (for example LieArt), I couldn't find any package that spits out explicit matrices for the generators, for example ...

1
2
3 4 5
23