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
-1
votes
0answers
21 views

I want to draw the curve of Rayleigh mixture of 4 components [on hold]

How can I draw the Graph of 3 component mixture of Rayleigh distribution
4
votes
1answer
78 views

Efficiently calculating matrix exponential of a recursively generated matrix

Given a matrix $A$ of size $N \times N$, I want to evaluate the function \begin{equation} F(t) = |Tr(\exp^{-i A t})|^2 \end{equation} as a function of $t$. Here, $A[n]$ is constructed recursively ...
0
votes
1answer
31 views

Retrieve the independent variables from a linear replacement list

Is there a good way to convert a linear replacement list into a list of the independent variables? For example, I would like to take {n1->n3+n4, n2->n3+2n4} and get {n3,n4}, the variables that n1 and ...
1
vote
1answer
35 views

How to check if 0 polynomial lies in span of some polynomials?

I have lot of polynomials like this ...
9
votes
2answers
193 views

Solving “Lyapunov-like” equation AX+X'B=C

Is there some way I can solve the following equation with $d-by-d$ matrices in Mathematica in reasonable time? $$AX+X'B=C$$ My solution below calls linsolve on $d^2,d^2$ matrix, which is too ...
2
votes
1answer
39 views

Efficient Linear Operators on SparseArrays

I have a rank four SparseArray of dimension {40, 40, 40, 40}. I wish to apply a linear operator to it, whose form I know abstractly. That is, I have a simple closed form for the action of the operator ...
0
votes
1answer
76 views

(Row?) reduction of a system of equations

For a mathematical problem I am trying to solve, I have (say) $(N+1)$ inhomogeneous linear equations in $M$ variables of the form $$\sum_{a=1}^{M}c_{i a}p_{a} = \xi_{i} \quad \text{ where } i=1,\...
8
votes
1answer
182 views

Solving underdetermined Lyapunov equations?

I'm wondering if there's an efficient way to get a solution (ie, LeastSquaressolution) for Lyapunov equation $AX+XA=C$ with symmetric positive definite $ A $ and $ ...
1
vote
0answers
32 views

Getting a non zero determinant of matrix R, when the Rank of R is not equal to Dimension of R

I have a square matrix whose dimensions is 9 cross 9, when I extract the rank of the matrix R, I am getting rank as 6. I have constructed R matrix by minimizing the Lagrangian Lg with respect to a[1].....
0
votes
0answers
24 views

Sequential production of Eigenvectors?

I have to deal with very large matrices in Mathematica (dimensions $10^4\times10^4$ at least). Obtaining the eigenvalues of these matrices is not so difficult since, it is not memory intensive or ...
0
votes
0answers
30 views

How to solve this set of linear equations

I am trying to solve six linear equations, for which a solution exists (since it can be recovered by Matlab). I am trying to reproduce it here. I have the following MWE: ...
0
votes
2answers
73 views

Matrix equation solving

I am new to Mathematica and I try to apply the solution given to this problem. So I have: $$A = \begin{pmatrix}50 & 3 & 10 & 2\\\ 3 & 60 & 7 & 1\\\ 10 & 7 & 55 & 4\...
0
votes
0answers
38 views

Normalized eigenvectors are different depending on when the limit is calculated

I have this code: ...
2
votes
1answer
100 views

Plot feasible region of a high-dimensional LP only along some dimensions

I have a question on the possibility of using Mathematica to plot a convex closed region satisfying a linear system of equalities and inequalities. Let me first present the linear system. Let $x\...
4
votes
2answers
914 views

Two matrices that are not similar have (almost) same eigenvalues [closed]

I have two matrices $$ A=\begin{pmatrix} a & 0 & 0 \\ 0 & b & 0 \\ 0 & 0 & c \end{pmatrix} \quad \text{ and } \quad B=\begin{pmatrix} d & e & f \\ d & e &...
0
votes
1answer
88 views

How can I get the Eigen system of a certain matrix? [closed]

How can I get Eigen system of c, where c = a - iota * b? Please help me to find the Eigen system in a nice form. ...
8
votes
1answer
141 views

Getting scores from PCA

I'm not super familiar with Principal Component Analysis, but from what I understand, it sorts a vector in order of decreasing variance, and uses that to transform the vector to correlate variables ...
3
votes
0answers
60 views

