Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

0
votes
0answers
38 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
133 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
95 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
98 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
70 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
406 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
276 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
128 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
73 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
66 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
94 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
250 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
122 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
143 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
77 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
49 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
107 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
155 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
111 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
82 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
90 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
454 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
161 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
47 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
75 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
344 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 ...
0
votes
1answer
49 views

How to pad numbers to the border of the Matrix?

I want to pad the numbers,but it throws an error Part::partw,so I use Quiet to suppress this error. ...
0
votes
1answer
52 views

Inverse of a Fourier matrix [closed]

I am trying to find the inverse of a Fourier matrix but I am getting confusing results. If R is a Fourier matrix, then ...
6
votes
1answer
137 views

Calculate the ESP Grid based on Density Grid

I want to build a fast way to convert a density grid file into a grid file of the respective electrostatic potential (ESP; also known as MEP, the molecular electrostatic potential). This ...
0
votes
4answers
51 views

insert elements into 2 D array [duplicate]

say I have a 2 dimensionsal array like a={{1,2,3},{4,5,6},{7,8,9}} and a vector like v={10,11,12} I want the result to be ...
2
votes
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 ...
1
vote
0answers
47 views

Working with matrix

Considering the 3x3 matrix: m = {{0, -(I/Sqrt[2]), 0}, {I/Sqrt[2], 0, -(I/Sqrt[2])}, {0, I/Sqrt[2], 0}} How would I find its normalized vectors eigenvectors u_i ...
3
votes
0answers
71 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 ...
-1
votes
1answer
65 views

Real and Imaginary matrix

I have a 2 by 2 matrix T: {{x, y}, {-y, x}} where x is the real part of some complex number and y is the imaginary part of something complex number. Let's say z1 = ...
1
vote
0answers
45 views

Getting the row/column reduction matrix of a matrix m

Is there a simple way to get the row reduction matrix for a matrix m? As in, a matrix a such that ...
2
votes
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. ...
2
votes
0answers
68 views

Unexpected behavior from applying ToRadicals to eigenvalues [closed]

I am trying to get the symbolic form of a $10 \times 10$ matrix (I know, that is generally too large). ...
0
votes
1answer
92 views

How to turn a subroutine into a function?

I've written a subroutine that takes in 6 matrices and after some manipulation returns back 3 new ones. I will use this subroutine fairly often in this notebook so I think it would be easier to turn ...
11
votes
1answer
158 views

Why FoldList 5 times faster than Apply for matrix multiplication? [duplicate]

Consider this list of $2\times 2$ matrices: list=RandomReal[{-2,2},{500,2,2}]; Now compare timings of Apply and ...
1
vote
0answers
108 views

Outer product using the quantum mathematica package

I am using the quantum Mathematica package and am trying to do computations that require me to use the outer (tensor) products of Pauli matrices. I would define this as, for example, ...
2
votes
0answers
46 views

Optimization for iterating and plotting a matrix product and its elements?

I have an iterative matrix product of this type Since i didnt knew how to do it, I explicitly wrote the product as {Ayn + Bxn, Cyn + Dxn} and evaluated it with the NestList construct ...
11
votes
4answers
489 views

How do I extract a matrix of only positive numbers given a set of assumptions?

I want to divide a matrix: mat = {{a, 0, -b}, {d, a, 0}, {0, 0, -a}} with the following assumptions: ...
0
votes
1answer
52 views

Overriding Subscript operator creates its own variables?

I tried to override the Subscript operator to make matrix indexing a bit more "user-friendly" in complex expressions with the following code according to the ...
5
votes
1answer
81 views

GaussianMatrix function issue

Here is my implementation of the built-in GaussianMatrix function. ...