Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

6
votes
2answers
254 views

How to transform a matrix to upper-triangular with operation- tag elegantly?

Description: Recently, I have a thought that writing a function to show the transformation process when a matrix is transformed to upper-triangular. My trail ...
6
votes
3answers
154 views

Remove Successive Duplicate From A Large List (200k by 4 matrix)

I am interested in removing successive duplicate rows from a very large list (~200k rows by 4 columns) using Mathematica.The built-in 'DeleteDuplicates' seems to remove all duplicates, I am interested ...
8
votes
2answers
313 views

How to add a vertical line to a matrix?

Today, I want to write a program to show the solving process of a the inverse of a matrix, and I use the Elementary transformation, so I need to add a vertical ...
0
votes
0answers
36 views

Numerical Error with Matrix operations

A is a 3x3 matrix, b is a 3x1 vector. I try to convert [A|b], a 3x4 matrix, to [I|0]. So the formula is right multiple ...
8
votes
3answers
295 views

Random Integer Sequences

I want to construct a random square matrix in the following manner: a) Three states [0 | 1 | 2] are repeated ...
1
vote
2answers
90 views

Verify positive definiteness using random numbers

I wish to verify whether T'T - IdentityMatrix[2] is always positive definite for a certain choice of elements of T'T. ...
2
votes
1answer
194 views

An intuitive way to form an augmented matrix

Given an $m\times n$ matrix $A$ and a $m\times 1$ vector $b$, what is the most "intuitive" way of forming the augmented matrix $[ A\ b]$? The most concise way that I know of is ...
3
votes
1answer
65 views

Computing kernels of a matrix in distinct cases

I have the following matrix: ...
1
vote
0answers
31 views

Symbolic computation under certain assumptions [duplicate]

Assume that I have a matrix $M$ and I'm doing some operations on it. Is there a way to specify that two variables satisfy an equation say $x=y^2$ and then let Mathematica compute under that ...
1
vote
1answer
197 views

Dirac Gamma matrix Algebra in different dimension

Do anyone know if we could do Dirac Gamma Matrix Algebra by FeynCalc with Gamma Matrices defined in different dimension than 4, e.g. DiracTrace of gamma matrices in 2+1 dimension? Thanks!
6
votes
3answers
232 views

Need help with plotting triple data points while xy data are not regular?

recently I plotted some figure in matlab whose quality is not so satisfactory, so I come to mathematica as my supervisor suggested. This is how it looks like in matlab:. In matlab I have three m by n ...
4
votes
3answers
67 views
14
votes
2answers
404 views

Better way to test that a matrix is upper-triangular?

Today, I got to thinking about how to test that a matrix was upper-triangular. So I had a try at it. Algorithm $\quad \quad a_{ij}=0 $ Or $i \leq j$ $\Rightarrow$ $True$ My solution is ...
9
votes
3answers
905 views

An inverted pyramid

I want to draw a pyramid approximately like this ...
2
votes
3answers
122 views

How to multiply specific columns in a matrix of data?

So I need to make a plot of some ~2000 data points I have from a spreadsheet. I'm able to import the data just fine, it stores it like so sundat ...
6
votes
3answers
228 views

Efficient method to generate Tridiagonal 50 by 50 Matrix? [duplicate]

I'm looking to generate a tridiagonal 50x50 matrix, ideally without using loops. Suggestions on most efficient code for this?
3
votes
1answer
107 views

Why does LinearSolve return the transpose of the answer matrix?

I am trying to solve an equation of the form $dv=F\cdot dV$ where $dv$ and $dV$ are matrices derived from the row vectors $dx$, $dy$, $dz$ and $dX$, $dY$, $dZ$ respectively. If it helps, $F$ is the ...
2
votes
3answers
139 views

Syntax of transpose etc [closed]

This is a simple question: {{0, 1}, {0, 2}, {0, 3}}*Transpose[{{0, 1}, {0, 2}, {0, 3}}] returns an error in Mathematica but works perfectly fine in Wolfram Alpha. Can someone help me? Thanks so ...
9
votes
4answers
289 views

Replacing matrix values

I want to find the n largest values in a matrix and replace all others with zero. The solution I found uses ReplaceAll and becomes very slow as the size of ...
6
votes
3answers
111 views

How to create a block diagonal matrix by repeating a submatrix $n$ times?

If there is a submatrix, let's call $P$: $P=\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}$ And I want to have $n$, let's say $n=2$, such submatrices placed on the diagonal. The result is ...
3
votes
0answers
80 views

Fast principal component analysis

I'd like to speed up a principal value value analysis. The data contains a large set of vectors with a large dimension. Both are in the range of 1000. I want to obtain the loadings matrix for further ...
0
votes
1answer
57 views

Combining lists in a matrix

So I have a list of data A={1.1,1.2,1.3,1.4,6.1} etc and B={2.5,2.6,2.7,2.8,2.9} I need to combine the lists into a matrix C ...
3
votes
1answer
189 views
4
votes
1answer
114 views

Efficient Dyson series implementation

I'm trying to implement a Dyson series \begin{array}{lcl} U(x,x_0) & = & 1 + \int_{x_0}^{x}{dy_1V(y_1)}+\int_{x_0}^x{dy_1\int_{x_0}^{y_1}{dy_2V(y_1)V(y_2)}}+\cdots \\ & &{} + ...
4
votes
1answer
98 views

CUDALink Error: A CUDALink kernel timed out?

I'm following the CUDALink tutorial [ http://reference.wolfram.com/language/CUDALink/tutorial/Introduction.html ] and everything is going fine until I get to the part that calls CUDADot on the ...
0
votes
6answers
201 views

