Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

1
vote
1answer
167 views

Averaging multiple 2D data sets

I have multiple data sets, each of which is a 2D matrix. I want to construct a new 2D Matrix in which each element is the average of that element for all the original data sets. i.e ...
2
votes
2answers
403 views

Matrices and polynomials: MMA 8 vs. 9?

I want a function to take a polynomial from a list, plug a certain matrix T into that polynomial, and return the answer as another matrix. My program uses the applyPoly function suggested by a user in ...
3
votes
1answer
493 views

A rotation-like transform on a matrix

Do not be confused with comments, those are for previous version of the question - Kuba Imagine I have a matrix of the form: ...
3
votes
2answers
348 views

Optimization problem with matrix positivity constraints

Is it possible for Mathematica to parametrically find a local minimum of a given function (say of some variable $x$ where $(a,b,c)$ serve as parameters) subject to the constraint that a given ...
0
votes
1answer
518 views

Computing the fundamental matrix and its monodromy matrix

Assume $\dot x(t)=v(x,t)$ is a $T$-periodic, with respect to $t$ dynamical system. That is: $x\in\mathbb R^n,\quad t\in\mathbb R,\qquad v(x,t+T)=v(x,t)$. Let $x_0$ be a smooth periodic solution in ...
1
vote
1answer
136 views

Manipulate doesn't work for plotting a region where a matrix is positive semi-definite

I'm facing the following problem and would very much like you help. Thanks is advance! I have defined the following 4x4 matrix: \begin{equation} S=\left( \begin{array}{cccc} ...
0
votes
2answers
124 views

Create a Matrix out of two matrices

I have two matrices A = {{a1,a2},{b1,b2}} and B = {{x1,x2},{y1,y2}}. I would like to create out of these matrices a new matrix ...
2
votes
1answer
220 views

How to obtain a Symplectic 4×4 matrix?

I have a problem in obtaining a $2n \times 2n$ Symplectic matrix $T$, with $n=2$. I couldn't find a direct command in Mathematica to achieve this. Conditions: ...
1
vote
3answers
130 views

How can I threshold for a minimum value with MatrixPlot?

Looking at the Options for MatrixPlot, there doesn't seem to be a mechanism for lowerbound threshold - i.e. ignoring values that ...
0
votes
2answers
157 views

Taking averages at certain intervals

I am trying to take averages of a large two dimensional array at certain intervals. For example, for the first row, I want to take K averages of 500 values. Here is what I am trying ...
3
votes
2answers
618 views

Importing data into an array, column by column

I'm building a large matrix having different sized rows consisting of a few columns. The different columns are imported .txt files. Why can't I build the matrix column by column? For example, I ...
4
votes
5answers
199 views

Creation of one column matrix

I want to create an one column matrix with the 1st element to be -1, and all the other elements to be zero. However, I want to be able to make a matrix of this kind with arbitrary dimension, that is, ...
0
votes
2answers
99 views

How can I adjust matrices into the same ItemSize and aligned well in Notebook?

I typed three matrices, but they are not aligned well, and the Items in one matrix are also not aligned well and with differenct ...
1
vote
1answer
96 views

sequence of matrix multiplications

My linear algebra book has questions that are are marked to use math software. There's probably some $50 guide on how to do everything but usually documentation has gotten me through. I've been kind ...
0
votes
1answer
132 views

Sorting a list of triplets by first element of each triplet fails

In the last line of code, I´m trying to order the matrix by the first column. I want to store in the Array t2tlistsorted ( 100 x 3 ), but I can´t. ...
11
votes
3answers
901 views

How can I visualize 6 square matrices as a cube?

I have six square matrices of the same dimensions in a list, for example: ...
0
votes
1answer
74 views

Basic Row Traversal Question

Right now I'm using this For loop to do an operation to each row of a $n \times n$ matrix, I was trying to figure out how to do this with ...
0
votes
1answer
120 views

Finite precision - how to get rid of “near zeros” [duplicate]

I am performing a finite-precision operation on a matrix A which I know precisely; call the result B. The operation is taking ...
1
vote
2answers
176 views

Need an efficient method for finding certain matrices

I am trying to write a function which produces square matrices with certain characteristics. The function should have two inputs: number of the rows, n number of ...
4
votes
3answers
182 views

Output to preserve dot product

I am fairly new to Mathematica and I am faced with a problem. I tried to search for the solution but it seems that I don't know how to formulate the short search request. I need to perform a matrix ...
0
votes
0answers
35 views

Eigenvalues for large matrices without Root-Solution [duplicate]

I read some other questions and tried to implement the given answers but yet, I did not succeed to find proper solutions for my eigenvalues. I hope someone can show me how to do this for this case, ...
1
vote
0answers
87 views

NMaximize with matrix input

I defined function f[x_, fixed_] := {...}. Here x is an $M\times N$ matrix. I want to maximize $f$ with respect to $x$. I have ...
1
vote
1answer
183 views

Hermite Normal Form in “columns” convention

After describing the Hermite Normal Form (HNF), MathWorld explains: The Hermite normal form for integer matrices is implemented in Mathematica as ...
0
votes
2answers
217 views

Most efficient way to sum over matrix products?

I have two lists. The first, coefficientlist, is dense and has dimension {176,176} elements. The second, ...
4
votes
0answers
521 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 ...
1
vote
2answers
509 views

How to find the position of non consecutive numbers?

Given a sorted table, how can I find the position of non consecutive numbers in the first column of the table? ...
2
votes
1answer
100 views

