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
75 views

Code for calculating the number of real roots of the polynomial [closed]

I'm trying to create a code that estimates the number of real roots of a polynomial. General algorithm is outlined in this document: http://stellar.mit.edu/S/course/6/sp10/6.256/courseMaterial/topics/...
2
votes
1answer
60 views

How to find the steps in finding the reduced row echelon form of a matrix programmatically?

I would like to figure out a way to see the row operations RowReduce uses to arrive at the reduced row echelon form of a matrix. I am aware of the step-by-step solutions in Wolfram Alpha and Wolfram ...
4
votes
1answer
154 views

Is there a way to view all two-dimensional arrays in matrix form?

Is there a way to ensure that every time I perform an operation such as RowReduce, Linear Solve, Null Space, Inverse, Eigenvectors, etc. that the matrix is displaying in MatrixForm instead of applying ...
0
votes
0answers
24 views

Minimal polynomial of an element in a polynomial quotient ring

Let $p(z)$ be a (not necessarily irreducible) polynomial in $\mathbb{Q}[z]$. Is there a built-in function I can use for determining the minimal polynomial of an element $\overline{q(z)} \in \mathbb{Q}[...
0
votes
1answer
46 views

"Instantiate" an output of Solve [closed]

I would like to use Mathematica to find a non-trivial solution of the linear system $Ax = 0$. When I try running Solve[A.x == 0, x] the output I receive is a ...
0
votes
1answer
41 views

How to flip the z axis of a Graphics3D in order to create a left-handed coordinate space?

I would like to know how this 3D graphic could interpreset the y axis as being the up direction and the z axis flipped so that it creates a left handed coordinate system? ...
0
votes
0answers
55 views

matrix problem: evaluation of column values which depend on a variable

I do not use Mathematica for a long time and I have a question about a matrix problem. I add here the code: ...
2
votes
1answer
108 views

How to expand a function as a linear combination of other functions?

I would like to be able to expand certain functions as linear combinations of other specified functions when I know that the original function can be represented in such a way e.g. we know that $\sin^{...
1
vote
1answer
65 views

Concatenating matrices using headings

New to Mathematica. I want to create and combine K1, K2, and K3 (shown in the first picture below) into the 8x8 matrix shown in the second picture below and keep the heading as shown if possible: ...
14
votes
2answers
287 views

Library for FEAST method is missing

Mathematica (V 12.3.1, Native Mac M1 version) is not letting me use the FEAST method for solving eigenvalue problems. For example, ...
0
votes
0answers
44 views

Block Matrix Algebra of Implicit Matricies

I get some unexpected behaviour from building block matrices of implicit matrices in Mathematica. Using this initial setup ...
5
votes
3answers
121 views

Listing all Index Possibilities Given a Vector and Indexed Set

Let's say I am given a vector $v=(5,2,-2,-4,3)^T$ and $\alpha \in \{-1,1\} $. I want to find all indices $(\alpha,i)$ such that $\alpha v_i >0$, where $v_i$ is the $i$th entry of the vector $v$ ...
2
votes
2answers
105 views

Find relationship between parameters to prove conditions of eigenvalues

I have the following 3-by-3 matrix. I need to find condition(s) on the parameters 'a' and 'b' such that this matrix has exactly 1 eigenvalue bigger than 1 in absolute value and other two eigenvalues ...
2
votes
0answers
52 views

Supplying a seed for an iterative method in LinearSolve

Just a quick question. Does anyone know if it is possible to supply a seed for the iterative methods in LinearSolve? I have a large sparse system, and even using some Krylov iterative solver, my ...
0
votes
0answers
35 views

How to plot linear fits with a specific range from imported data?

So I imported multiple data points starting off from data1 to data11. I have them configured onto a graph, but I also have to find the line of best fit for each. I need to find the line of best fit ...
1
vote
1answer
48 views

Matrix multiplication with non-commuting objects (Quantum)

Given a matrix A = {{0,a,a,0},{b,0,0,a},{b,0,0,a},{0,b,b,0}}, where $a$ and $b$ do not commute, how do I calculate $A^2$ in Mathematica? (Later on, I would like to ...
2
votes
1answer
64 views

Cholesky-like (rank-revealing?) decomposition on singular matrices

For a singular Gram matrix $B$ I need to find some matrix $A$ such that $AA'=B$. I can add a small multiple of identity matrix, but this could break upstream analysis (application is c-approximation ...
1
vote
1answer
38 views

Generate a normalized Haar-random vector

What is the procedure to generate a random qutrit quantum state? That is, I want to generate a $3 \times 1$ vector $u$ such that $u$ is generated by a Haar random $3 \times 3$ unitary $U$ multiplied ...
0
votes
0answers
39 views

Finding kernel of linear transformation

Suppose I have a vector space V generated by {x1x2x3,x32,x21x4} over Q and another vector space W generated by {x21x3,x1x22} over Q and L is linear transformation which maps x1x2x3↦x21x3, x32↦3x1x22 ...
3
votes
1answer
71 views

Performing matrix tensor product and getting a sum of its negative entries

I am given a $3 \times 3$ matrix $M$, which only has real entries. Is there an efficient way to do the following two operations with $M$? For a given input $n$, compute the $n$-fold tensor product $M^...
0
votes
1answer
54 views

How to distort a set of points

I have two set of points that I want to make a distortion as illustrated below. ...
1
vote
0answers
32 views

Trajectory Design Matrix

I've been tasked with creating a small demonstration for educational purposes of the Morris Screening Method but am having trouble implementing the trajectory design matrix in Mathematica. It's a ...
3
votes
1answer
295 views

Why ParallelTable is even slower than Table for large tensor construction?

I would like to create a large rank-4 tensor by using both Table and ParallelTable. What is actually constructed is given below: ...
1
vote
0answers
64 views

How do I carry out a partial row reduction of a matrix? [closed]

I have a large matrix with more columns than rows. I have attempted to row reduce the matrix using Mathematica's RowReduce command. I have been able to do this ...
1
vote
1answer
85 views

Building multilayer perceptron Neural Network

I’m new to machine learning and am a bit confused about how to create a neural network (multilayer perceptron) with a specific design. I would like to create a neural network with 40 features/neurones ...
1
vote
1answer
80 views

Find interval/range of certain coefficients to prove conditions of eigenvalues

I have seen similar questions to the one I am posting here, but I haven't been able to execute it on Mathematica. I would request some help with the following: I have the following matrix: ...
0
votes
0answers
40 views

Simplification based on Kronecker Product Properties

I am trying to simplify some algebraically intensive expressions that involve inverses and Kronecker products. One simple example of such an expression is $$(1) \quad \quad \quad Z'(I_n\otimes\Sigma+Z\...
0
votes
1answer
130 views

Find where there is no solution involving three variables

I have two equations SvA[zm, zs, zh]==0 and tzmzs[zm, zs, zh, tb, b]==0. I will plot these two equations and find their ...
0
votes
0answers
60 views

Discriminant of n-degree polynomial

The discriminants of polynomials $f(x)=x^n+a_1x^{n-1}+\cdots+a_n, 1\leq n\leq 4$ are degree-n discriminant-$\Delta_n$ 1 1 2 $a_1^2-4a_2$ 3 $a_1^2a_2^2-27a_3^2-4a_1^3a_3-4a_2^3+18a_1a_2a_3$ 4 $a_1^...
0
votes
0answers
43 views

Table with two indices does not work properly

I am a beginner in computational mathematics so apologies in advance for my probably poor code writing skills. I am using the package << matrixEDC.m to do some exterior algebra computations. ...
0
votes
0answers
64 views

Determining whether a matrix is in Jordan canonical form

At first, I was surprised that Mathematica doesn't have a built-in function for this, e.g. JordanMatrixQ. Anyway, we all know that a Jordan matrix is consisted of ...
1
vote
1answer
106 views

spectral decomposition of matrix with repeated eigenvalues

I have a real symmetric matrix m (below) which I would like to decompose as $Q^TDQ$ with $Q$ orthogonal and $D$ diagonal. When I try to diagonalize it using ...
3
votes
2answers
141 views

How to find a unitary transform between two sets of matrices?

In an earlier post, I asked a question about unitary transformation between two given matrices. Some really nice solutions were provided. However, what I'm really looking for is a unitary matrix U ...
3
votes
1answer
162 views

Increase computation and Plot speed

I have the following functions ...
3
votes
3answers
152 views

How to find a unitary transform between two matrices?

Given two matrices, G1={{0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}, {0, 1, 0, 0}} and ...
5
votes
2answers
300 views

How to solve for $\mathbf{X}$ in a matrix equation $\mathbf{X A} \mathbf{X}^\top = \mathbf{B}$?

I need to find a matrix $\mathbf{X}$ such that it belongs to $O(D,D)$ and satisfies the equation: $$\mathbf{X A X}^\top = \mathbf{B}$$ where both matrices are square, $\mathbf{A}$ is symmetric and $\...
7
votes
0answers
130 views

How to compute eigenvalues of linear function (not matrix)?

How to compute eigenvalues of a known linear function? In Julia, there is a package https://jutho.github.io/LinearMaps.jl/dev/ to compute the matrix representation of given function, then we can ...
3
votes
1answer
80 views

Implementing solution of a system of recurrence relations [closed]

Let us consider a system of recurrence relations such as $ a_{n-1} = ( \lambda_1 + n \lambda_2 ) a_n + \lambda_3 b_n $ $ b_{n-1} = ( \lambda_4 + n \lambda_2 ) b_n + \lambda_5 a_n $ subject to the ...
1
vote
1answer
85 views

How to write a matrix in a different basis by using Mathematica

I have these two 4x4 matrix ...
7
votes
1answer
120 views

Kronecker Square Roots

I'm interested in computing the 'Kronecker Square Root' $\mathbf{A}_{n\times n}$ of a matrix $\mathbf{M}_{n^2\times n^2}=\mathbf{A}\otimes\mathbf{A}$. In case it doesn't exist, I'd like to find the ...
4
votes
0answers
57 views

Finding matrix in Krylov subspace (Lanczos method)

The Lanczos method for finding the smallest eigenvalue of a hermiteian matrix $H$ is based on the construction of a vector subspace (Krylov space) where one can build a matrix $H_{Krylov}$ which is ...
1
vote
1answer
77 views

Quadratic form derivative in Mathematica

How to correctly differentiate quadratic form by vector in Mathematica, i.e.: $Q=\omega^T I_{p} \omega$ $\frac{dQ}{d\omega}= ??? $ ...
0
votes
0answers
44 views

On the diagonalization of matrices and strange results [duplicate]

I'm trying to implement the following calculation in mathematica $$U^{(0)}(\mu,m) = V\left(\left[\frac{\alpha_S(m)}{\alpha_S(\mu)}\right]^{\frac{\gamma^{(0)}}{2\beta_0}}\right)_DV^{-1}$$ where $\gamma^...
2
votes
1answer
82 views

A function that modifies functions - well-defined operation?

Here's my basic setup: Say I have a list of specific symbols and a function noSymbol, which accepts a mathematica expression and checks whether any symbol from my ...
4
votes
1answer
124 views

Eigenvalue and SparseArray

This the code of Hofstadter spectrum for square lattice using Mathematica ...
1
vote
2answers
98 views

Given A and B, how to find C if A = CBC?

Given A={{0,1,1,0},{1,0,0,-1},{-1,0,0,1},{0,1,1,0}} and B={{0,1,0,0},{0,0,0,0},{0,0,0,1},{0,0,0,0}} and ...
1
vote
0answers
31 views

Question about a restricted rewrite rule [closed]

I just started learning Mathematica and I'm not sure why a function I defined doesn't work. So I'm trying to write a function that takes a list of vectors and eliminates all zero vectors (with respect ...
8
votes
2answers
227 views

What is the best source to learn how to use tensor operations (exterior algebra) in Mathematica?

I'm specifically interested in the TensorProduct,TensorWedge, HodgeDual and certain build in functions to do tensor arithmetic like TensorReduce, TensorExpand. I would like to do exterior algebra ...
2
votes
3answers
116 views

How to collect a polynomial with a specific power

Suppose I have got this polynomial u=x^12-3x^8-x^4+3 Now, I am trying to collect this polynomial with x^4 terms. I need to write it like this: (-1+x^4) (-3 + x^4) (1 + x^4) To evaluate it, I used ...
0
votes
0answers
49 views

Use Root object as a function in NonlinearModelFit or similar

I have a matrix and its eigenvalues are returned by Mathematica as a Root Object. ...

1
2 3 4 5
28