Stack Exchange Network

Stack Exchange network consists of 175 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.

0
votes
1answer
82 views

Solving inequality using matrix form condition

I took the problem from first example of here *answer is $x=(10,5)^T$ (a,b) is inner product. x and y is 2d vector. Find $\bar{x}$ within the area by the systems of inequality,$K(x)$ s.t. ...
0
votes
0answers
45 views

Understanding Transpose, dot and at [on hold]

I found this formula Transpose[{Tv1, Tv2}].Inverse@Transpose@{v1, v2}.{x, y} in some post but lost the link. Now I need to understand why this formula solve my ...
4
votes
2answers
51 views

Element-wise multiplication of matrices with different dimension

I am interested in efficient element-wise multiplication of matrices with different dimension. Here is my solution: Matrix 1 with dim = {3, 4, 4} ...
6
votes
4answers
149 views

Identifying points in the frontier of a set

Let me start with an example. Let $$\mathbf{A}=\begin{bmatrix}3&1\\2&3\\1&5\end{bmatrix},$$ and let $Q=\{\mathbf{q}\vert\mathbf{q}\in\Bbb R^3_+ \land \sum_i^n q_i=1\}$ and $\alpha=\bigl(\...
0
votes
0answers
13 views

numpy.linalg.solve returns a solution for a matrix that is not full rank [migrated]

I've been learning the basics of OLS regression, and was told that there can't be perfect multicolinearity in the model. I have a matrix that is obviously not of full rank: ...
4
votes
0answers
53 views

Orthogonal matrix decomposition of symmetric matrix?

If matrix mat is symmetric, we should be able to decompose it into eigenvalue matrix matJ and orthogonal matrix ...
2
votes
2answers
71 views

Unable to evaluate Eigenvalues and Eigenvectors for a matrix (2)

I have posted a similar question last year pertaining to this issue. Here's a link to my post together with the solution given: Unable to evaluate Eigenvalues and Eigenvectors for a matrix I have ...
1
vote
1answer
37 views

Why do I keep getting the same time from the Timing function?

I am running a gamblers problem solution where I am testing the timing involved in solving the Ax = b equation for matrices of n=100, 1000, 10000, and 100000. For some reason I keep getting the same ...
3
votes
1answer
33 views

How can I create a large matrix without running into hangs or recursion errors?

I'm trying to create a probability matrix, starting by creating a 100,000 by 100,000 identity matrix. However, when I try to create this using: ...
2
votes
0answers
31 views

Reduce returns false on equation solvable by LInearSolve

I was looking for general solutions of an equation I already solved for specific values with LinearSolve, but using Reduce returned False. Here's the code: ...
2
votes
1answer
59 views

How can I tell if a matrix is ill-conditioned or Singular by using the Eigensystem function(or LUDecomposition)?

I'm using the Eigensystem function, and I'm trying figure out whether or not it is singular or ill-conditioned. I'm using the function as so: ...
11
votes
2answers
738 views

Solving “Resistance between two nodes on a grid” problem in Mathematica

In the context of resistor networks and finding the (equivalent) resistance between two arbitrary nodes, I am trying to learn how to write a generic approach in Mathematica, generic as in an approach ...
0
votes
0answers
39 views

SymFullRankQ - a function that calculates the conditions for a matrix to be full rank

I found in this article references to a function that manages to do this: is used to find the conditions for the symbolic matrix E to have full rank This is actually very interesting and useful. ...
4
votes
2answers
237 views

Numerical value of Determinant far from what it is supposed to be

I have a large matrix with numerical components and want to set the determinant to zero using the parameter h (see below). Naively, I would have expected that ...
4
votes
1answer
69 views

Using Non-Negative Matrix Factorization (NNMF)

I am trying to understand NNMF (Non-Negative Matrix Factorization). This is not a built-in function in Mathematica, but there is a package that implements it, which is refered to in this post. The ...
1
vote
1answer
29 views

Find coefficient in a linear combination

It's a very simple problem, but I don't find the way to solve it with Mathematica. let's say $A=a+b$, $B=3a$, $G=b$. I want to find at least one (if any) solution to $x A+ y B=G$ for $x,y$. I tried ...
5
votes
2answers
268 views

All possible A of Ax=b with constraints on A

I have a linear problem that I want to solve but the method is quite different from normal, the problem is still Ax=b. However, in this instant I have A being unknown, apart from the fact that each ...
0
votes
1answer
48 views

Strange answer for Eigenvalues of a 4x4 matrix [duplicate]

I am getting these strange eigenvalues of this simple looking 4-dimensional matrix: ...
0
votes
0answers
27 views

Linear dependency of vectors of functions

I would like to find a symbolic way to obtain a Q-function (Boolean output) for the following problem. I have the following inputs: ...
0
votes
1answer
38 views

How to prove rank(A+) is no more than rank(A)? [closed]

look here my friend. How to prove the following equation? Or give a counter-example. Thank you so much $$\text{rank}(A^+)\leq \text{rank}(A)$$ where $\text{rank}(A^+)$ represents the positive ...
2
votes
2answers
48 views

Normalize a vector: error [duplicate]

I have this simple example in which I am trying to write a column vector (ket vector) and then I want to normalize it. It seems that ther is something wrong, leading to an error message "The first ...
1
vote
0answers
25 views

Gauss elimination, reordering rows based on pivot values

I'm trying to create a code for Gauss elimination such that if there's a zero pivot during elimination, the equation will be reordered with the next row with a non-zero element and if it can't do that ...
-2
votes
1answer
52 views

Mathematica Plot [closed]

How can I plot List in Mathematica
0
votes
1answer
82 views

Triple product in spherical coordinates

Given six real numbers $a,b,c,d,e,f$ (say between $0$ and $\pi$) I would like to express the following determinant in a compact and "reasonable" way: $$ \det \begin{bmatrix} \sin a \cos b & \sin ...
4
votes
2answers
365 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 ...
1
vote
2answers
51 views

Different Value for LU Decomposition [duplicate]

When I try to LU decompose a matrix m, I get a different result in mathematica than an online calculator. Mathematica also gives me values that is different from my own derived values for the elements ...
0
votes
1answer
63 views

Determinant of the symbolic matrix is giving very large expression

I have a symbolic matrix of size 16 by 16. I tried to get the determinant of this symbolic matrix, but it turned out to be a very large expression. How to make this expression concise so that it ...
2
votes
0answers
46 views

“Learning” to parameterize Hermitian matrices with a basis using neural networks

I'm interested in using neural networks to "learn" how to write down Hermitian matrices, specifically those which are defined over spaces with a specific tensor product structure. The simplest example ...
1
vote
2answers
60 views

Eigenvalues error: “The method ”Banded“ accepts only sparse matrices with elements that are machine-real or machine-complex numbers”

I'm having one issue with the Eigenvalues function in some code priorly discussed here. There the example is tridiagonal, but here, let us consider this simple ...
8
votes
1answer
442 views

3.4 GHz Ryzen 5 slower to diagonalise large matrix than Intel i5-6300U 2.4 GHz

Sorry that this is quite a specific question but I need to diagonalise large matrices for the problem I'm trying to solve and can't for the life of me work out what's going on: I was expecting that ...
6
votes
2answers
735 views

How to optimize Mathematica code that depends on eigenvalues of big matrices and big sums?

I've been using Mathematica recently to generate some plots of a few functions. I've been able to get it right after a few questions here. The resulting code, which works, is this: ...
2
votes
0answers
58 views

Memory leak in SmithDecomposition?

While trying to compute a large number of Smith decompositions in Mathematica 11.0 under Windows 10, my computer keeps running out of memory for no apparent reason. Here is a self-contained example ...
1
vote
0answers
54 views

Integrating wavefunctions over a sphere

I am attempting to numerically solve the inner product of two particles and an electric dipole interaction potential. I am incredibly limited in my skills, and need to know how I can begin setting the ...
3
votes
1answer
48 views

Is it possible to solve for a matrix $ m $ satisfying $ m\cdot x=b $, given the vectors $ x $ and $ b $?

At first I thought it should be LinearSolve, which however turns out aiming at x, given m ...
2
votes
1answer
99 views

What am I doing wrong when trying to plot this function?

I'm trying to reproduce the computations of this paper and I'm running into some troubles because I'm rather new to Mathematica. In the paper's page 4, in figure 2 the authors show a plot of a ...
6
votes
0answers
54 views

Where is the mistake in computing the particular eigenvector of the following DFT Matrix?

I have the following matrix (the DFT Matrix for N = 3) $$W = \frac{1}{\sqrt{3}}\begin{pmatrix} 1 & 1 & 1 \\ 1 & e^{-\frac{i 2 \pi}{3} } & e^{\frac{i 2 \pi}{3} } \\ 1 & e^{\frac{...
4
votes
1answer
96 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 ...
3
votes
1answer
28 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
85 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.
4
votes
1answer
78 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
69 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' ...
6
votes
2answers
175 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 \times 15$ matrix ...
1
vote
1answer
48 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
86 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
56 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 ...
1
vote
2answers
289 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
47 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
145 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
53 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 ...