PermuteSubgraph not working? (Combinatorica)

I am trying to write a code to perform the QAP partialling analysis (here's a paper to know more) but the part in which I "scramble" the graph with PermuteSubgraph does nothing, I am actually not ...
1
vote
3answers
136 views

How to convert a spaceless data into tab delimited

I have a data set in form of:(this is just an example) 1324501020 3241030205 4332020134 the data are stored in a text file (e.g. data.txt) but I need to convert ...
0
votes
0answers
46 views

Difference between matrix rapresentation [duplicate]

I've noticed different behaviour in Mathematica between matrix representation: The matrix a={{1,2},{3,4}} is different from b=a // MatrixForm Why i obtain ...
0
votes
1answer
164 views

Pattern match with Table for matrix dimension check

In Mathematica, often an expression involving matrices will encounter dimension mismatch errors, like we are multiplying a 3x2 matrix to a 3x4 matrix. Below we define a new symbol Dim, which can be ...
2
votes
2answers
298 views

Optimizing functions taking matrix arguments

I'm looking for general information on how to optimize matrix valued functions, I have the following function I'm looking to maximize (or figure out if this is possible at all). ...
1
vote
2answers
402 views

extracting the rows of a matrix satisfying a condition (e.g. all elements negative)

I have a matrix with thousands of rows and want the submatrix comprising the rows of the original matrix that have, e.g. a negative element in column 3. How to do that?
2
votes
2answers
273 views

Expanding Matrix Expressions

I want Mathematica to recognize that A.(-B.C)+A.B.C = 0 Yet FullSimplify and the like leaves the expression as it is. How do I get around this?
0
votes
1answer
530 views

Add a sub-matrix of zeros in big matrix [duplicate]

I have a matrix of size $24\times24$ composed by 8 $3\times3$ submatrices in a diagonal way. I want to add a matrices of zeros ($3\times3$) between the sub-matrices, so the final matrix would be of ...
2
votes
3answers
1k views

Saddle Point in Matrix

Here is the Problem how to find out the Saddle Point inside Matrix. m = {{9, 3, 1, 8, 0}, {6, 5, 4, 6, 7}, {2, 4, 4, 3, 8}, {5, 6, 2, 2, 1}}
2
votes
1answer
364 views
2
votes
2answers
397 views

Mass Symbolic Manipulation with Subscripts? (from plaintext Input)

The simplest example of the change being sought is a greek letter, typed in as plaintext nu, and its may be replaced by the symbol, ν: expr = 3nu*kx*ky+ ...
1
vote
1answer
197 views
2
votes
1answer
115 views

Optimizing a simple calculus using a list of matrices - Repeated dot product between a vector and a list of matrices [closed]

I want to make the following operation : $$ \begin{bmatrix} \dot q_1\\\dot q_2 \end{bmatrix} + \begin{bmatrix} \begin{bmatrix} q_1 & q_2 \end{bmatrix} \mathbf A_1 \begin{bmatrix} q_1\\ q_2 ...
3
votes
1answer
115 views

How do I access the binary matrix underlying an EdgeDetect output?

Applying EdgeDetect to an image generates a black and white edge-detected image, which I suspect corresponds to an underlying binary matrix. How can I access this ...
1
vote
1answer
230 views

Why is arithmetic faster for inexact arithmetic?

I have been trying to compute eigenvalues of a rather sizable matrix A, about $500 \times 500$ (but sparse). I asked Mathematica to compute ...
0
votes
2answers
154 views

Import matrices side-by-side separated by TAB

The problem is 0(TAB)0 interpreted falsely as a dark red square although it should be a dark red square surrounded by zeroes/ones. Import has different data-formats ...
5
votes
6answers
769 views

A matrix-vector cross product

I want to do a cross product involving a vector of Pauli matrices $\vec \sigma = \left( {{\sigma _1},{\sigma _2},{\sigma _3}} \right)$; for example, $\vec \sigma \times \left( {1,2,3} \right)$. ...
1
vote
1answer
307 views

How to normalize parts of matrix elements?

To normalize the last 2 or more columns of a matrix, ...
0
votes
0answers
381 views

Solve equations real and imaginary part separately

For my system of equations, the procedure described in Solving complex equations of using Reduce works no more. How can I separate the real and imaginary part of ...
2
votes
1answer
187 views

How do I plot Numerical Range of two hermitian matrices

Let $A_1$ and $A_2$ be two $3\times 3$ hermitian matrices. Then their numerical range is defined as two-dimensional set \begin{align} \mathbb{S}=\{\left[u^HA_1u,u^HA_2u\right]\in ...
3
votes
1answer
175 views

Exploiting self-adjointness when changing basis

I am using Mathematica to analyze a real, self-adjoint matrix $H$ of the size $32 \times 32$, which comes from a physics problem. In the picture there is also a matrix $Q$ which commutes with $H$. I ...
5
votes
0answers
370 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 ...
3
votes
2answers
210 views

How to rewrite this function to be faster: Find sub-matrixes of boolean board which imply a given boolean pattern

I have Boolean matrix A (called "board") and Boolean matrix B with smaller dimensions (called "pattern"). I am trying to find sub-matrixes C of A such that C has same dimensions as B, and ...
3
votes
1answer
128 views

Defining an Implies operation that works for Boolean matrices

I have two Boolean matrices, that both have dimensions m x n. I want to create a function TableImplies, which would return True ...