Questions on the manipulation of matrices in Mathematica.
1
vote
2answers
173 views
How to extract RGB arguments as a list
Although the following lines of code work fine they are very awkward.
My questions are below
a = RGBColor[1, 0, 0]
b = RGBColor[0, 1, 0]
Is there a more compact ...
4
votes
1answer
124 views
Printing Block Matrices
I have a 2D matrix, such as:
d=2;
M=Array[a, {d^2,d^2}];
and I would like to print it in a way which emphasizes its dxd block matrix structure. If ...
5
votes
2answers
794 views
Eigenvalue / Eigenvector Calculation
I'm currently trying to compute the three smallest eigenvectors for a 34 by 34 matrix. While I was expecting this to take some time, Mathematica has been running for the past 3 hours, which seems ...
2
votes
5answers
120 views
Test First row of matrix
What is a good way to test the first row of a Matrix to check if one of the values equal a value. For instance, In this example, I want to get vector in the second row that has the bigger value in the ...
3
votes
2answers
266 views
Loop and do operations on Matrix, then graph the results
I'm trying to do some operations to a matrix in a loop, and then I want to graph the results.
The results are pair of numbers.
Can I store the results of each iteration on "something" and the use ...
2
votes
2answers
295 views
Total Variation Distance of probability matrix
How can I calculate the Total Variation Distance of a transition Matrix? is there any built in function? I've searched all documentation and haven;t found anything.
** More information:
Let me try ...
4
votes
2answers
160 views
Transform x-scale of data for e.g. MatrixPlot
I have to transform in a nonlinear way the x-scale of some data for a MatrixPlot (or ReliefImage or ...
2
votes
1answer
126 views
Numerical comparisons of matrices
I have a matrix which should be equal to a null matrix. However due to the numerical precision, a brutal equality test with a matrix initialized with zeros does not work.
How should I perform the ...
3
votes
1answer
385 views
stationary distribution of a transition matrix
How can I solve the stationary distribution of a finite Markov Chain? In other words, how can I estimate the eigenvectors of a transition matrix?
4
votes
1answer
435 views
Mathematica won't give eigenvectors but Wolfram Alpha will? What am I doing wrong?
If I ask Mathematica to find the eigenvectors and eigenvalues of the matrix:
...
1
vote
1answer
397 views
Creating a random normal matrix
I would like to create a random matrix with the constraint that the matrix must be normal, i.e. the matrix and its Hermitian conjugate must commute. I would create a random matrix "without ...
12
votes
4answers
282 views
Inputting a big structured matrix in Mathematica
Hi this is my first post and this is a problem that has bothered me a lot.
Suppose we have the $2012\times2012$ square matrix:
...
12
votes
1answer
256 views
How to extract and replace submatrix of a doubly-periodic matrix?
How can I effectively extract and replace a rectangular subpart of a toroidal matrix, i.e. one where boundaries are connected at opposite ends? Since the submatrix can overhang the edges, a simple ...
10
votes
2answers
189 views
How can I compute the representation matrices of a point group under given basis functions?
Take the $C_{3v}$ point group for example:
...
2
votes
3answers
407 views
Finding eigenvalues of a $1500\times1500$ matrix
I need to find the eigenvalues of a $1500\times1500$ real symmetric matrix given by $A_{i,i+1}= A_{i+1,i}=-1$ and also $A_{1,N=1500}=-1$ (this is because of a periodic boundary condition used) and all ...
9
votes
2answers
900 views
How to get Matlab data imported with the same dimensions?
I have some Matlab image data with the following dimensions (output is from Matlab):
>> size(im)
ans =
86 86 3 45
The data imports just fine ...
4
votes
4answers
919 views
How to convert equation to vector (matrix) form?
How can I convert expression a1*u1+a2*u2+a3*u3 to the vector form of dot product A.U, where ...
1
vote
1answer
300 views
Is Mathematica matrix multiplication with its inverse wrong? [duplicate]
Possible Duplicate:
Why don't * and ^ work as I expected on matrices?
When I enter this
...
1
vote
2answers
291 views
How to Solve or LinearSolve $A = I$ matrix equation?
I'd like to solve this equation for $A = B$ where $B = I$, which represents 3 systems of 3 linear equations, for $a, b, c, d, e, f$, without writing LinearSolve 3 ...
14
votes
3answers
646 views
Mathematica for linear algebra course?
I'm taking a linear algebra / matrix theory course and we are free to use any software we want, and will be "expected to use MATLAB or an equivalent" for homework. The professor and textbook (Applied ...
3
votes
4answers
121 views
Pack Solve results into a vector
I am currently using a really easy function to get the eigenvectors of a corresponding eigenspace:
...
0
votes
3answers
166 views
Constructing a list with a Module [closed]
I have build this simple module trying to construct a matrix via Table
...
9
votes
3answers
515 views
Correcting a correlation matrix to be positive semidefinite
Does Mathematica have a way to "fix" a correlation matrix that is not positive semi-definite?
I looked through the documentation and search the internet but could not find anything.
6
votes
1answer
238 views
How to turn a random graph into a matrix
I have constructed a random graph with Mathematica using the RandomGraph command. Now I would like to convert this graph to a matrix, but I don't know how. The ...
4
votes
2answers
125 views
Standardizing a coset table via matrix manipulation
Suppose we have a group $G$ and a subgroup $H$. A coset table encodes the permutation representation of $G$ on the right cosets of $H$. When we want to use these coset tables in calculations, it is ...
5
votes
4answers
323 views
Swap two entries in a matrix
Is there a nice, simple script one can use to swap two entires in a matrix? For example, suppose we have the matrix below:
$A=\begin{pmatrix}2 & 4 & 1\\
3 & 1 & 2\\
4 & 3 & 1
...
1
vote
2answers
178 views
Symbolically associate vectors and their norms
I am wondering how to handle the following situation: I do have vectors of known dimension that I would like to handle symbolically. I suppose I can do something like
...
1
vote
1answer
154 views
How do I use a matrix that has a variable?
I seem to be getting an error whenever I try running this piece of code.
Matrix12[n_] := {{1, 0}, {0, {\[Kappa]1[n]}/{\[Kappa]2[n]}}}
I've already defined the ...
2
votes
3answers
565 views
6
votes
1answer
387 views
vectorial ODE in mathematica with matrix exponentials
I want to solve the following equation in mathematica :
DSolve[{X'[t] == A.X[t], X[0] == ( {{0},{0}} )}, X[t], t]
It is a system of 2 ODEs coupled by the matrix A, ...
2
votes
2answers
374 views
Can RowReduce work in this matrix?
The matrix $Q$ with dimensions $n\times2*n*m$ is structured by
$$Q=[B|AB|\cdots|A^{2*n-1}B]$$
where $Q$ is an augmented matrix built from a $3\times3$ matrix, $A$, and a $3\times2$ matrix, $B$.
I ...
7
votes
1answer
222 views
Efficiently Constructing Rank One Approximations for a Matrix using SVD
Suppose I have a $m\times n$ matrix $A$ (real for simplicity). Then SingularValueDecomposition[A] yields 3 matrices $U$, $\Sigma$ and $V$ such that
$A = U\Sigma ...
6
votes
1answer
343 views
Finding the characteristic polynomial of a matrix modulus n
Given a square matrix, is it possible to calculate its characteristic polynomial modulo n?
Unfortunately, this function ...
4
votes
4answers
266 views
Prepend 0 to sublists
My question is similar to this one, but my goal is to prepend a single 0 the each sublist, not incrementally many 0's.
The file I'm working is a CSV containing around 50K sublists of length 35.
I've ...
2
votes
2answers
535 views
Matrix multiplication in Block Form symbolic calculation by Mathematica
I have a problem which requires taking product of two $10\times10$ matrices. I would like to do it by considering both matrices as $5\times5$ matrices such that each entry of both matrices is actually ...
10
votes
5answers
892 views
Best way to create symmetric matrices
From time to time I need to generate symmetric matrices with relatively expensive cost of element evaluation. Most frequently these are Gram matrices where elements are $L_2$ dot products. Here are ...
12
votes
4answers
305 views
How do you decompose a polynomial matrix into its matrix coefficients?
Let's say I have a matrix, $\mathbf{M}$, that is polynomially dependent on a single variable, such as
M = {{15 + a^2, a + 5 a^2}, {a - 5 a^2, 2}}
and I want to ...
4
votes
1answer
354 views
Computing Slater determinants
I need to compute Slater determinants. I'm wondering if I would benefit from assigning each of my functions to a variable prior to computation. I'm working with Slater determinants, but my question ...
3
votes
2answers
242 views
A dot appearing after a zero, and making the entries of a matrix into fractions
For more info about the difference between 0. and 0
I am a self-taught Mathematica user and I have some elementary questions-- perhaps too elementary for this site, but here they are.
If ...
4
votes
1answer
385 views
exporting list of matrices in mathematica
I am working on some problem which requires generating a list of random matrices. So I used the code (actually a shortened version of the code, but it does not matter)
...
28
votes
2answers
593 views
Tiling a square
I wondered if there was a way to automate the process of finding a way to tile a tile into a square.
The idea is to represent the tile with a matrix of 0s for blank space and 1s for filled spaces ...
3
votes
2answers
561 views
How to substitute numeric values in a symbolic Jacobian matrix?
I have a multi-variate function from $\mathbb{R}^n\to\mathbb{R}^n$. Choosing any desired initial vector, we can produce the corresponding function value, which is a vector as follows. The main problem ...
9
votes
2answers
215 views
How to extract and compute on the diagonal entities of a sparse matrix very fast?
As could be seen in the following code:
...
19
votes
1answer
911 views
Is there a way to convert an image into a Graph?
I'm trying to convert an image with several overlapping dots into a Graph. The goal is to be able to derive the Kirchhoff matrix for the randomly created "network ...
5
votes
1answer
501 views
Is it possible to substitute tick labels with alternative text? [duplicate]
Possible Duplicate:
Labelling ArrayPlot Charts
I am making a MatrixPlot. For example, consider the following:
...
4
votes
1answer
255 views
How do I keep the right ordering of eigenvalues using Eigensystem?
I'm having an issue with the Eigensystem command. I need to diagonalize a bunch of 3 by 3 complex valued matrices, but more importantly, I need to keep the exact ...
2
votes
1answer
158 views
Different determinants on 2 different computers
Is there any way to force Det to do itself in a certain way?
I've been running the same notebook on 2 differents computer, one MacOSX Lion and one W7 (both 32bit) ...
6
votes
0answers
228 views
Inverse of a large sparse Hermitian block matrix
I am looking for a method (if it exists) for the inverse of a large sparse Hermitian block matrix.
The off diagonal sparse matrices, named δ are 4x4, and they have ...
13
votes
3answers
436 views
Constructing a symbolic Hermitian matrix
I need to construct a symbolic Hermitian matrix like
m = {
{ n, a, b, b},
{Conjugate[a], n, b, b},
...
}
but I am not able to set ...
10
votes
2answers
555 views
Non-commutative symbolic linear algebra
I am fairly new to Mathematica but I thought I would be a helpful tool to carry out a few simple linear algebra calculations. It seems like an easy task but I cannot figure out how to do it. For ...
