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

Extract ViewVertical from ViewMatrix

Given a ViewMatrix setting of the form {t, p}, how can one determine the ViewVertical? Let'...
6
votes
2answers
73 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 ...
4
votes
3answers
419 views

It seems Eigensystem[m] returns vectors that are not eigenvectors

I am new to here so please forgive me if I do something wrong carelessly. I have faced a serious problem in eigensystem method, or more particular, eigenvalue. It seems that the following codes that ...
2
votes
1answer
119 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 $\...
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 ...
5
votes
1answer
116 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
30 views

How to tell mathematica that a variable is matrix?

I'm trying to apply the command SemidefiniteOptimization: ...
4
votes
1answer
73 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
70 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
62 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. ...
0
votes
1answer
46 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 € ...
1
vote
1answer
59 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 \\ \...
1
vote
2answers
62 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 ...
3
votes
1answer
71 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
0answers
63 views

Computing log-determinant?

Mathematica does-not have a function to compute the log-det of matrix? Naively computing Log[Det[M]] can be numerically unstable.
3
votes
1answer
83 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} }} & { ...
2
votes
0answers
76 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^...
3
votes
1answer
62 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
86 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 ...
5
votes
2answers
144 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, ...
1
vote
1answer
55 views

How to feed a list of disks to RegionUnion

I have a bit of code which creates a list of disks (I'm exploring Gershgorin circles) based on a matrix tm. ...
8
votes
3answers
359 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 ...
0
votes
1answer
31 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 ...
5
votes
2answers
350 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: ...
13
votes
4answers
1k views

How to solve this matrix equation

How to solve this matrix equation Solve[MatrixRank[( { {1, x, 3}, {2, 4, 5}, {2, 4, x} } )] == 2, x, Reals]
2
votes
2answers
89 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
109 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
65 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
63 views

Why did LinearSolve give me two different results?

Given that I have a sparse array as follows: ...
2
votes
1answer
48 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
90 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
356 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
75 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: ...
1
vote
0answers
31 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
41 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
17 views

Symbolically invert block matrix [duplicate]

In Mathematica, if I write something like: Inverse[{{a, b}, {c, d}}] I get the inverse: ...
-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: ...
11
votes
1answer
124 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 ...
0
votes
1answer
97 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.$$ ...
1
vote
1answer
75 views

Problem with QRDecomposition [closed]

I was using Mathematica for the QR decomposition method. But I got strange results. I wanted to find eigenvalues of a matrix, say ...
3
votes
1answer
121 views

Gaussian elimination for a Hilbert matrix

I have been asked to write the Mathematica code to solve a 25x25 Hilbert matrix. The built-in function LinearSolve would not work. I started my solution by coding ...
2
votes
2answers
99 views

Different result from utilizing of eigenvalues and eigenvectors commands

I have a matrix as a function of a parameter like ...
2
votes
1answer
72 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 ...
5
votes
2answers
97 views

Efficient way of averaging over elements of one matrix based on another

Mathematical formulation of the problem with an example: Suppose we have the matrix $A$ given by $$A=\begin{pmatrix} 0 & 1 & 5\\ 1 & 0 & 5\\ 5 & 5 & 0 \end{pmatrix},$$...
1
vote
1answer
56 views

Hermite normal form and basis for the nullspace

Define the Hermite Normal form $H$ for a matrix $A\in Z^{n\times n}$ as following: $$H=UA$$ which in Mathematica is given as {u, h} = HermiteDecomposition[a] Then for a system of homogeneous ...
2
votes
1answer
80 views

Fastest way to compute determinants over (lists of) machine precision numbers

The below code is a code snippet of a larger project of mine. The project is mostly optimised but this part is not. I'm struggling to improve it, the code takes a really long time to evaluate for what ...
5
votes
2answers
238 views

How do I get actual values from a Jacobian matrix?

I have a Jacobian function: D[{Sqrt[x^2 + y^2], ArcTan[x, y]}, {{x, y}}] It gives me a matrix with the formulas I need for my transposition matrix: ...
0
votes
0answers
35 views

Is there a feasible computation?

I have to find the values of $p_1$ and $p_2$ which minimizes the expression $G$. However, when I took the partial differentiation of $G$ with respect to $p_1$ and $p_2$, the equations I obtained were ...
2
votes
1answer
68 views

Linear map of unit cube (generalized)

This question is a slight generalization of this question. Let M be a fixed rational m $\times$ ...

1
2 3 4 5
22