Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

2
votes
2answers
223 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 ...
1
vote
1answer
114 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
0answers
64 views

System of equations

Here I have one problem how to solve system of equations symbolically. Mathematica needs improvement of code, but I am not sure how to do that ...
0
votes
2answers
111 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
197 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
110 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
118 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 ...
-2
votes
1answer
215 views

Define matrix in Mathematica [closed]

How are arrays allocated properly in Mathematica? Or how are the dimensions defined? For example, I can't do testarray[[1]] = 1 or Do[testarray[[i]] = i,{i,5}] Let's say I wanted to do the ...
3
votes
2answers
307 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
184 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
87 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 ...
0
votes
1answer
92 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
734 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
63 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
92 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
143 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
158 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
33 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
1answer
140 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 ...
-1
votes
2answers
176 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
391 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
360 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
97 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
126 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
124 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
211 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
229 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
147 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
405 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
921 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
260 views
0
votes
0answers
55 views

Dot doesn't work [duplicate]

I have a problem with the matrix product (Dot). Here is my code: ...
2
votes
2answers
282 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
179 views
2
votes
1answer
107 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
98 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
206 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
122 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
4answers
520 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
192 views

How to normalize parts of matrix elements?

To normalize the last 2 or more columns of a matrix, ...
0
votes
0answers
299 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
148 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
149 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 ...
3
votes
2answers
194 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
100 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 ...
8
votes
3answers
199 views

Declaration of abstract matrices to perform series expansion on them

I would like to have abstract matrices M and S to get out the coefficients of matrix power series however it treats M and S as numbers even if i checked that M.S - S.M != 0. I attach my code below: ...
3
votes
3answers
180 views

Matrix multiplication that includes a tensor

How would I best express the following in Mathematica: $\begin{pmatrix}2 & 4\end{pmatrix} \begin{pmatrix}r_1 & r_2\\r_3 & r_4\end{pmatrix} \begin{pmatrix}6 \\ 8\end{pmatrix}$, where $r_i$ ...
1
vote
1answer
118 views

Partial row reduction of a matrix

I have an $m\times n$ matrix (presumably of full rank) with $m>n$, and I would like to row reduce it, but leave the last column unreduced; that is, I want to get output on the form $\pmatrix{ 1 ...