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.
1,682 questions
77
votes
6
answers
21k
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 ...
50
votes
2
answers
27k
views
How to enter matrices in block matrix format?
Example:
I have a matrix $R = \left( \begin{array}{cc}
A & \mathbf{t} \\
0 & 1 \end{array} \right) $ where $A$ is 3-by-3 and $\mathbf{t}$ is 3 by 1. Or in Mathematica
...
45
votes
4
answers
2k
views
Eigenvalues broken in Version 12.0
Bug introduced in 12.0 and fixed in 12.1
The following code calculates the eigenvalues of a certain complex matrix, which come in pairs of opposite complex numbers. Therefore one can check whether the ...
44
votes
1
answer
2k
views
How to fit a linear model in the Bayesian way in Mathematica?
Basically, I'm looking for the Bayesian equivalent of LinearModelFit. As of the moment of writing, Mathematica has no real (documented) built-in
functionality for ...
44
votes
2
answers
7k
views
How can I improve the speed of eigenvalue decompositions for large matrices?
I often need to compute the eigenvalues of large matrices, and I invariably resort to MATLAB for these, simply because it is much faster. I'd like to change that, so that I can work entirely inside my ...
41
votes
1
answer
3k
views
Complex eigenvalues from a sparse Hermitian matrix
Bug introduced in 9.0 or earlier and persisting through 13.3.0.
I notice in the following example that wrong complex eigenvalues are resulted if calculating from a Hermitian sparse matrix, which ...
37
votes
2
answers
2k
views
eigenvector bug?
Bug introduced in 7.0.1 or earlier and fixed in 10.0.0
I have a fairly simple $3\times3$ complex matrix,
$$
M=\left(
\begin{array}{ccc}
\frac{7}{2}-\frac{i}{2} & -1+i & \frac{1}{2}+\frac{5 i}{...
36
votes
1
answer
2k
views
CPU timing for matrix rank calculation difference between 10.3 and 10.4 and 11.0
I run a small rank CPU test when new Mathematica version comes out. I noticed when version 10.1 came out that Mathematica rank calculation suddenly became extremely fast on a matrix when the size ...
34
votes
3
answers
7k
views
How to symbolically do matrix "Block Inversion"?
Consider a block (partitioned) matrix
matrix = ArrayFlatten[{{a, b}, {c, d}}]
where, a, b,...
33
votes
3
answers
2k
views
Computing polynomial eigenvalues in Mathematica
MATLAB offers a function polyeig for computing polynomial eigenvalues, which appear, for instance, in quadratic eigenvalue problems (see here for some applications) ...
32
votes
2
answers
8k
views
Simplify matrix algebra
I'm trying to simplify some matrix linear algebra, for example, simplify
$$\big(a1\times(A1\cdot A2)\big)\cdot\Big(a2\times A3\cdot A4+(a3\times A5)\cdot(a4\times A6)\Big)^{T}$$
where lower case ...
31
votes
5
answers
2k
views
Can (compiled) matrix permanent evaluation be further sped-up?
Update III Mathematica 10.2.0 now ships with a predefined System`Permanent function, which the PermanentCode package ...
29
votes
2
answers
1k
views
Wrong eigenvalues from a sparse matrix
Bug introduced after 5.0, in or before 8.0 and persisting through 13.3.
I notice in the following example that wrong smallest 2 eigenvalues are resulted if calculating from a sparse matrix. But it ...
28
votes
3
answers
2k
views
What are the counterparts in Wolfram to left and right division of a matrix in other programming language, e.g. Julia and MATLAB?
Sometimes, to find the inverse of a matrix is a labor-consuming task, or even "disgusting", especially when the matrix is "ill". It is said, e.g. in Julia, that the left/right division operation is ...
28
votes
2
answers
2k
views
Using the Krylov method for Solve: Speeding up a SparseArray calculation
I'm trying to implement this Total Variation Regularized Numerical Differentiation (TVDiff) code in Mathematica (which I found through this SO answer): essentially, I want to differentiate noisy data. ...