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
0 votes
1 answer
39 views

Decomposing a quadratic form as a linear combination of squares of linear forms

Given a quadratic form $q: E \to \mathbb{R}$ (where $E$ is some vector space), it's always possible to find a decomposition of the form $$q(v) = \sum_{i=1}^n \alpha_i l_i(v)^2,$$ where the $\alpha_i \...
Najib Idrissi's user avatar
3 votes
1 answer
152 views

Implementing Brockett's Flow in Mathematica

Motivated by this post and this paper is an attempt to implement this simple relation in Mathematica to diagonalize a $(2,2)$ matrix. However, the result is not diagonal after iterating discretized ...
Yaroslav Bulatov's user avatar
0 votes
0 answers
56 views

Underflow using Eigensystem for large mass and stiffness matrix with large stiffness values

I am trying to use the Eigensystem command to determine the eigenvalues and eigenvectors of a multi-degree of freedom system. Currently, I have a mass matrix and a ...
Panagiotis Andreou's user avatar
0 votes
0 answers
62 views

How to find linearly dependent eigenvectors of non-diagonalizable matrix (with exceptions)?

Here is the code to produce a $9\times9$ matrix: ...
ZHENGYAO HUANG's user avatar
1 vote
0 answers
54 views

LeastSquares takes too long

I'm trying to design a simple FIR low pass filter with least-square-error approach. Below is the code for obtaining the impuse response of the filter. It is but to solve the overdetermined matrix. <...
metroidman's user avatar
6 votes
1 answer
201 views

Visualizing pseudo-spectra of large matrices

I'm looking to reproduce some pseudo-spectra figures on Mark Embrees' site https://www.cs.ox.ac.uk/pseudospectra/random/dense.html In particular, a pseudo spectrum of a random square matrix with $N=...
Yaroslav Bulatov's user avatar
5 votes
1 answer
82 views

Saving solutions of equations with indexed variables to a table

I am trying to solve a set of equations which are very ugly and have indexed variables. I have a vector of expressions ...
QFTheorist's user avatar
1 vote
0 answers
84 views

The first step to Speed Up using GPU

If we run the following code, mathematica kernel uses only CPU : LinearOptimization[ x + y, {x + 2 y >= 3, x >= -1, y >= -1}, {x, y}] I want the ...
imida k's user avatar
  • 3,935
1 vote
1 answer
87 views

Solving a large system of linear equations

I am very new to Mathematica (started two weeks ago), and I am trying to solve a system of linear equations consisting of nine equation. My matrices A and ...
SiPh's user avatar
  • 11
1 vote
1 answer
101 views

Fit a point that defines a 90° angle

I'm trying to come up with a fit that will give me x,y coordinates of a point, that best fit in 2 slopes, the 2 slopes intercepting at 90°. At the moment I fit individually 2 lines to a 2 sets of ...
A postdoc's user avatar
  • 159
3 votes
1 answer
91 views

Tensor product inside the compiler

The compiler does not have support for tensor product, are there any packages that implements the tensor product in a way that can be compiled? I need to take the tensor product of several numeric ...
Felipe's user avatar
  • 299
5 votes
1 answer
144 views

What is computed by LinearAlgebra`Private`MatrixConditionNumber?

The following returns 51/7, even though the condition number is actually 9. I'm curious, what does 51/7 correspond to for this matrix? ...
Yaroslav Bulatov's user avatar
0 votes
0 answers
83 views

Break symbolic eigenvalue calculation early

