Questions on the manipulation of matrices in Mathematica.
2
votes
2answers
85 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
132 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?
-1
votes
1answer
62 views
0
votes
0answers
33 views
How could I find the correct values for every array that would lead me to unique summation number for every unique chain? [migrated]
I have 9 arrays, each array has 9 values, I need to get the proper values in every value's position for every array, and that would give my a completely unique summations for every value's chain from ...
2
votes
2answers
43 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
121 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
137 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
116 views
0
votes
0answers
47 views
2
votes
2answers
85 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
0answers
72 views
2
votes
1answer
81 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 ...
2
votes
1answer
44 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
167 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
84 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 ...
2
votes
2answers
155 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
61 views
0
votes
0answers
80 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
79 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
87 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
117 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
63 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
145 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
88 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
41 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 ...
5
votes
4answers
258 views
How to find the index of a square matrix in Mathematica quickly?
Let $A$ be an $n\times n$ complex matrix. The smallest nonnegative integer $k$ such that $\mathrm{rank}(A^{k+1})=\mathrm{rank}(A^{k})$, is the index fo $A$ and denoted by $\mathrm{Ind}(A)$. I would ...
0
votes
1answer
89 views
large matrix eigenvalue problem
I need solve a very large complex matrix (not sparse and not symmetry) eigenvalue problem, e.g., 1e4*1e4 or even 1e6*1e6.
How large dimensions of the matrix can Mathematica support? And, how about ...
2
votes
0answers
56 views
Fast calculation of commute distances on large graphs (i.e. fast computation of the pseudo-inverse of a large Laplacian / Kirchhoff matrix)
I have a large, locally connected and undirected graph $G$ with $\approx 10^4$ vertices and $\approx 10^5$ to $\approx 10^6$ edges. Moreover I can bound the maximum vertex degree as $Q_{max}$. I ...
4
votes
3answers
104 views
Compute the rank of a matrix with variable entries
Say I have a matrix like
$$
M=\left(
\begin{array}{c c c}
x & xz & w-2x \\
wz^3 & xy & z \\
y^2-z^3 & x+w & z+x^5
\end{array}
\right)
$$
is it possible to ask Mathematica ...
1
vote
2answers
76 views
Matrix echelon/upper diagonal form
Is there a way to find the echelon form of a matrix in Mathematica? I see there is a function to find the reduced echelon form, RowReduce[], but I can't see ...
0
votes
0answers
77 views
Defining and Solving Systems of Equations Using Matrix Tables
I've defined a system of equations, but I been unable to get Mathematica to solve for the individual variables created by matrix tables.
...
1
vote
0answers
83 views
Dynamically filling matrix with a[[n,m]] = 1/a[[m,n]]
I'm building a square matrix, with 1s on the diagonal and elements in U the inverse of elements in L, which are random integers drawn from the sequence 1, ..., 9. Given the nature of the problem I ...
-4
votes
2answers
75 views
Ploting from Matrix [closed]
I use Import function from excel in order to get my data. My data contains 3 columns.
...
2
votes
2answers
68 views
changing a symbol into a function variable
Struggled for a while on this problem and hopefully you can help... I have a mathematical expression that currently has a symbol where I used to have a function variable. How do I make the symbol ...
1
vote
2answers
99 views
Computing distance matrix for a list
Using functional programming in Mathematica, how can I compute a distance matrix for every element in a list of matrices... The distance would be computed between the item in the list and a "target ...
6
votes
5answers
194 views
Is there a built in function to obtain the back diagonal of a matrix?
Given the following matrix:
m = Array[Subscript[a, #, #2] &, {4, 4}]
how can I find the skew diagonal or anti-diagonal or back diagonal of the matrix ...
1
vote
1answer
85 views
Weighted Kirchhoff Matrix?
I have a weighted graph and I want its graph Laplacian matrix (what Mathematica calls the Kirchhoff matrix in the unweighted case). Is there an easy way to get this?
For example, the command:
...
1
vote
2answers
126 views
Efficient ways to create matrices and solve matrix equations
I am attempting, for the first time, to use Mathematica to do some serious linear algebra. I would like to solve systems of equations of the form $$U_{n n'} f_{n'} = b_n.$$
I have an expression for ...
0
votes
0answers
18 views
Symbolic Calculations with formal matrices [duplicate]
I want to make calculations with matrices in the form (for lovers of statistical mechanics, is just the first step replica symmetry breaking)
...
0
votes
0answers
111 views
6x6 matrix NullSpace
I'm working with a 6x6 matrix. Whenever I try to find the NullSpace and FullSimplify it, I get the error
No more memory ...
13
votes
6answers
327 views
Matrix Rotation
If I have a 2 D matrix of any size say
$\left(
\begin{array}{ccc}
72 & 32 & 64 \\
18 & 8 & 16 \\
63 & 28 & 56 \\
\end{array}
\right)$
$\left(
\begin{array}{cc}
72 & ...
0
votes
0answers
300 views
Jacobi eigenvalue and eigenvectors algorithm
Suppose we have a symmetric matrix with dimensions n x n. I need to find the eigenvalues and eigenvectors of this matrix using the Jacobi method. I wrote this code:
...
3
votes
0answers
65 views
Is it possible to lower the bitwidth of (floating point) numbers?
The answer to this question will most probably be a definite no. Nevertheless, I would like to know whether it is possible to represent reals in the memory on less than the standard 32 or 64 bits ...
-1
votes
2answers
77 views
Convenient methods to sum select rows (or cols) of a matrix? [duplicate]
What are some convenient methods to sum selected rows or columns in a matrix? This question Summing along rows or columns of a matrix only addresses how to sun entire rows or columns ie, by level.
...
4
votes
1answer
66 views
Using the mouse coordinates to index a matrix
I would like to "write" on to a matrix using the mouse. That is, I would like to use the integer value of Locator coordinates (p) to index a matrix. Then, if the mouse button is down, write a 1 in ...
1
vote
3answers
109 views
Define new number set
May seem strange at first, but can you make mathematica change the value of 0 to 10 and 11 to 1 for all occurrences. Let me explain:
I'm looping through a matrix and for each element, I want ...
-7
votes
5answers
197 views
Translating MATLAB's cell2mat into Mathematica
How I can define a function in Mathematica such that it acts same as the cell2mat command in MATLAB?
Example (in MATLAB):
...
1
vote
2answers
85 views
How do I divide the columns of a matrix by the sum of its elements?
I am trying to create a transition matrix for a network. In order to do this, I need to sum down the column (the out degree), and then divide the column by the out degree in order to normalize it.
...
0
votes
1answer
78 views
Dynamic List Building and Exporting [closed]
My ultimate goal is to have a text file that contains the following information in the following format exported to a text file:
...
0
votes
3answers
152 views
Matrix Determinant
I have an N by N (N>3) matrix generated from fortran. I would like to find determinant of that matrix using mathematica? I could do this for a 3 by 3 matrix. I can also import the fortran output file ...





