Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

3
votes
1answer
23 views

Why doesn't this Kronecker Product work with columns, but with rows?

Using the formula given in this math.stackexchange answer by the user greg $$\eqalign{ vec(M\otimes dK) &= \left(\pmatrix{I_T\otimes (M \cdot e_1)\cr I_T\otimes (M \cdot e_2)\cr \vdots \cr I_T \...
0
votes
2answers
73 views

Verifying equality $ (\vec a \times \vec b)^2 = \left| \vec a \times \vec b \right| ^2 $

I'm trying to verify the equality $ (\vec a \times \vec b)^2 = \left| \vec a \times \vec b \right| ^2 $ in Mathematica. How can I do it? Thank you for your time.
0
votes
0answers
24 views

A function to create a Symmetric Positive Definite Matrix, from any matrix. Why doesn't it work? [on hold]

I've created the following function with the purpose such that, given any square matrix, it should return the closest(system precision dependent) symmetric positive definite matrix. ...
0
votes
0answers
4 views

How to show x1y1 + x2y2 - (x3y3 + x4y4) > 0 [migrated]

I have the following information x1 < x3 < x4 < x2 y1 < y3 < y4 < y2 x1 + x2 = x3 + x4 x1 + a = x3 x2 - a = x4 Is there any possibility for me ...
4
votes
1answer
70 views

Fastest, and numerically stable way to compute $CA^{-1}B$ and $CA^{-1}x$?

I have to compute $CA^{-1}B$ and $CA^{-1}x$, where $A,B,C$ are conformable matrices and $x$ is a vector. I'm not sure if it helps, but $A$ is symmetric and positive definite. The $A$ matrix will be ...
7
votes
0answers
55 views

Matrix-free Arnoldi method for eigensystems

I am solving a generalized eigenvalue problem $$\mathbf S\,\mathbf x = \lambda\,\mathbf M\,\mathbf x$$ w/ $\mathbf S := \mathbf B\,\mathbf A^{-1}\,\mathbf B^{T}$, and $\mathbf A$ is a sparse ...
0
votes
1answer
68 views

What is going wrong when I try to solve a simple linear equation? [closed]

I'm trying to understand how does the LinearSolve function works. I'm trying it out like this: A' ...
4
votes
1answer
77 views

Catastrophic loss of accuracy in Orthogonalize

Context In connection to this question I am interested in orthogonalizing known matrices. As a test case, let us consider the definite positive 15 x 15 matrix mat ...
1
vote
1answer
47 views

The Equation for solving Matrix is stiffnessmatrix.d == F

The Equation for solving Matrix is stiffnessmatrix.d == F. Where I know the Matrix {d} and [F] but [ stiffnessmatrix] is an 18x18 matrix contain 8 variable i need to solve for. Can anyone provide code ...
0
votes
1answer
50 views

Solve a system by Cramer's rule using loop

Consider the linear system AX=B,where A={{3, 0, 2}, {-3, 2, 2}, {2, -3, 3}},B={{3}, {-1}, {4}} and x=...
0
votes
1answer
48 views

Solving system of equations for coordinates

This is my first time here, so let me know if there's something I need to add to the post etc. Anyway, I need some help with Mathematica and linear algebra, and I got some tips that this would be the ...
0
votes
0answers
77 views

Solving the eigenvalue system [migrated]

$Au_{m,n}+Bu_{m-10,n-10}+Cu_{m+10,n+10}+Du_{m,n-10}+Eu_{m-10,n}=\lambda u_{m,n}$ where $A=0.01(m^2+n^2),\quad B=0.1(m+n),\quad C=0.1(m-n),\quad D=0.1 m, \quad E=0.1 n$. and $m,n$ range from $[-50,50]$...
1
vote
2answers
154 views

Orthogonal Projection of vector onto plane

I'm currently trying to learn Mathematica, and I've got some linear algebra tasks to solve with it. I've gotten quite far but now I'm stuck on this one exercise. The instructions are: With the help ...
1
vote
0answers
44 views

L1-norm optimization algorithm crashes kernel on large datasets

I have an A.X-B linear system which I have transformed into A.x-b to be solvable as a linear program using the code below: ...
2
votes
1answer
116 views

Change of basis in Mathematica

I'm trying to set up a change of basis matrix from the base V -> W with the RowReduce function that's built into Mathematica. I am then supposed to verify the result by taking the product of the ...
-1
votes
1answer
46 views

Plotting Base-vectors not working properly [closed]

I'm stuck on a issue that I can't seem to solve. After defining values for V, W and x, I'm supposed to Plot two base-vectors in the base V and with the vector x in the same picture. I'm supposed to ...
1
vote
1answer
33 views

Find Transformation Matrix for Vectors of Functions, and Restrict Results of Solve Function

I have two vectors v,w which have a rather simple linear transformation A.v=w. My goal is to obtain ...
0
votes
1answer
70 views

Solve integer linear system [closed]

I want to find a solution of the system $$A x = 0,\quad x>0,\ x\in\mathbb{Z}^d$$ where the matrix $A$ has integer entries. With a single solution I am happy. There is a way to do this? If not, can ...
1
vote
0answers
52 views

Tensor Contraction Speed Up (Matrix Product States)

I'm recently trying to implement some tensor contractions in Mathematica for use in Matrix Product State algorithms. Here's the operation I want to perform $$ M^{\sigma_{i}\sigma_{i}'[i]}_{(b_{i-1},...
2
votes
2answers
52 views

How to reduce the determinant of a matrix to its simplest form

I have a $ 12\times 12 $ matrix, of which I have taken the determinant. And I get a very big expression with three unknowns K1, ...
1
vote
0answers
38 views

Normal form for Hopf bifurcation

I'm trying to obtain the normal form for the Hopf bifurcation using mathematica. I was looking at the following article: downloads.hindawi.com/journals/sv/1995/581272.pdf and I´ve tried to solve (25)...
1
vote
1answer
62 views

Partial trace and Partial Transposition of a matrix easily? [closed]

Could someone help me to understand as to how to compute the partial trace and partial-transposition of an arbitrary matrix? I mean, is there any code to carry out these operations in Mathematica? ...
0
votes
0answers
18 views

Find value of expression based on variable equality instead of assignment

I have certain relations or equalities which determine how different variables are related to each other. These relations are meant to be used to further calculate the value of some other expression. ...
0
votes
0answers
14 views

How to transform a real matrix with complex eigenvalues into a positive definite real matrix?

If the matrix had real eigenvalues, I would substitute the negative eigenvalues by a small positive number. However, I have complex eigenvalues... How should I proceed to transform the original ...
0
votes
0answers
32 views

Find a matrix that are unitarily equal to the given matrix

I have four $5\times 5$ matrices, $P_i, Q_i$ ($i=1, 2$) as follows: $P_1=\begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & -...
4
votes
1answer
56 views

Populate matrix from linear system

What is the strategy to populate a matrix from a linear system of equations? As a toy example, I have some scary, complicated math, that generates eq1 and ...
1
vote
1answer
53 views

What is the best way to compute the set of vectors normal to a given one?

For 2D vectors, computing the vector orthogonal to a given $v$ is straightforwardly done using Cross, as for example shown here. However, ...
2
votes
1answer
24 views

Checking range of values of a symbol for which a matrix is positive definite

Very much related to this question: Checking if a symbolic matrix is positive semi-definite Is there a way to tell for which values of symbols a matrix is positive definite? For instance if ...
30
votes
1answer
1k views

Wrong eigenvalues from a sparse matrix: eigenvalues are nonreal

Bug introduced in 9.0 or earlier and persisting through 11.3. I notice in the following example that wrong complex eigenvalues are resulted if calculating from a Hermitian sparse matrix, which should ...
2
votes
0answers
48 views

How to construct a time-dependent matrix quickly?

In the process of discretization of a 4D PDE, I need to construct a final sparse matrix $B$, which is very large (I denoted by $\text{size}$ here) and time-dependent, viz, some of its entries change ...
3
votes
1answer
50 views

Solving $\det{(A+\epsilon B)}=0$ for large, symmetric and dense $A$ and $B$

In an algorithm I am writing, I need to solve the equation $$ \det{(A+\epsilon B)} = 0, $$ for the smallest value of $\epsilon$, given large ($n$x$n$ ideally up to 150x150), dense and symmetric A ...
0
votes
1answer
39 views

Is there one or more solutions to this system of stiff linear equations?

it is a question of hydrodynamics,and i have evaluated all the known Physical quantity,so there are only 6 unknown, I use the default of the solve function, but it can't get a solution, ...
1
vote
2answers
113 views

I have two lists that are the same, yet I get a FALSE when i try to show they are equivalent

I have tried changing the variables, reevaluating the cells, but it just keeps giving me false. The weird part is that it was originally true and it changed to false, randomly.I did not want to post ...
4
votes
3answers
124 views

Eliminating linear combinations from lists

Suppose I have a list of simple expressions, something like: list = {{a-b-2c-d+e+2f},{-a-2b-c+d+2e+f},{-2a-b+c+2d+e-f},{x-y-z},{-x+y-z},{-x-y+z}}; These ...
11
votes
2answers
336 views

Making an interactive visualization of the eigenvectors of two-dimensional matrices

I've recently stumbled upon this very nice interactive visualization of eigenvectors of two-dimensional matrices, and how powers $A^k$ act on various vectors. How can this sort of visualization be ...
2
votes
1answer
50 views

Eigensystem for simple equi-correlation matrix

I'm trying to get a set of eigenvectors for a correlation matrix, but getting stuck, maybe because I do not properly normalize them. For example, the following code works, in the sense that I get back ...
3
votes
2answers
57 views

Find the base vectors of a point set

I have a list of coordinates that fits into a 2D periodic lattice, with some error ( $\vec{R}=n\vec{i}+m\vec{j}+\vec{\varepsilon}$). Is there a way to find the base vectors of the lattice? I guess the ...
1
vote
1answer
90 views

Save and use results of LinearSolve for symbolic large system (28 equations)

I need to solve system of 28 linear equations, for 28 variables, symbolicly. The coefficient matrix is sparse, and is composed from 8 parameters (symbols). After that I need to use 6 of the variables ...
4
votes
1answer
141 views

Summation of Kronecker deltas should give the dimension

I have a really simple problem but I don't know how to solve it. Basically, I am doing vecor manipulation and I am summing a lot of Kronecker delta here and there. How can I teach Mathematica that for ...
1
vote
1answer
47 views

An error of unequal length when using Transpose[y]? [closed]

Why do I get this error? I just clicked shift+enter in the y and it appeared. https://i.stack.imgur.com/IAKs8.png This is the data ...
0
votes
0answers
18 views

Matrix multiplication Q.W not working - Result=matrix Q . matrix W [duplicate]

When I write the code to do the dot product between two matrices, Mathematica does not compute it: How can I get the right matrix? EDIT Thank you for your willingness.
0
votes
1answer
88 views

How to find clusters with same cluster sizes?

I have a set of 71 data points. Each data point is represented by its latitude and longitude. I want to divide them into 12 clusters. The first 11 cluster will have exactly 6 points each and 12th ...
0
votes
1answer
60 views

How to solve a matrix $ Ax=0 $, where matrix $ A $ is a function of $ ω^2 $ [closed]

I have a matrix $ A $ which depends on $ ω^2 $. I wanted to solve for $ ω $. The usual procedure is taking the Det[A] and equate to zero and solve for it. How can I ...
1
vote
0answers
41 views

Find value of variable for unique, infinite and no solutions in equation system

How do i find which values of a variable in a equations system that gives unique, infinite and no solutions? My example: \begin{align*} ax + y + az &= 2 \\ x + ay + z &= 2 \\ x + ...
2
votes
1answer
84 views

Getting least norm solution

Noob question -- how should I get least norm solution in Mathematica for an under-constrained problem? Matrix is not full rank. I could use pseudo-inverse, but inverting a matrix to get a single ...
0
votes
2answers
46 views

Calculate value of expressions based on solution of given linear equations

I have these three equations: 1/X + 1/Y == 1/15; 1/Y + 1/Z == 1/20; 1/Z + 1/X == 1/25; I want to calculate the value of expression: ...
0
votes
0answers
26 views

Matrix equivalence over the integers

Is there any efficient way to tell whether two matrices $a,b$ are equivalent over the integers? That is, whether there exists some integer-valued matrix $c$ such that $$ a=c^Tbc,\qquad |\det(c)|=1 $$ ...
1
vote
0answers
27 views

How do I maximise the first real root of a multi-variable polynomial in x?

I have a polynomial in x, that also depends on {y1,y2,y3,y4,y5}. It always has 10 (not necessarily distinct) real roots. It's top coefficient is (1*x^10) I aim to find the y's that maximize the ...
2
votes
2answers
53 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 ...