Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

3
votes
2answers
221 views

All possible pairs of two items

I have 4 different items {1, 2, 3, 4}. I want to obtain all possible pairs of two of the items. I have written: ...
0
votes
1answer
77 views

How to power-series expand determinants?

Say $g$ is a matrix which is given as, $g = g_0 + xg_2 + x^2 g_4 .. +x^{d/2 -1}g_{d-2}+ x^{d/2}(g_d + h_d(log (x)))$ where $d$ is an even number and each $g_i$ is a matrix (same dimension as $g$) and ...
1
vote
2answers
77 views

Is there an easy way to divide a matrix into four blocks?

I often get a data table with column names and row names. For example: ...
0
votes
1answer
99 views

LinearSolve failing to find solution to system of linear equations of 64 variables

I've got a 64x64 Matrix L for which I want to find the solution to the matrix equation L . x == rho. L is defined as ...
8
votes
8answers
675 views

Replace interior of matrix with zeros

I have f.e. the following square matrix: ...
5
votes
6answers
647 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)$. ...
2
votes
1answer
86 views

Matrix constructed as a function inside a for-loop [closed]

I am trying to construct a matrix A which depends on variables x and y through iteration. My ...
1
vote
2answers
127 views

Generic Matrices

A multivariate Gaussian distribution for $k$ dimensions looks like this: $$\frac{1}{\sqrt{(2\pi)^k|\mathbf \Sigma|}}\mathbf e^{ -\frac 1 2 \mathbf x^T \mathbf \Sigma^{-1}\mathbf x }$$ $\mathbf x$ ...
0
votes
1answer
83 views

eigenvector bug also for matrix with numeric value [closed]

I just realize that probably there is a bug also in calculating the eigenvector of a matrix with numeric values (see here for bug in eigenvector calculation with symbolic value). In particular in my ...
15
votes
11answers
1k views

Efficient way to build a certain quadratic matrix

For odd n I'm looking for a short and swift way to construct with (f.e.) n = 3 n = 11 ...
0
votes
2answers
50 views

Modifying elements of a matrix after construction [closed]

Suppose I have constructed a matrix with all elements as a constant (say 1): N=4; A=ConstantArray[1, {N, N}]; Now I want to make A(2,3)=23 and A(4,3)=43. Can I ...
0
votes
1answer
45 views

How to track row swap in Gaussian elimination?

How do I track which rows were swapped in the Gaussian elimination using RowReduce? I am doing metabolic control analysis on a mathematical of the energy metabolism I have in Mathematica. I need to ...
0
votes
0answers
49 views

Geometric Transformation not working - degenerate points?

I've successfully used FindGeometricTransformation to project the simplex triangle onto the x-y plane: ...
2
votes
3answers
173 views

How can I reproduce the MatrixForm, NumberForm, XyzForm behavior?

I wish to write a function like MatrixForm, that affect only display but not evaluation, i.e. a function that automatically is stripped away from output. More ...
6
votes
2answers
193 views

How to get rid of nested matrices

If I type into Mathematica TensorProduct[IdentityMatrix[2],IdentityMatrix[2]] It gives me a result that has nested matrices. How do I turn that into a normal ...
0
votes
2answers
64 views

solving series of matrices by simply multiplication

I have a number of matrices {2*2} containing element in series ....so by what method I solve that ... ...
1
vote
1answer
82 views

Checkbox Matrix

Is it possible to create a dynamically changing binary $n \times n$ matrix $A$, which appears to the user as a $n \times n$ matrix/table of checkboxes and the user can change the entries of $A$ by ...
-4
votes
2answers
98 views

Output of mathematica. Quaternion to Matrix

If I have the following instructions: How will it be the output/how will it appears in Mathematica? something like this: I can't recognize the output in mathematica... How can I do to appear ...
5
votes
0answers
64 views

Bug in PositiveDefiniteMatrixQ?

This seems like a bug in PositiveDefiniteMatrixQ to me: ...
1
vote
0answers
73 views

How to sequentially select, from a large set of tuples (of matrices), those with a certain property

I'm interested in finding a computationally efficient way for selecting all tuples of matrices which have a certain property. The property I'm interested in is that I want the column sum, of f[the ...
28
votes
8answers
2k views

Longest path in 0/1 matrix

I have a matrix of 0's and 1's forming a number of disjoint paths:   I would like to find the lengths of the paths, and from that "spectrum," the longest length (in the above example: 27, ...
5
votes
2answers
99 views

Comparison Operation for Nested Matrices

I have a nested matrix n as bellow ...
0
votes
1answer
121 views

Rotation matrix $\to$ quaternion

I found a very good link about quaternions in Mathematica , but I don't know how to create a quaternion from a rotation matrix. Can anyone help me, please? Update I need this: A rotation may be ...
4
votes
6answers
394 views

Insert all elements from one matrix into another

I have two matrices $A$ and $B$ which are the same size. Each element of $A$ is a list of numbers. Each element of $B$ is just a number. How do I insert each element of $B$ into the corresponding list ...
2
votes
2answers
148 views

Measures of association, Concordant and Discordant

I want to calculate concordant and discordant pairs on nx2 tables. ...
0
votes
1answer
64 views

Matrix operations performed with column-vectors

We have 3 matrices: m1, m2 and b. We want to apply matrix operations (dot or sum) in a ...
3
votes
2answers
184 views

Addition of Matrices [closed]

How can I add the Matrices created by this: SeedRandom@0; Table[RandomInteger[{0, 34}, {2, 2}], {2}, {5}] // MatrixForm $\left( \begin{array}{ccccc} \left( ...
1
vote
2answers
127 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?
1
vote
2answers
61 views

Importing Text file and removing columns [closed]

I have a file that has 7 column but i only want to import two column from it, that is 1st and 3rd column from the file. How can i do that and this is the list for example: ...
3
votes
3answers
112 views

Creating nested matrix using random integers

How do i create 15x2 matrix with 2x2 random integer elements? My code only returned identical 2x2 elements:
0
votes
1answer
118 views

Inverse of a restriction of a non-invertible matrix

Let $A∈R^{4×4}$ be a non-invertible matrix, with $2$-dimensional kernel. How can I compute the inverse of the restriction of $A$ on a subspace where it is invertible: $A^{-1}v \,\,\,\,$ where ...
3
votes
2answers
476 views

Has Mathematica a function to compute the Smith Normal Form?

The Smith normal form is a matrix that can be calculated for any matrix (not necessarily square) with integer entries. See Wikipedia for a more elaborate description. Has Mathematica a function to ...
0
votes
2answers
120 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
37 views

how to rewire the minimum number of edges in a disconnected bipartite graph, so to transform it in a connected one

Consider an incidence matrix A for a bipartite graph (Aij=1 if node i of group 1 and node j of group 2 are connected). A is not symmetric. Assume that A is disconnected or only weakly connected, i.e. ...
0
votes
1answer
56 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 ...
1
vote
1answer
97 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
0answers
131 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
113 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
202 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?
0
votes
2answers
106 views
1
vote
1answer
110 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: ...
1
vote
0answers
49 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
159 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
87 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 ...
13
votes
5answers
451 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 ...
7
votes
4answers
379 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 ...
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 ...
2
votes
2answers
104 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 ...