# Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

239 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
370 views

### Factorize trigonometric matrices

Consider two square matrices $A_1$ and $A_2$. Consider the following matrix involving matrix trigonometric functions: \begin{equation} M_1(t)=\begin{bmatrix} \cos(tA_1) & t\mathrm{sinc}(t A_1) \\ ...
750 views

### What algorithm is Mathematica using to find the smallest eigenvalue so quickly?

My question is what kind of black magic is Mathematica doing to obtain the correct answer so quickly compared to other programming languages? Details: I've written a Mathematica notebook to find the ...
523 views

### How to speed up calculations on big symbolic matrices?

this is my first time posting something on a community of the StackExchange platform, so please feel free to correct me if I'm doing something wrong. :) Additionally you should probably know that I'm ...
126 views

I'm taking a machine learning course, which involves taking a lot of analytical gradients and Hessians. It would be ideal if I could perform these calculations in Mathematica. However, I am only aware ...
196 views

### Bug in PositiveDefiniteMatrixQ?

Fixed in 10.1.0. Exists in at least 9.0.1 -- 10.0.2. This seems like a bug in PositiveDefiniteMatrixQ to me: ...
282 views

### Extracting the principal component analysis vectors in the original basis

I'm using Mathematica's PrincipalComponents[] to do a principal components analysis on a data set with m data points and n variables (m > n). The command produces ...
173 views

### Why has Version 10.3 precision reduced?

In version 7.0.1.0 and versions 10.0 and 10.1 the following is produced: ...
339 views

131 views

### MatrixPower performance