I am computing eigenvalues of matrices with single monomial entries (x,y,z, etc.) and for efficiency, need to truncate calculations early if any eigenvalues contain non-linear (x^{2}, \sqrt(x),x*y etc....
JJJJJJJJJJJJJJJJ's user avatar
8 votes
2 answers
381 views

Given square matrices A and B, how to solve T obeys Transpose[T]. A . T = B?

Dear Mathematica experts, Given two square matrices, A and B, how do we use Mathematica to solve a matrix T such that T satisfies this matrix equation? (Here we have A,B,T $\in$ general linear matrix ...
zeta's user avatar
  • 251
4 votes
1 answer
74 views

Is there a non-allocating way to modify elements of single-reference packed arrays?

I need to repeatedly increment cuboidal chunks of a 3D image. The image is large - on the order of 1G elements. The only way I know of doing it using built-in Image functions is: ...
Kuba hasn't forgotten Monica's user avatar
1 vote
0 answers
86 views

Output a 24 by 24 Leech lattice

Input a rank-8 $E_8$ lattice, $$ M_{E_8}=\begin{pmatrix} 2 & -1 & 0 & 0 & 0 & 0 & 0 & 0 \\ -1 & 2 & -1& 0 & 0 & 0 & 0 & 0 \\ 0 &...
zeta's user avatar
  • 251
0 votes
1 answer
71 views

A simpler way of identifying which elements of Tuples[{0,1,2,3},6] multiply with each of my codewords to give zero?

So I have a list of codewords. The codewords have length 64, so there are 64 codewords in my code. My code is over an alphabet of 4 (the code can be thought of as having four elements $0,1,2,3$ and ...
am567's user avatar
  • 491
2 votes
1 answer
85 views

How to create a vector as a tensor object for different euclidean bases?

The components of a tensor are always displayed with respect to one or multiple basis vectors. For a tensor of rank 1, a vector, in 3D-euclidean space, we resort to three orthonormal basis vectors. ...
ango4's user avatar
  • 45
3 votes
4 answers
102 views

Is there a better way to calculate the number of codewords of weight $i$ in a list of codewords?

Background Info I am interested in a better way of doing the following: I want to find the weights of the following codewords (the weight of a codeword here can be defined as the number of nonzero ...
am567's user avatar
  • 491
3 votes
4 answers
374 views

Eigenvectors are divided by zero depending on evaluation, 6x6 matrix

I calculated the Eigenvectors of the $6\times 6$ matrix $m$ with parameters $(a,b,c,d,e,f)\in \mathbb{R_{\ge 0}}$. If I set e.g. $b\rightarrow 0$ after calculation, then 4 of the 6 Eigenvectors are ...
granular_bastard's user avatar
4 votes
3 answers
437 views

Eigenvectors are divided by zero depending on evaluation, 4x4 matrix

I calculated the Eigenvectors of the $4\times 4$ matrix $m$ with parameters $(a,b,c,d)\in \mathbb{R_{\ge 0}}$. If I set e.g. $b\rightarrow 0$ after calculation, then some of the Eigenvectors are ...
granular_bastard's user avatar
0 votes
1 answer
83 views

How to write function series in Mathematica?

How do I write the function given below as a mathematical function: $\Sigma^{8}_{i=1}\Sigma^{8}_{j=1}c_{ij}\lambda_i \otimes\lambda_j$ I have the values of $\lambda_i$ and $\lambda_j$.They are 3x3 ...
Lelouch's user avatar
  • 21
0 votes
0 answers
40 views

Sparse Kronecker Product of Pauli Matricies

Suppose I have a list of Pauli matrices (X, Z and I type) paulis = {x,z,z,i,z,x,i,z}; I would like to compute a sparse array equivalent to $$x \otimes z\otimes z \...
user2757771's user avatar
1 vote
3 answers
212 views

How to implement tridiagonal matrix algorithm?

I have created the tridiagonal matrix below: ...
Mule's user avatar
  • 43
0 votes
0 answers
39 views

What form of output is this from Eigensystem? [duplicate]

I have been using DSolve and Eigensystem to analyze a 4x4 and some 2x2 system(s) of symbolic 1st-order linear ordinary differential equations. I just tried Eigensystem on a 3x3 matrix and encountered ...
Alan's user avatar
  • 11
0 votes
0 answers
46 views

On MacOs, I cannot use Needs["QDENSITY`Qdensity`"]

I am trying to get Needs["QDENSITY`Qdensity`"] from (https://library.wolfram.com/infocenter/MathSource/5715/), however, it failed and I get this error: ...
Xui Lao's user avatar
1 vote
1 answer
150 views

Newton Raphson 0th order with gauss elimination error

I'm trying to do a Newthon Raphson with 1st order continuation to solve a problem with 4 variables (fix 2 and obtain the results of 2 (x and Chi). ...
Larissa Santos's user avatar
2 votes
4 answers
115 views

Problem with Min and Max [closed]

s=min{max{0,a}, max{0,b}, 1/(1-a) max{0,1-a}} is there any alternative way to make this more concise without condition and in one expression. Condition is -infty<a<infty and -infty<b<1
Nandan's user avatar
  • 61
3 votes
0 answers
82 views

Mathematica's definition of cos(kA) where A is the 1st Pauli spin matrix [closed]

For a homework assignment I was asked to derive the formula of $e^{ik\sigma_{1}}$ - where $\sigma_{1}$ is the Pauli spin matrix {{0,1},{1,0}} - using the Taylor ...
Raketenmensch 's user avatar
1 vote
0 answers
71 views

Solving a linear algebra problem containing minimal polynomial degree

Consider a set of three-dimensional points ${\left\{{\left(a,ab,abc\right)}~\middle\vert~a,b,c\in\mathbb{N_+}\land a+b+c\leqslant2023\right\}}$. If there exists a non-zero real polynomial $\...
user688486's user avatar
1 vote
2 answers
98 views

Can you recover the original vectors that, when summed together, achieved a particular criteria

I am wondering if it is possible to take the binary strings of length $3$ (tuples) whose sums have weight $2$ (i.e they have $2$ non-zero entries)(binary case, meaning they have two $1$'s entries) $$u ...
am567's user avatar
  • 491
1 vote
1 answer
30 views

How to find and delete the duplicates from lists of vectors

What I want to do is to take a list of vectors: u={{1,0,0,0},{0,1,0,0},{0,0,1,0}} v={{1,1,1,1},{1,0,0,0},{0,1,0,0}} I want to find the duplicates between u and v ...
am567's user avatar
  • 491
1 vote
0 answers
72 views

Mapping two pure functions over different lists

Say if I have two lists of vectors of the same length, for example: u = {{1,0,0},{0,1,0},{0,0,1}} v = {{1,0,1},{1,1,0},{1,1,1}} I want to add (modulo 2) ...
am567's user avatar
  • 491
1 vote
2 answers
49 views

How to delete duplicate lists of vectors (in any order) from a list of lists?

I have a list of vectors: v={{{0,0,0},{0,0,1},{1,1,0}}, {{1,0,0},{1,1,1},{0,1,1}}, {{0,0,1},{0,0,0},{1,1,0}}} Clearly, the first entry and the third entry contain the same vectors. I want to delete ...
am567's user avatar
  • 491
4 votes
1 answer
77 views

Commutant of set of matrices

I'm trying to compute the commutant of a set of matrices, so the set of matrices that commutes with all matrices in the original set. I'm a complete newbie with mathematica, so I would be greatful for ...
giztt's user avatar
  • 43
1 vote
1 answer
179 views

Gauss elimination with pivoting error

I am attempting to write code for Gaussian elimination with pivoting. I need my code to be able to find the maximum pivot in the column and swap the rows to ensure that the first element is always the ...
Larissa Santos's user avatar
1 vote
1 answer
241 views

Nullspace if denominator is zero

This question is based on a previous question where the matrix mat = {{0, s, 1, 0}, {-s, 0, 0, 1}, {1, 0, 0, -s}, {0, 1, s, 0}}; is given and one wants to determine ...
granular_bastard's user avatar
0 votes
1 answer
40 views

Transition to a new basis with rotation of one of the axes [closed]

The lengths of the basis vectors e1 and e2 of the general Cartesian coordinate system on the plane are equal to 4 and 2, respectively, and the angle between the basis vectors is 120°. Relative to this ...
Сергей Малышев's user avatar
0 votes
1 answer
43 views

How to define linear mappings on a vector space spanned by abstract symbols?

Say I have an infinite dimensional vector space $V$ with basis consists of abstract symbols $\{ a_j \}^\infty_{j=0}$, and consider a linear function $f$ on $V$ defined by its action on the basis ...
Lagrenge's user avatar
  • 119
1 vote
1 answer
52 views

Simplify to vectors and matrices [closed]

How do you simplify an expression: $[r_1, r_2, r_3]^T [t_1, t_2, t_3] = r_1 t_1 + r_2 t_2 + r_3 t_3 = \vec{r}^T \vec{t}$ In other words, I want to group and simplify scalar expressions over vectors / ...
user3180's user avatar
  • 121
2 votes
1 answer
52 views

How to explore the unchanged eigenvalue with the largest real part?

The provided code below employs the Chebyshev collocation method to calculate eigenvalues. I'm interested in examining the eigenvalue with the largest real part while ensuring it remains almost same ...
Fun123's user avatar
  • 47
2 votes
2 answers
63 views

Generalized scalar product for matrices

Let $X$ and $Y$ be matrices of a dimension $ m \times n $. I would like to keep $m$ and $n$ as a variable and define a scalar function $$ \operatorname{scalar}: X , Y \to \mathbb R$$ $$ \...
100xln2's user avatar
  • 427
0 votes
1 answer
62 views

Solving the system of equation with the expression of total differentiation using Cramer's rule

I want to solve the following system of equations of total differentiation using Cramer's rule. And I got the following message: where d is delta as the symbol of ...
jck21's user avatar
  • 113
0 votes
2 answers
110 views

How to find codewords from constraint equations? [closed]

I have edited this question to include more information about what algorithm I wish to use etc. Say if I have a linear binary code with parity check matrix $$H = \begin{bmatrix} 0 & 1 & 1 &...
am567's user avatar
  • 491
1 vote
1 answer
148 views

What is mathematica command for finding eigenvalues of a generalized eigenvalue problem?

The provided code below is designed to compute the eigenvalues for the problem I inquired about earlier in this post: How to find eigenvalues?. I believe my code is mostly accurate, with the exception ...
Fun123's user avatar
  • 47
2 votes
2 answers
104 views

Problem of RollPitchYawAngles and orthogonalize

...
HyperGroups's user avatar
  • 8,599
3 votes
2 answers
104 views

Eigenvalues and classification of critical points [closed]

I started with a function (x,y) and tried to write the code to work out the eigenvalues and classify the critical points. The output it all good up until I try to use Which[] to classify the critical ...
noodles's user avatar
  • 31
1 vote
0 answers
68 views

Eigenvectors of a matrix (Solving and Plotting)

Given a nxn matrix h[k] ...
Med Ch's user avatar
  • 117
0 votes
0 answers
49 views

How to find linearly independent linear combinations of a set of vectors (general case)

If I have a list of vectors, say $v=\{v_{1}, v_{2}, \dots ,v_{n}\}$. Is there a way that I can get all linearly independent linear combinations of these vectors, such that if I change the content of ...
am567's user avatar
  • 491
2 votes
1 answer
81 views

how to solve problem involving a condition?

I am new to mathematica, therefore this might be a pretty simple question, My problem is for example: Compute the eigenvalue for matrix A= {{1,c},{1/c,1}}, c>0. when the matrix becomes more ...
Zeriob's user avatar
  • 23

1
2 3 4 5
32