Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

1
vote
1answer
103 views

Principal Components - how to obtain linear transformations?

I have a list "xlsf" with 6 columns and 1200 rows for PCA analysis. The PrincipalComponents[xlsf] gives the following: "The principal components of matrix are linear transformations of the original ...
0
votes
1answer
60 views

Extract a smaller matrix from a bigger one [closed]

May be duplicate, but, how it is possible to make a matrix or table of smaller dimensions, from a matrix with bigger dimensions. I mean, one may want to extract a 25*25 table from a 25*50 matrix. I ...
0
votes
0answers
159 views

3D isosurface plotting

I have a matrix of data of the form of 3 vectors R, Z, M1, M2, M3 ..., cylindric coordinates representing a measurement M of an axisymmetric hypersonic flow at the position R, Z (I don't measure along ...
1
vote
2answers
120 views

Selecting parts of a matrix via indices given by a vector

I have a column vector of the form $\{1, 1, 2, 3, 2, 3\}^t$ and an associated matrix that has the same number of rows as the column vector, $6$, and a number of columns that is equal to the maximum of ...
3
votes
3answers
206 views

Algorithm to generate a certain matrix

I am looking for a convenient way to generate a matrix of the following symmetric form (numbers could also run from -3 to +3 or just from -1 to +1): Tips, anybody?
1
vote
1answer
113 views

Check every list element for appearance

I'm used to MATLAB so this might be a stupid question but Mathematica is freaking me out. I have a big matrix with the following format: ...
0
votes
2answers
111 views
1
vote
0answers
51 views

How to find a scaling parameter in matrix inversion process by MMA?

I simply would like to find the inverse of a given matrix $A$ by the iterative method $X_{k+1}=X_k(2I-AX_k)$ using $X_0=\frac{1}{\sigma_{max}^2}A^*$. An example is as follows ...
6
votes
3answers
163 views

Finding the position of similar elements in a matrix

I want to find the position of the elements which are equal in a matrix. For example in the case of the following matrix: $m =\left( \begin{array}{cc} a & x \\ x & a \\ \end{array} \right)$ ...
1
vote
2answers
94 views

How to binarize a matrix [closed]

I have this matrix A = {{17/25, 3/25, 5/25, 0, 0}, {5/18, 5/18, 7/18,1/18, 0}, {4/21, 9/21, 4/21, 0, 4/21}, {0, 0, 3/4, 1/4, 0}, {3/4,1/4, 0, 0, 0}} And i ...
0
votes
1answer
52 views

Transition matrix of order n [closed]

I am doing a work about Markov Chains and I have as task to determine, either by induction or by spectral methods, the form of the higher order transition matrix of the model. My transition matrix ...
7
votes
4answers
404 views

Generating an Ulam spiral

An Ulam Spiral is quite an interesting construction, revealing unexpected features in the distribution of primes. Here is a related topic with one answer by Pinguin Dirk, who has provided one ...
13
votes
5answers
464 views

Graph from binary matrix (not adjacency) respecting the original matrix positions

I have a binary matrix. My objective is to connect every close (without "jump") elements with value equal to 1, but I must keep the point positions, just like it's shown at the image. Can somebody ...
2
votes
2answers
123 views

Create a matrix of matrices using Band and ArrayFlatten [duplicate]

I can easily write a simple Band matrix using: SparseArray[{Band[{2, 1}] -> a}, {Dim, Dim}] where a is a number. Now, I ...
0
votes
1answer
41 views

Matrix as a function of $x$ [closed]

I need to use four functions of $x$ DD11 = @(x) x+0*x; DD12 = @(x) x^2+0*x; DD21 = @(x) cos(x)+0*x; DD22 = @(x) 1+0*x; and since they all represent the same ...
1
vote
2answers
121 views

dropping a row with at least one value larger than a particular value

So for instance I have M X N table. I want to drop any row which has an element larger than, say, one in the second or the third column. I guess I have to do some sort of pattern matching. But not ...
2
votes
1answer
47 views

Complement for a Matrix

In a matrix, there are some non-zero elements same as: aA= Also, there is a list such as: list = {a, b, c, d, e, f, g, ii, jj, kk}; I want to access to ...
4
votes
3answers
378 views

Efficient matrix / array generation

What is the most efficient way of generating the following matrix? $\left( \begin{array}{ccccc} 1 & 0 & 1 & 0 & 1 & 0 & 1 & \dots\\ \frac{1}{2} & \frac{1}{2} & 0 ...
1
vote
1answer
104 views

Matrix/tensor addition behaving funny under replacement?

I have two matrices I want to add, and one of the matrices is a tensor product of two vectors. I've used a SetDelayed to define the summed matrix, because I want to evaluate it for different values of ...
0
votes
2answers
136 views
0
votes
1answer
45 views

Importing a Matrix whit different column numbers depending on the row

I have a bunch of coordinates given in a file. The file contains Startpoints and Endpoints of arrows in columns(Example): ...
3
votes
6answers
321 views

How can I construct a distance table?

I have a list of city names (of arbitrary length), f.e. c = {"BAL", "NYC", "LAS", "AUS"}; and the distances between them : ...
1
vote
3answers
129 views

Working with nested matrices

I have a matrix: A = {{a, b}, {c, d}} But each its element, itself, is another matrix too. ...
0
votes
1answer
65 views

Swapping rows and columns in matrix [closed]

If I have an array like the following $\left( \begin{array}{ccc} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{array} \right)$ How can I swap the rows and columns, so it is ...
1
vote
1answer
117 views

Matrix and random, weighted assignment of rows

I asked a question in this category previously but my problem has changed. On one hand, I have a large number of data files as .dat format, and on the other hand, I have a matrix ...
1
vote
1answer
47 views

Correctly substituting a matrix into a scalar equation [duplicate]

I am having trouble correctly substituting a matrix into an (originally) scalar equation. For example: A = {{3, 1}, {1, 2}} cp = CharacteristicPolynomial[A, x] ...
1
vote
1answer
80 views

Calculate the algebraic multiplicity of known eigenvalues of a large, sparse matrix

I have a large (and sparse) matrix with size 1000x1000 -- 10000x10000. I believe i know all eigenvalues for the matrices. All entries are integers and so are the eigenvalues. I want to check this by ...
1
vote
1answer
37 views

Evaluation of m.v is blocked by applying MatrixForm. Why? [duplicate]

I'm trying to understand what is happening in the notebook session below. I have a 2x2 matrix m = {{-1,-1}, {-1,-1}}. And a vector ...
1
vote
2answers
153 views

Convert DelaunayTriangulation-> Graph->AdjacencyMatrix

Is there a way to convert a Delaunay Triangulation into a Graph structure so that one can generate an AdjacenyMatrix of the Delaunay?
0
votes
1answer
167 views

How to create a 2D array (matrix) [closed]

I am pretty new to Mathematica. I need to create 2d array dynamicly. I got some code in C++(Qt) and it looks like this: ...
1
vote
1answer
82 views

Matrix and string variable

There are $100$ .dat data files which contain numerical parameters. ...
4
votes
2answers
118 views

Checking powers of a matrix for zeros

I'm currently working on a project that deals with numerical semigroups and their connection to matrices. I'm pretty new to Mathematica, so I wouldn't be surprised if my question has a simple ...
2
votes
1answer
57 views

Sorting a matrix except its last row

Given M = {{"Utah", 2}, {"Iowa", 1}, {"Maine", 3}, {"Total", 6}} I want to obtain the reverse-sorted result like this: ...
2
votes
2answers
134 views

Building adjacency matrix from set data

I have two sets: games and players. Players pick their games. As such I will have data say g1={p1,p3,p5},g2={p2,p4},g3={p2,p3,p5}. My interest though is to build the connections among players because ...
1
vote
0answers
58 views

vector/list containing matrices as elements dot product [closed]

mA = {{a11, a12}, {a21, a22}}; mB = {{b11, b12}, {b21, b22}}; mC = {{c11, c12}, {c21, c22}}; mD = {{d11, d12}, {d21, d22}}; v={{mA},{mB}}; w={{mC},{mD}}; What I ...
2
votes
1answer
115 views

Loop in solving multiple matrix calculation

I am wondering is there a way to use loop, like Do, For, to rewrite the last line in the code. I tried to use ...
0
votes
1answer
94 views

Select positive value from a vector

I am wondering how to pick out the positive Omega value from soln, and make these positive values into a row vector. I know how ...
0
votes
1answer
108 views

Factor vector out of a matrix

I am wondering how to factor a[1],a[2],...,a[4] out of sim so that I can write sim as the ...
0
votes
1answer
89 views

Mapping a function over n levels

I want to map a function over a matrix of rank n, for example: ...
1
vote
2answers
107 views

How to drop the identical rows and columns of a matrix?

I'm currently trying to find a way to eliminate from a square matrix of generic dimension the duplicate (up to sign) rows and columns, obtaining a smaller dimensional matrix. I searched around here ...
2
votes
2answers
142 views

Matrix exponential via Cayley-Hamilton Theorem

I'm attempting to calculate the exponential of a matrix via Cayley-Hamilton theorem. (Following the "concrete example" from http://en.wikipedia.org/wiki/Cayley%E2%80%93Hamilton_theorem) I am having ...
0
votes
2answers
124 views

Make an effective projection of matrix

To best explain my problem, I will take the following example: Consider the following matrix : ...
0
votes
0answers
46 views

Extracting Coefficient Matrices from partial differential equations

I have a system of differential equations which are in the form Dt[a01,t] + u*Dt[a01,x] + v*Dt[a01,y] + w*Dt[a01,z] I have ten of these equations and my ...
1
vote
3answers
94 views

Finding if a matrix is square

I have a matrix which is constructed element by element through some iterations, and thus can be non-square. If it's not square, then I want to make it square filling with ...
2
votes
0answers
97 views

A math function similar to “LatticeReduce” for finding linear independent basis

We would like to ask a math function similar to "LatticeReduce" for finding linear independent basis. The input is a list of vectors $M=\{v_1,v_2,v_3,\dots\}$, with the following property: There is a ...
2
votes
1answer
93 views

How to define a matrix with all elements 0? [closed]

A matrix can be defined as M = Array[m, {3, 3}] which gives ...
2
votes
1answer
137 views

Find positions where two matrices differ

I have two matrices A and B of identical dimensions. What's the simplest (shortest) way to find the indices of differing ...
1
vote
1answer
64 views

Importing adjacency matrix from file of 0/1 arrays

Is it possible to import adjacency matrix for graph representation, from simple text file with NxN (rows x columns) of 0s/1s: 0 1 0 0 1 0 1 1 0 1 0 0 0 1 0 0
3
votes
1answer
138 views

Are there any more time-efficient ways to solve a matrix equation than with SparseArray and LinearSolve?

I am trying to solve a matrix equation, with the matrix being tridiagonal. The problem I am having is that a message keeps appearing that I don't have enough memory. Here is the code: ...
5
votes
2answers
346 views

Combining three R, G, B matrices into a single matrix of 3-tuples?

Working with Mathematica 8 on OSX here. I have three $1024 \times 1024$ matrices representing the counts from consecutive exposures onto a CCD with $R$, $G$, and $B$ filters on it, and am looking to ...