Derivative of eigenvalues

I work with 4x4 Hermitian matrices (r). I want to calculate a derivative of a function f[t,r] (ff[t_,r_]=1/2*D[f[t,r],t]), where the function f depends on the absolute value of the eigenvalues of r. ...
6
votes
1answer
94 views

Finding the null space of a large sparse matrix

I am trying to compute the null space of a large $n\times n$ sparse matrix. No matter how large the dimension of the matrix is, it will always look like as below: The figure on the left shows the ...
3
votes
2answers
754 views

Problem with Eigenvectors

When I want to calculate eigenvectors of the following matrix in Mathematica the only answer it gives me is zero vector, anybody knows how to fix this? here's my matrix : \begin{equation} X=\left(\...
0
votes
1answer
122 views

Can I diagonalize a 512 by 512 matrix? [closed]

...with Mathematica? Or is this going to be impossible? I don't want to start work if it is hopeless. I've already solved the problem on a smaller scale, which involved an 8x8 matrix. ...
5
votes
2answers
92 views

Fast algorithm for finding all solutions of simple equation involving only addition of terms from list

I have a list $X=\{n_1,n_2,n_3,n_4, \dots, n_i\}$ with $n_i \in \mathbb{C}$, an integer $m \in \mathbb{N}$ and $S \in \mathbb{C}$. My question is how to find all solution to the equation $$\sum_{j=1}^...
34
votes
1answer
1k 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 ...
5
votes
1answer
55 views

MatrixConditionNumber does not work in version 12.0

