# Tagged Questions

Questions on the manipulation of matrices in Mathematica.

2answers
79 views

### Creating a constant-valued matrix having the same dimensions as previously defined matrix

I have the dimensions of a matrix A. I would like to create a matrix B (say, of only 0's) of the same size as A. But A's dimensions are variable. Is there an efficient way using ...
1answer
67 views

### A question on JordanDecomposition in Mathematica

How can I have Mathematica show me also the inverse matrix of the similarity matrix of JordanDecomposition of a matrix? Obviously I need to use here the ...
1answer
74 views

### Implementing the Cimmino method [closed]

What am I doing wrong? I am trying to implement the Cimmino method, an iterative method for the solution of linear algebraic systems. The final output should be a vector. Here is a description of the ...
2answers
164 views

### How to Convert a Matrix into an Association?

I have a matrix like this one: test = {{1, "a"}, {3, "b"}} and I want to convert it into an association like this ...
1answer
71 views

### Symbolic vector addition

I'm trying to figure out a nice way to add a mix of symbolic and explicit vectors/matrices without mathematica treating the symbolic vectors as scalars and promoting them to constant arrays. For ...
0answers
3 views

### Gaussian process for machine learnig [migrated]

Here is my question in the equation 2.11 A is N by N matrix, so there is not feasible if N is large the textbook say in the euqation 2.12, we only need to invert size n by n. But I think K is 1 by ...
1answer
49 views

### Evaluate polinom with matrices [closed]

Let's say that I have the following polynom f = a+b+ab I want to evaluate this expression like this: ...
3answers
189 views

### Eigenvectors of numerical matrix

I have a large numerical matrix whose eigenvalues are all distinct. In the documentation for Eigenvectors it says: For approximate numerical matrices m, the ...
0answers
36 views

### extracting families with their representatives and number of repetition [closed]

There is a matrix: {{1,1,1},{1,2,1},{2,1,1},{-2,-1,-1},{1,1,-2},{1,-2,2},{2,1,-2},{1,-2,2},{-2,2,1},{1,2,2},{2,2,2}} How we can extract another matrix which ...
2answers
53 views

### Random distribution of some Lists on a distinct matrix

I have 3 functions as below ...
1answer
66 views

### How to correctly calculate symbolic eigenvectors

I give a minimalistic example of my problem: I have a matrix: m[a_,b_]:={{0,-a+b},{b,0}}; I define the eigenvectors as: ...
1answer
53 views

### Constructing tensors with arbitrary rank and dimension [closed]

How can I create a tensor with arbitrary rank n and m components in each dimension? I am looking for a command in which I insert n and m and it spits out the corresponding tensor with random entries (...
1answer
47 views

### check content of a Matrix

I have a matrix which contain rotated ellipses and points, how can I check if the element in the position {i,j} is either a point or an ellipse? the code is a bit longer but the structure is like: ...
2answers
570 views

### Row-Reduced-Echelon-Form with Equation Parameters for Consistent Systems

I often do row-reduced-echelon-form (RREF) calculations that involve parameters using the RowReduce command. Most times, I want to know which parameters make the system consistent. For example: <...
1answer
68 views

### Nonlinear Markov chain (numerical simulation)

Suppose you have a linear Markov process, and you can write it as x(t+1) = Ax(t). Here x is the vector of values, and A is the transition matrix. Since this is linear, it can be solved analytically, ...
0answers
8 views

### ALS Matrix Convergence [migrated]

I came across this statement in some MapR documentation on ML in Spark: ALS is an iterative algorithm. During each iteration, the algorithm alternatively fixes one factor matrix and solves for ...
1answer
79 views

### Solving for five unknowns in a 3 x 3 matrix

I know that matrix.Transpose[matrix] = IdentityMatrix[3] matrix = {{0.8111, 0.4867, -0.3244}, {a,b,0}, {c,d,e}} I tried ...
2answers
52 views

### Plotting points using adjacency matrix

Given an adjacency matrix on n vertices and a polygon on n vertices, how to add edges from adjacency matrix on the Polygon? eg: if polygon is {(0,0),(0,1),(1,0),(1,1)} and the adjacency matrix has 1 ...
2answers
455 views

### Convert DelaunayTriangulation-> Graph->AdjacencyMatrix

Is there a way to convert a Delaunay Triangulation into a Graph structure so that one can generate an AdjacenyMatrix of the Delaunay?
1answer
51 views

### Finding an Integer, Unimodular Matrix that connects two given matrices

I have two symmetric, integer matrices, $K$ and $K_2$ which have the same determinant and the same signature (number of positive - number of negative eigenvalues). I want to find an integer valued ...
0answers
32 views

### Eigenvalues of a symbolic matrix using interpolating function

I have a 6x6 matrix with entries that depend on dependent and independent variables of an interpolating function. I would like to be able to evaluate the eigenvalues of this matrix using the ...
0answers
52 views

### Map over multidimensional matrix [closed]

Suppose I have a 8by6by4by2by2 matrix called m. There is in total 8*6*4 2by2 matrices. I want to map a function over these 2by2 matrices. Each dimension in ...
3answers
3k views

### Flatten command: matrix as second argument

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...
1answer
65 views

### What's up with PauliMatrix with a string argument?

Looking at the definition of PauliMatrix (not the documentation), I realized that it is defined for arguments 0, ...
1answer
92 views

### Is it possible to decouple this Matrix A to matrix multiplication of two matrixs B and C?

I want to decouple this matrix A into two matrixs B and C, with A=B*C. And B is functions of r, C is functions of n. Is it possible or not? Can I use Mathematica to do this? Any help or advise is ...
1answer
78 views

### Help on order of evaluation within plot function

it is my first time asking a question here so please let me know if there's anything I should be doing that I'm unaware of. I'm sure the answer to my question already exists on the site but I'm having ...
1answer
88 views

### Accessing the elements in a table is slower than calculating each time?

This is a follow-up of How to accelerate combinations and sum calculations here? I have tried all tricks but when N reaches 35 the time is still intimidating in a 16-core server, which is far better ...
1answer
153 views

### Defining a matrix with elements acting as operators

This question is directly related with my previous one. I'll try to be more specific here. I have a matrix {{a[x],b},{c,d}}, where ...
2answers
270 views

### Find a condition that b must satisfy so that Ax=b has solution

I'm new to Mathematica, so I'm sorry if this is really simple. I am trying to find the condition that vector b must satisfy so that Ax=b has solution. I would like to learn a general method, but I'll ...
0answers
31 views

### How to plot eigenvalues as a function of parameters in a dynamic module?

I am trying to make a fancy interactive plot that shows how the eigenvalues of a matrix mat change under variation of parameters ...
2answers
95 views

### Dynamically sized $n\times n$ checkboxes corresponding to a matrix

I was wondering if it was possible to do to following: have an input field for an integer where you input the $n$ have an $n\times n$ matrix of checkboxes that would correspond to an $n\times n$ ...
7answers
333 views

### How to repeat a matrix on it's side?

I have the following matrix in Mathematica: mat = {{0,0,1,1}, {0,1,0,1}} I want to repeat this matrix N number of times on the side. For example if N = 3 then ...
1answer
66 views

### Eigensystem with orthogonal elements in matrix

I have a matrix with 16 elements: matrix = {{f1, -f2, -f2, f3 }, {f4, -f1, -f1, f2}, {f4, -f1, -f1, f2}, {f5, -f4, -f4, f1}} I would like to calculate ...
0answers
48 views

### Objects of unequal length [on hold]

I have this error which I don't know why. The number of components in each matrix are equal but why it says that Objects of unequal length and cannot be combined?
4answers
121 views

### mapping a smaller matrix in a greater matrix with a specific sequence

I have a matrix 300x300 i need to map the values ina greater matrix (900x900) in the positions given by the sequence $$({3*i-1,3*j-1)}$$ while everything else remain empty, how can achieve this ...
3answers
76 views

### How to Import and Export as a multidimensional array

I have 10000 matrices and each matrix is 3x3. So Dimensions[data] gives me {10000,3,3}. I saved this into a file with Export["mydata.dat",data,"Table"] Then when I imported it using Import["mydata.dat"...
3answers
381 views

### Can't find the eigenvectors of a simple 2x2 matrix

Bug introduced in 8.0 or earlier and fixed in 10.3.0 Why can't Mathematica find the eigenvectors of this matrix? ...
1answer
59 views

### How to accelerate combinations and sum calculations here?

I have a 4d matrix H defined as below (embedded with combinations and sums) ...
1answer
56 views

### Fast Eigensystem calculation

I have a code which finds the eigensystem for a matrix H = H0 + x HInt, where x is a variable which turns on the interaction. H0 is diagonal, and HInt is a sparse matrix (with about 400 states, I hope ...
2answers
249 views

### Dynamical system problem x(t+1) = Ax(t)

I have a problem that have been trying to solve but it's not going so good. I would like some guidelines on how to work myself around this problem: Two neighboring countries spy on each other and ...
0answers
36 views

### Matrix with equations as entries - how to choose them and solve them

I have a matrix in Mathematica, which I have built using Normal[SparseArray]. Each entry of this matrix is an equation in one variable. What I need to do is 1) to select some of the entries of the ...
2answers
128 views

### Replacing multiplication of matrix elements by application of these elements as functions

I want to realize the following idea in Mathematica. I've got a matrix {{a,b},{c,d}} which is multiplied to a vector {h,k} ...
2answers
82 views

### Building an $m \times n$ matrix from element-wise from two other such matches

I am a beginner with Mathematica. I have two matrices, s1 and s2, and I am building a third matrix from them. ...
3answers
384 views

### Noise filtering in images with PCA

I have a stack of images (usually ca 100) of the same sample. The images have intrinsic variation of the sample, which is my signal, and a lot of statistical noise. I did a principal components ...
0answers
91 views

### How does Mathematica compute the determinant of a matrix? [closed]

I have been trying to write efficient code for calculating the matrix determinant for some time now. I noticed last night that Mathematica is able to compute the determinant of a $200 \times 200$ ...
1answer
158 views

### Drawing dynamical trajectories diagram in Mathematica

I've a Boolean gene regulation system composed of vectors(corresponding to cellular phenotypes). Their components are binary numbers such as $\{1,0,0,1\}$. A vector can change its statement in ...
1answer
67 views

### Save a fraction matrix in Mathematica into C++ friendly format

In MMA I have a 2d matrix whose each entry is a irrational number(in fraction format in MMA). Say: ...
3answers
5k views

### Solving a time-dependent Schrödinger equation

I want to solve the time-dependent Schrödinger equation: $$i\partial_t \psi(t) = H(t)\psi(t)$$ for matrix, time-dependent $H(t)$ and vector $\psi$. What is an efficient way of doing this so that ...
1answer
59 views

### Unexpected result: Numerical and analytical results do not match! [closed]

I am calculating the eigenvalues and eigenvectors of a matrix. This is my code: ...
3answers
251 views

### Get the coefficient matrix from a quadratic form

Suppose I have a quadratic form of qf = a x^2 + b y^2 + c z^2 + 2 d x y + 2 e x z + 2 f y z How can I easily to get the symmetric matrix A, such that $X^TAX=qf$?...