Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

1
vote
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 ...
0
votes
1answer
40 views

Probems using 2 For and a AppendTo to cycle through my Equation to solve some matrixes

I am trying to solve a few problems here. I have an equation with multiple variables that I am trying to solve in For loop method. I will attach the file below. In addition I am trying to get it to ...
2
votes
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 ...
0
votes
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 ...
1
vote
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 ...
5
votes
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, ...
3
votes
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 ...
0
votes
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 ...
1
vote
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 ...
0
votes
0answers
30 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 ...
0
votes
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 ...
0
votes
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?
6
votes
2answers
269 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 ...
3
votes
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 ...
1
vote
3answers
75 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"...
1
vote
2answers
90 views

Output the tensor product of two matrix as a matrix

How do I output the matrix form like the RHS without the tensor product sign remaining $\otimes$? I need it for display purpose where I can see easily what the form of the whole product matrix is.
2
votes
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) ...
1
vote
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 ...
0
votes
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 ...
3
votes
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} ...
2
votes
0answers
90 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$ ...
2
votes
2answers
94 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$ ...
2
votes
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: ...
0
votes
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: ...
8
votes
3answers
383 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 ...
4
votes
3answers
248 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$?...
3
votes
1answer
123 views

Optimize a parametric matrix to get a lowest possible eigenvalue

This question is a followup of Plot the lowest eigenvalues of a parametric matrix Now I can get the lowest eigenvalue LowEign(t) of the matrix for a given t numerically. When I plot the LowEign ...
0
votes
2answers
69 views

Automatic process to replace missing values, coming from a second matrix

I have a large starting matrix with missing values in different columns. I want to replace this missing data as follow. First I have to check the group (last column in starting matrix) and go to a ...
2
votes
1answer
65 views

Plot the lowest eigenvalues of a parametric matrix

The question here is somewhat related to the comments in Computing eigenvectors and eigenvalues I have a matrix M, say 400 by 400, and all elements depend explicitly on one parameter t in a ...
0
votes
3answers
89 views

How do I create a circulant matrix? [closed]

How do I create an $n \times n$ circulant matrix? I couldn't make ToeplitzMatrix do it for me.
1
vote
1answer
25 views

Passive Transformation does not return the expectedt result due to precision of expressions

So I wish to perform a passive rotation in N dimensional space. Let me take N=5 for this question. ...
1
vote
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 ...
2
votes
2answers
117 views

Delete rows and columns in a matrix based on the element index

This is a follow-up question from here: Define a 4d matrix without for loop I have a 400x400 2d matrix reshaped from a 4d matrix H(i,j,k,l), ...
6
votes
2answers
135 views

Good way to create a similarity / distance matrix for a large dataset [duplicate]

I have a large dataset with rows (100k+) for products and columns for features. Now I want to create a similarity matrix with NormalizedSquaredEuclideanDistance. ...
1
vote
1answer
74 views

Create a Dataset object, Association or SparesArray from a matrix [closed]

I need to make queries and operations on a large dataset. What is the easiest way to add keys to matrix so that it is transformed to a dataset, which can later be used to make queries? Let's take ...
0
votes
0answers
48 views

Value Iteration (Recursive iteration) to Minimize (Optimize) a Function

I have a function that I call as "Value". I am trying to find the minimum of this function and this function is a function of 4 other functions. One of these four functions is recursive based on the ...
1
vote
2answers
105 views

Find the minimum element of a row of a matrix and its column index for each row

I am trying to find the minimum value of a row of a matrix and its corresponding column. Please run the code below. OptV is the matrix that I would like to create which must give the output of the ...
1
vote
1answer
154 views

How do you solve a linear equation of matrices? [duplicate]

The function Solve works fine for scalars: In[]:= Solve[A x - x B + C == 0, x] Out[]= {{x -> -(C/(A - B))}} When using matrices however, ...
1
vote
1answer
110 views

Evaluate pure function through round brackets

In have some matrices of pure functions or numbers which I multiply by other matrices or vectors. I would like the functions to be evaluated in the result, but all that I get is something like this: <...
1
vote
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 ...
2
votes
2answers
87 views

Define a 4d matrix without for loop

I was wondering if there is a way to avoid for loop here: I want to define a 4d matrix H(i,j,k,l), and each entry in the matrix is calculated through a complex function, say Do_H(i,j,k,l), depending ...
2
votes
1answer
40 views

Square bracketed matrices in Mathematica - precision markers?

I'm trying to display Matrices with square brackets in Mathematica. I've found this post from a mailing list in 2009 http://forums.wolfram.com/mathgroup/archive/2009/Aug/msg00458.html and it seems to ...
5
votes
4answers
451 views

How to simplify block of multiple repetitive If statements?

I'm building a boardgame...game in Mathematica. I have the board state represented as a matrix. It's a two player game, and each player (let's call them A & B) only has one type of piece or '...
0
votes
2answers
91 views

I'm trying to solve a system of complex equations

I'm simply trying to solve a system of equations and mathematica can't do it for all values over the region of interest. I have a 3x3 matrix that has a specific parametrization and after squaring the ...
3
votes
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 ...
1
vote
0answers
46 views

Generating random Kraus operators

I am trying to generate (randomly) set of square matrices $\{K_m\}$ with the properties that $$\sum_{i=1}K_i^{\dagger}.K_i=I_n,$$ where $I_n$ is the identity matrix of order $n$. So, the input should ...
2
votes
1answer
66 views

Accuracy limitations of singular value decomposition?

in the process of working on a physics problem I have found the need to use the singular value decomposition function built into Mathematica. I have encountered what seem to be limitations to the ...
0
votes
1answer
33 views

Iterating KroneckerProduct[] and returning the result from a function

I am trying to write a function which will take a matrix m and an integer i as inputs. Then it will compute the Kronecker product of m with itself i times and return the result. The code is as follows....
0
votes
0answers
29 views

factoring a phrase of matrix elements and calculating main eigenvalues

I have a question containg two parts: 1-If we have a matrix as ...
6
votes
3answers
328 views

Indicate minimal path sum

Described on the page: http://www.mathblog.dk/project-euler-81-find-the-minimal-path-sum-from-the-top-left-to-the-bottom-right-by-moving-right-and-down/ It is an example of the solution indicated in ...