A = {{1., 0.}, {0., 2.}}; LinearAlgebra`MatrixConditionNumber[A]
4
votes
0answers
125 views

Speed improvements and confusion for MapThread and Dot

I have a question / confusion over improving the speed of MapThread[Dot,...] for lists of tensors. My problem involves taking two lists of tensors and then ...
1
vote
1answer
36 views

Identification of linear combinations in a matrix

I have a matrix R which is having a dimension of 20 cross 20. When I extracted the rank of this matrix I got 16. I just wanted to which are these four rows are or columns which are dependent on each ...
1
vote
1answer
66 views

Phase choice for Singular Value Decomposition

I'm using SingularValueDecomposition to find the unitary matrices that diagonalize a given matrix (that I have). This decomposition is unique, up to multiplication for an arbitrary phase of each ...
1
vote
2answers
34 views

Checking if a system of linear equations admits a positive solution

How can I use Mathematica to check if a system of the form $A x > 0$ admits a solution $x\geq 0$ where $A$ is a $m \times n$ matrix and $x \in \mathbb{R}^n$. All inequalities are to be understood ...
0
votes
1answer
36 views

Conditions to make unitary a given matrix

Suppose I have some symmetric matrix W = {{c[1, 1], c[1, 2], c[1, 3]}, {c[1, 2], c[2, 2],c[2, 3]}, {c[1, 3], c[2, 3], c[3, 3]}}; where the c's are complex and I ...
1
vote
1answer
175 views

How do you avoid Null in matrix? [closed]

The following matrix equation is a Lyapunov equation, $$ mA.x+ x.mA^T=-mC,$$ the matrix $mA$ is given by $$ ...
5
votes
4answers
209 views

Maximum of determinant of $n\times n$-matrix with elements 0 and 1

Generalizing https://math.stackexchange.com/questions/3265627/largest-value-of-a-third-order-determinant-whose-elements-are-0-or-1 I'd like to propose two related problems (a) find the maximum value ...
0
votes
0answers
32 views

Ordering of Eigenvectors [duplicate]

I am interested in computing the derivatives of the eigenvalues of a certain $n\times n$ Hermitian matrix $M(t)$. I know I can do this easily since I know the exact expression for $\dot{M}$, and the ...
18
votes
3answers
355 views

Generate coefficient array from general formula of linear equation system

This is a problem coming out in the implementation of finite difference method (FDM). Here is a toy example. Suppose we want to solve the boundary value problem (BVP) $$y''(x)=\sin(x),\ y(0)=0,\ y(...
5
votes
1answer
84 views

Efficient way to sum over an index repeated more than twice

I'm looking for an efficient way of computing sums of the type $$D_{jk} = \sum_{i=1}^n A_{ij} B_{ik} C_{i}$$ for large numerical matrices $A$, $B$ and $C$. Here is a slow solution: ...
4
votes
1answer
101 views

Selecting unique column position of a non-zero value for each row of a matrix

I have a matrix in this case of 3x11, but I want this to work for any dimension matrix. I want per row a column position on a non-zero value in that row, but that this value should be different than a ...
0
votes
1answer
59 views

Sum of powers of zero [duplicate]

I would like to calculate the following sum Sum[0^(k-a), {k, 0, Nin}] for a positive integer $a$. With considering $0^0=1$, my expected answer of the sum is $1$, ...
0
votes
2answers
75 views

How to get eigenvectors of a 4x4 matrix? [closed]

MatrixForm[m = {{2, 9, 0}, {3, 8, 9}, {3, 9, 1}}] Eigensystem[m] I am facing problem in finding eigenvectors using ...
0
votes
0answers
24 views

Two coordinate rotations and a translation to for a 4x4 matrix

I am looking to do ewo coordinate rotations and a translation. I'd like the new coordinate system to be shifted by x,y,z (in the directions of the same name) and then rotated by theta in the x hat ...
0
votes
0answers
18 views

Solve, store, and access eigenvalues and eigenstates of M[x,y], for various points {x,y}

I'm interested in solving a position dependent eigenvalue problem for matrix M[x,y], where {x,y} is some discretized set of points. I may need to access the eigenstates and eigenvalues multiple times ...
5
votes
2answers
144 views

Lowest Magnitude Eigenvalues of Large Sparse Matrices

I am trying to find the first three lowest eigenvalues of large sparse matrices of size range $10^3 - 10^5$. The matrices depend on some parameter $x$, so I first construct the matrices and then use ...
0
votes
0answers
26 views

Inverse of Sparse Diagonal Array not Sparse

Kind of bummed that when I take the inverse of a matrix that is a diagonal sparse array, the result in not a sparse array. Further, the time to compute the inverse is the same as the time to compute ...
0
votes
3answers
72 views

Expand and Simplify do not work for NonCommutativeMultiply

Expand and Simplify do not work for NonCommutativeMultiply[] then how do we expand an expression like (a+b)**(a-b) ?
0
votes
0answers
34 views

Solving equations, checking linear dependency of equations

I have the following input and try to do solve the equations for in total four unknowns. When I run the input only "solutions" for two of the four unknowns are given in the output. I am not quite sure,...
2
votes
1answer
48 views

Is there a method to preserve order when matrix multiplying in Mathematica?

I know that commutativity can be preserved in Mathematica by using ** i.e. a*b can get printed as b a but if I use a**b then it will always be printed as a b. However, I am not able to implement ...
1
vote
0answers
34 views

Bug in SmithDecomposition?

While trying to calculate the SmithDecomposition of an integer 293x329 matrix with less than 3000 non-zero elements in the range -4 to 3 several errors occur, none of them which seem to make any sense ...
1
vote
1answer
68 views

How to interchange columns of a matrix? [duplicate]

Suppose I have a matrix M={{1,2,3},{4,5,6},{7,8,9}}//MatrixForm What code do I write to interchange columns and make it into ...
3
votes
1answer
121 views

Possible speed improvement for numerical linear algebra?

I have a question about further optimising a numerical linear algebra calculation. I've trawled through many useful posts on this site and have ended up with something quite efficient - I was ...
4
votes
1answer
186 views

Inconsistent results from Wolfram Cloud [closed]

More specifically, I was using the "no sign-in" option of Wolfram Programming Lab. I was trying to solve a matrix problem, with the following code: ...
0
votes
1answer
70 views

How do I treat polynomials as vectors?

From time to time I find myself in the following situation. I have generated a list of polynomials from some ring $R=\mathbb R[x_1,\ldots,x_n]$ and now I wish to view these polynomials as vectors in ...
0
votes
1answer
22 views

Computing Jacobian of $T(z,t) = (zt, z(1-t))$ [closed]

For $T: \mathbb{R}^2 \rightarrow \mathbb{R}^2$ s.t. $T(z,t) = (tz, (1-t)z)$, how does one use Mathematica to compute the Jacobian matrix of $T$ (to then compute its determinant)? Suppose $(z,t)$ are ...