In Mathematica 9, (I think) MatrixPower[matrix(m.m), n].vector has complexity $O(m^{2+\epsilon}\times\log(n))$ (Mathematica automatically find the algorithm that ...
1k views

### Export matrix to $\LaTeX$ with style

Is it possible to export a matrix to $\LaTeX$ with style? For example this code will create a matrix with equal spacing matrix and with background colors in some cell, is it possible to export that ...
96 views

### Arbitrary Precision, Nearly-Singular Matrices, and LinearSolve

I have been trying to solve a nonlinear eigenvalue problem, $\mathbf{M}(\lambda) \mathbf{v} = 0$, in Mathematica using Newton's method. The core of the algorithm relies upon an inverse iteration, ...
139 views

### How to efficiently apply PCA followed by SVD to extract the components of PCA?

I am working on segmenting a textured image using Gabor Filters. This is based on this paper. There exist a Matlab implementation of this as well. Earlier I managed to do up to this. With the help of ...
633 views

### How to invert a matrix with 100 trillion elements?

I have a $10^{7}\times 10^{7}$ matrix with the following properties: it is sparse it is gamma-5 it is almost Hermitian. If $M$ is the matrix we are trying to invert, we know $M=A M^{\dagger} A$ ...
983 views

### Fast principal component analysis

I'd like to speed up a principal value value analysis. The data contains a large set of vectors with a large dimension. Both are in the range of 1000. I want to obtain the loadings matrix for further ...
134 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 ...
65 views

### Is this the most idiomatic way to convert matrix into dataset?

Is this the most idiomatic way to convert matrix into dataset? (for Mathematica 10 or higher) I was kind of hoping this would work: ...
285 views

### Implementing positivity constraints over a six-dimensional hypercube

This question involves the same subject matter as my previous one (How can one achieve the most accurate estimates of certain six-dimensional integrals under specific constraints?), but with another (...
221 views

### Is Mathematica a good choice for a scientific project with Machine Learning?

I'm a chemist with some rudimentary programming skills and in the middle of the year I'll be starting a project concerning machine learning, so, I'm sorry if I'm going to ask two questions in this ...
169 views

### What real symmetric matrices of this type can Mathematica find symbolic eigenvalues for?

I'm working on a problem calculating symbolic eigenvalues of matrices that always have a very simple form: they are real and symmetric and usually sparse. They have two distinct symbolic parameters. (...
156 views

### Sparse matrix multiplication mod p

Let A and B be sparse matrices with integer coefficients between 0 and ...
594 views

### Finding eigenvalues in Mathematica: why so slow?

I am trying to find the eigensystem of a large sparse real symmetric matrix, and I only need the lowest 40 or so eigenstates. The relevant code is as follows: ...
286 views

### Real Canonical Form of Arbitrary Size Matrices

I have been searching the site and the Mathematica documentation, but have not found anything regarding this. If we find the Jordan Form of the following matrix, we get complex values, but I would ...
465 views

### How can I force the use of sparse diagonalization methods?

When I evaluate the Eigenvalues function on a very large (e.g. 2^16 x 2^16) sparse matrix, Mathematica says something like: Because finding 65536 out of the ...
1k views

### Symbolic matrix calculus: What's new in Version 9

I have seen some of the related posts, which ask about doing matrix calculation on tensors unknown dimensions. One of the posts mentioned that version 9 has some capability, but it was concerned about ...
1k views

### Analytically solve the eigenvalue problem with infinite dimensions by Mathematica?

If I am given a symbolic expression of all the matrix elements in an infinite-dimensional space, e.g., the Hamiltonian of a quantum mechanical system, is it possible to get the symbolic expression for ...
355 views

### How to accelerate updating some parts of sparse matrices?

I am trying to update some parts of an specific matrix as rapidly as possible. In what follows, I first set up the basics things that I want to use ...
74 views

### Hafnian of a matrix

Is there a Mathematica built-in function for the calculation of the Hafnian of a matrix? I am interested in the function as it appears naturally in the calculation of moments of a multivariate ...
80 views

316 views

### Is it possible to do matrix algebra symbolically?

I'm reading a book that has the following theorem: I am trying to make Mathematica perform these calculations for me. Is it possible to do it without having to declare the matrices? For example, ...
90 views

### How to ArrayFlatten some matrix which have repeated element

I have many such matrices(whose dimension are all 3*3.) like: ...
255 views

### Why does Eigenvalues work for a matrix $\{M\}$ but not $\{\{M\}\}$?

Suppose I have a matrix {{1, 2}, {3, 4}} which I'll call mat. In a blur of human error, I computed the eigenvalues of ...
81 views

I have an iterative matrix product of this type  \begin{pmatrix}y_{n+1} \\ x_{n+1} \end{pmatrix} = \begin{pmatrix} A & B \\ C & D \end{pmatrix} \begin{pmatrix}y_{n} \\ x_{n} \end{pmatrix} $... 0answers 960 views ### Mathematica's Singular Value Decomposition different from another math engine I’ve been working with SVD – singular value decomposition. Things weren’t working as expected. Thus, I looked over to Matlab and executed the following code: ... 0answers 113 views ### FindInstance of Matrices I'm trying to use FindInstance to find examples of matrices that complete an expression. However, it seems like I need to specify atomics as my variables to the ... 0answers 141 views ### Diagonalisation of equations for NDSolve I have a linear matrix differential equation and I wish to speed up evaluation by diagonalising using eigenvectors. There is an example in Help for finite elements under "swinging beam" that is ... 0answers 646 views ### Fast export of large numerical data Edit It seems that the bottelneck is not due to eigen value problem. I will esit the question soon. I have a 6000by6000 matrix which I got after some calculations. I want to get the eigenvalues and ... 0answers 255 views ### The CorrelationMatrix is equal to corrcoef of Matlab? How can I generate a matrix which is equivalent to the results of the "correlation coefficients" command (corrcoef) in Matlab? When I make a LinearModelFit, I can get a CorrelationMatrix, but is this ... 0answers 255 views ### Mathematica Complains about Non Symmetric Covariance matrix, when it's not the case I was doing some fitting with Mathematica7 using NonlinearModelFit. It's quite long the program to do the fit and that's why I am not displaying here ... It goes ok, and I can get the fit parameters ... 1answer 358 views ### How to generate a$ 9 \times 9 \$ matrix like Sudoku ？

i want to generate a matrix that the number in each row, colum contains 1-9,and not repeated. my code always fall into no solution. here is my code. ...
21 views

### MatrixFunction is returning a cryptic error message about “the function 1”

The "Possible Issues" section of the documentation for MatrixFunction lists several possible ways in which a call to ...
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 ...
34 views

### What kind of performance should I expect out of Eigensystem using FEAST?

I'm numerically solving a time-independent Schrödinger equation using Eigensystem's FEAST method. It takes a lot longer than I ...