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
vote
2answers
107 views

Finding the square root of a 7*7 matrix with real entries

Suppose that I have the following symbolic 7*7 matrix ...
10
votes
0answers
280 views

Mathematica package for explicit matrix representations of group generators?

While there are several packages that are capable of working with weights and roots (for example LieArt), I couldn't find any package that spits out explicit matrices for the generators, for example ...
6
votes
2answers
101 views

Penalty function on discrete mesh using Laplace-Beltrami operator?

Context I am interested in extending to the ill-condionned regime the inversion of linear equations arising from inverting differential equations which have been solved via 0-splines over a mesh ...
1
vote
1answer
61 views

How do I split up a list of data points into invervals and assign values to those intervals?

So I have a data set for chess and our goal is to plot the difference between the rating difference versus white's win rate. I want to subdivide the x-axis into intervals like (-10, 0) (10,20) (20,30)...
1
vote
1answer
124 views

Symbolic solution of an iterative system

I am not an expert in Mathematica. I want to keep off from tedious calculation I want to solve (in symbolic sens) this system: $\quad AU^{j+1}+BU^{j}=F^{j}$ where: $*$ ${U}^{j}$ a $(N;1)$ vector $\...
43
votes
4answers
1k 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 ...
7
votes
1answer
706 views

Tridiagonal symmetric matrix eigenvalue using bisection

I know that Eigenvalues is already quite well implemented in Mathematica, nor am I foolishly trying to improve on it. In order to improve my programming skills, I ...
9
votes
3answers
354 views

How write a new MatrixRank feature with symbolic computation

The current MatrixRank is a slight foolish without any capacity of symbolic computation ,feature of Mathematica, like this: <...
2
votes
3answers
280 views

Symbolic calculation of the rank of jacobian matrix

I would like to symbolically determine the rank of a jacobian matrix. In the help, I have seen that the MatrixRank function can be used for this purpose. However, when I use this function, the ...
1
vote
2answers
63 views

Plotting an integer-valued function

Consider the quantity $$H=n-1-\sum_{i\ne j} R_{ij}, $$where $R$ is a random $n\times n$ Hermitian matrix with trace $1$. The code that generates it was kindly provided by a user in another question of ...
0
votes
0answers
35 views

Root expressions inside Eigenvalues [duplicate]

I need the eigenvalues of this matrix as a function of Ny. When I tried whith a simpler matrix (4 x 4), it worked, but now, with this 25 x 25 matrix it returns what is shown in picture bellow: The ...
4
votes
1answer
80 views

Performing Hessenberg decomposition on a symbolic matrix

I am trying to calculate the Hessenberg decomposition of a symbolic matrix $$ A= \begin{pmatrix} 0 & -\mathrm ia & 0 & b \cos x \\ \mathrm ia & 0 & \mathrm ic \sin x & 0 \\ 0 &...
1
vote
1answer
308 views

Mathematica code to find R (upper triangular matrix) in QR decomposition using reflection method

I am trying to write Mathematica code to find $R $ (upper triangular matrix) in $ A=QR $ $A \in \Bbb{R}^{n\times n}$decomposition using reflection method. I wrote for $3 \times 3$ matrix. Any ...
6
votes
1answer
130 views

Eigensystem of arbitrary 4x4 Matrix

While doing a computation, I needed to take numerical derivatives of eigenvectors of a 4x4 hermitian matrix with respect to a parameter. I ran into the issue of phase jumps -- a random phase ...
0
votes
0answers
35 views
3
votes
3answers
425 views

How to solve a linear system by LinearSolve when the variables are duplicate?