How to build a game board [duplicate]

I have - rather lazily - constructed a chessboard like this: ...
3
votes
2answers
211 views

Order of eigenvectors [duplicate]

I have a matrix A = {{5, 4, 2}, {4, 5, 2}, {2, 2, 2}} The eigenvalues are 1, 1, 10 and I need to find the eigenvectors. ...
1
vote
1answer
67 views

m equations and n variables. Reducing using Mathematica

I have six equations and thirteen variables. I would like to reduce it to seven free parameters. I used Reduce to solve it but it is taking really long (one full day and no output yet) and I think ...
8
votes
3answers
299 views

How to remove a line of a matrix if not all elements are numeric?

I have a matrix a n columns and m lines. I'd like to efficiently remove the lines that are not entirely composed of numeric ...
2
votes
3answers
179 views

Hypergeometric function with a matrix argument

I am looking for the evaluation of a Hypergeometric function with a matrix argument as for example in Ploev and Edelman or as showcased in this Wikipedia article. From what I understand from ...
3
votes
3answers
126 views

Solving determinant of a Kronecker product of matrices gives a numerical error - why?

I am doing the following steps (code at the end of the post): I start with a 2x2 matrix (smatrix), which is a function of a single variable (u2). I want to set the determinant of this matrix ...
3
votes
2answers
306 views

How to create a 'shortest-path link matrix'?

I am currently struggling with a problem in Mathematica. I have a randomly generated weighted Barabasi-Albert graph and a corresponding demand matrix of the same size. I'm generating the graph with ...
4
votes
3answers
153 views

Split matrix by all-zero columns

Below is my input: mat = {{0, 0, 0, 0, 0, 1}, {1, 0, 0, 1, 0, 1}, {0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1}, {1, 1, 0, 1, 0, 0}, {0, 0, 0, 1, 0, 1}}; ...
13
votes
4answers
669 views

“Indexing” a vector

I need to "index" a vector according to the first occurence of its distinct elements. I have written ...
2
votes
2answers
108 views

Making a conjecture concerning a certain upper-triangular matrix

I have searched for commands which will let me to create matrices and do matrix operations, but I don't know how to apply Mathematica to the following exercise. Make a conjecture for the result of ...
0
votes
0answers
105 views

Spectral Clustering

I am interested in the following question: How is it possible to check whether an algorithm is working properly? However, this question is too general for the post and I'd like to restrict attention ...
1
vote
2answers
92 views

Block diagonal matrix [closed]

Suppose I have 4 matrices: A, B, C, D, and I want to form a block diagonal matrix from these sub-matrices, i.e. it would look like MatrixForm[{{A, B}, {C, D}}] ...
-2
votes
1answer
63 views

Compile Determinant [closed]

I would like to determine the determinant of a 4x4 matrix with the entries a[i,j] being functions of $i$ and $j$. I used Compile with code: ...
0
votes
1answer
65 views

Matrix consisting of the matrices [duplicate]

I need Dirac Matrix in my work. They consists of PauliMatrix and ZeroMatrix, which is: ZeroMatrix:=IdentityMatrix[2]-IdentityMatrix[2] I define Dirac Matrix as: ...
4
votes
2answers
189 views

Time-efficient creation of matrix

I have expressions like xx1=FF[1, 1] GG[1, 1] + FF[1, 1] GG[2, 2] + FF[2, 2] GG[2, 2] xx2=2*FF[1, 2] GG[1, 1] + FF[1, 1] GG[1, 2] + FF[2, 2] GG[2, 2] and I want ...
3
votes
2answers
109 views

Time-efficient manipulation (zeroing) of expression

I have huge matrices in the form of ...
0
votes
0answers
52 views

Question about the matrix operation [duplicate]

I was wondering if there is an automatic way to do this kind of matrix operation. For example, for a given matrix ...
8
votes
11answers
1k views

Ragged Diamonds

diamond[n_Integer] := Table[1, {#}] & /@ (Range[n]~ Join~Range[n - 1, 1, -1]) diamond[5] // MatrixForm How could a more functional, "tablefree", solution ...
1
vote
2answers
173 views

Sort matrix rows iteratively according to sum of some columns

I have a matrix say ...
3
votes
2answers
127 views

Inserting rows of one matrix into rows of another matrix sequentially

I have two matrices M1 and M2. Both have same number of columns but different number of rows. I want to make a new matrix M which should have 1st row form M1, second row form M2, third row form M1, ...
-2
votes
1answer
80 views

$SU(4)$ Structure constants in mathematica

How can I write a mathematica function which will output arbitrary structure constants of SU(4)?
3
votes
3answers
99 views

Matrix manipulation

Thank you for looking and answering this question. I am trying to create a new matrix from an old one. Meaning, I have a original matrix that's 20x20. I want to keep the first five lines of the ...
1
vote
1answer
80 views

How can I transform a matrix to a vector (vectorization)? [closed]

How can I transform a matrix to a vector in mathematica? $A=\bigg{(}\begin{matrix} a_1 &a_2\\a_3&a_4 \end{matrix}\bigg{)} \longrightarrow |a>>=(\begin{matrix} a_1 ...
0
votes
1answer
74 views

Map Elements of a list to be Index of matrix

I have a sublist from Tuples[{1, 2, 3}, 2], say for example L={{1,2},{2,1},{2,2}}, and a 3 x 3 matrix ...
3
votes
3answers
255 views

Matrix containing ellipse

I have to make a matrix which contains elements in an ellipse shaped region, but I need to make ellipse region in such a way that larger axis of ellipse is inclined with angle θ with horizontal. With ...