Given that I have a set of equations about varible $x_0,x_1,\cdots,x_n$, which own the following style: $ \left( \begin{array}{cccccccc} \frac{1}{6} & \frac{2}{3} & \frac{1}{6} & 0 & ...
1
vote
1answer
73 views

How to plot this geometric object in 3D? [closed]

Let $v_{0}=(1,0,0)$. Then how to plot in 3D the geometric object $$\left\{ \left(v_{0}\cdot v_{1},v_{0}\cdot v_{2},v_{1}\cdot v_{2}\right):v_{1},v_{2}\in\mathbb{R}^{3} \text{are unit vectors}\right\} ...
2
votes
2answers
89 views

Tensor contraction

How do I let mathematica compute a tensor contraction like $\delta_{ab}\delta_{bc}$ with an output $\delta_{ac}$ efficiently? I tried TensorContract and TensorReduce but they were not helpful. ...
1
vote
1answer
65 views

Finding a Numerical Solution to a Linear Combination Inequality [closed]

Can I use Mathematica to find a value for $\alpha$ that satisfies the below linear combination inequality? If so, how? $$ \begin{bmatrix} -1 \\ -1 \\ -1 \end{bmatrix} < \begin{bmatrix} g_1 \\ \...
0
votes
1answer
51 views

QR-Decomposition [closed]

I should make a program in which with help of QR-decomposition find approximation of x^sinx shaped a+bLnx+c*e^x for a values x € ...
2
votes
1answer
74 views

Defining a sum on the elements of a matrix

I am interested in defining the quantity $$H=n-1-\sum_{i\ne j} R_{ij}, $$where $R$ is a random $n\times n$ Hermitian matrix (as a side question: how should I go about adding the condition $\rm{Tr}(R)=...
5
votes
2answers
80 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 ...
3
votes
0answers
100 views

Converting complex equations to matrix form

My question is a continuation of the topic: How to convert equation to vector (matrix) form? It is necessary to separate the components of equations into vectors and matrices and a combination of ...
15
votes
1answer
664 views

Efficient solution of huge sparse linear system

I'm trying to improve efficiency of my code in which main task is a solution to huge (~$10^4\times 10^4$) but sparse linear system $$Ax=b$$ (In fact my aim is to solve nonlinear equations $F(x)=0$, ...
3
votes
1answer
100 views

Diagonalizing a symbolic matrix

I am trying to diagonalize the following matrix \begin{equation} \left(\begin{array}{cccc} { \frac{1-K\left(x_{2}^{2}+x_{3}^{2}\right)}{1-K|x|^{2}}} & { \frac{K x_{1} x_{2}}{1-K |x|^{2} }} & { ...
3
votes
1answer
75 views

Is this a correct implementation of the principal-leading-minors test for positive-semidefiniteness?

I am asking this question in response to comments by mikado and Daniel Lichtblau on my question Maximize a six-dimensional function subject to joint positive-semidefiniteness constraints I gave two ...
2
votes
0answers
98 views

What's a quick test to see if an $n \times n$ matrix is diagonal and/or proporitional to the identity matrix? [closed]

As the title indicates, I want to test whether an $n \times n$ matrix (numeric, symbolic,..) is diagonal and/or proportional to the $n \times n$ identity matrix. I, of course, can test whether the $n^...
5
votes
2answers
148 views

Enumerating $4 \times 4$ matrices satisfying parity constraints

I've encountered a problem, which requires computer aid, but it seems a little above my Mathematica prowess because it requires counting objects satisfying some simple conditions. It seems doable, ...
4
votes
1answer
53 views

Relation between matrices

Maybe this is not a usual question for this forum... I have the following two matrices, mat1 and mat2, respectively: ...
4
votes
2answers
69 views

Generating a new matrix from an old one by an algebraic relationship

I am trying to work a program using Mathematica to have a new matrix by applying an algebraic formula to the old matrix. I do not know how this process is done using Mathematica and what are the ...
8
votes
3answers
382 views

How can I get all 4 × 4 submatrices of an n × n matrix?

I have a square matrix, I need to extract all possible combinations of 4 × 4 submatrices, where $n > 4$. For example in the case of a 6 × 6 matrix, there are 15 4 × 4 submatrices. I need the list ...
4
votes
2answers
357 views

How to reduce the λ-matrix to Smith Standard Form

A = {{1 - λ, 2 λ - 1, λ}, {λ, λ^2, -λ}, {1 + λ^2, λ^3 + λ - 1, -λ^2}} How to reduce the above λ-matrix to the following Smith standard form: ...
1
vote
1answer
73 views

How to speed up this code(Jordan Normal Form)

I want to calculate the number of unrepeated Jordan canonical forms of n * n matrices consisting of 0 and 1 How to speed up this code ...
0
votes
1answer
32 views

Making substitution to an expressions with a list of numerical data [closed]

Suppose I have an expression similar to this: y=23.23*(h[x]^2)*(D[h[x],x])*(D[h[x],{x,3}])/(13.2+Cos[0.245x]) The actual expression is a lot more complicated, but ...
2
votes
1answer
101 views

`Solve` Performance Tuning

I'm facing a Problem in Mathematica, where I have to solve a large number of equations generated by an AppendTo. ...
2
votes
1answer
140 views

How to solve for Transpose[X] A X = B

I need to find a transformation matrix of the metric tensor but I don't know how to solve for X from Transpose[X]*A*X=B
4
votes
1answer
68 views

Using preconditioners efficiently

I am trying to numerically solve a linear system of equations of the form A x = a where A is really ill-conditioned and ...
1
vote
0answers
68 views

Why did LinearSolve give me two different results?

Given that I have a sparse array as follows: ...
2
votes
1answer
51 views

Inverse of matrix up to some order

Let $A(t,s)$ be a matrix of any size (potentially large), whose entries are polynomials functions wrt $(t,s)$ of order $N$. I would like to compute the inverse $X$ of $A$ up to the order $N$ that is $...
1
vote
1answer
94 views

Solving for a system of unknowns with Mathematica

I have the following code to solve a system of 3 equations for 3 unknowns: ...
6
votes
4answers
358 views

How can I generate random matrices with certain requirements for the entries?

I would like to generate random 9x9 matrices, which contain only the digits 1-9, each one appearing exactly ...
5
votes
1answer
87 views

Linear Algebra in Arbitrary Precision - SLOW

I am trying to implement an arbitrary precision algorithm, but I am not very familiar with Mathematica or arbitrary precision arithmetic. I was able to implement it but surprised by how much slower it ...
1
vote
0answers
23 views

Returning only part of a list after a function call to save memory [closed]

I need to get only V of a singular value decomposition of a matrix. In MATLAB I could write: ...
-2
votes
1answer
48 views

Setting initial values in MMA's Gram-Schmidt process

How do you setup initial values in MMA's Gram-Schmidt process. Take this example: ...
1
vote
0answers
33 views

Matrix rank triangular matrix [closed]

Does MatrixRank check whether a matrix is triangular? If not, what would be the best way to calculate a matrix rank of a (say upper)triangular matrix in the ...
1
vote
1answer
47 views

Is it posibble to insert/add an array (row or colums) in a matrix?

Assume we have an m by n a non-square matrix. My question is this, is it possible/allowed to insert an arbitrary array ( either row or column) in such matrix so that I can obtain a square matrix? Is ...
0
votes
0answers
18 views

Symbolically invert block matrix [duplicate]

In Mathematica, if I write something like: Inverse[{{a, b}, {c, d}}] I get the inverse: ...
0
votes
1answer
143 views

Verifying: How to express a given matrix as the outer product of two vectors? [closed]

The question posed here and here is: Is it possible to decompose a matrix $M_{m\times n}$ as the product of two vectors, i.e. $$M_{m\times n} = \vec{y}_{m\times 1}\times\vec{x}_{1\times n}+const.$$ ...
11
votes
1answer
130 views

Minimizing expression over symmetric matrices

I'm trying to solve the following maximization problem over space of symmetric matrices A and positive definite H $$R=\max_{A\in S(R^d)}\frac{\text{tr}(HA)^2+2\text{tr}(HAHA)}{\text{tr}(AHA)}$$ So ...
6
votes
2answers
564 views

Over 30mins to generate the first eigenvector?

Is it normal for Mathematica to take over 30mins to try to compute the first eigenvector of a 100x100 matrix? The matrix is reasonably sparse - about 90% of the cells are 0s and each column sums to ...

1 2
3
4 5
23