Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

2
votes
2answers
79 views

Creating function with matrix argument

I am completely new to programming, so I apologize in advance for a stupid question. I want to program an algorithm for computing invariant factors of a finitely generated abelian group, so in ...
4
votes
1answer
132 views

Exported animated gif with matrices will not work?

I want to export a list of matrices as a gif so that they will appear one after another 2 seconds apart. I've tried the following but when I open it up it only does the first two matrices and I have ...
0
votes
1answer
91 views

Matrix Operation

I have a $3\times3$ matrix A, and a function sTrans that outputs two $3\times3$ matrices in a list when given a $3\times3$ ...
1
vote
1answer
109 views

Generate random nxn matrix with all negative eigenvalues

I need to generate an nxn matrix with random entries, but I also need all of the eigenvalues to be negative (real or complex doesn't matter). I have: ...
3
votes
1answer
93 views

Find the NullSpace of a matrix whose determinant is “almost” zero

If $A$ is a matrix such that $\det(A)=0$, it is easy to get a basis of the kernel of $A$ with NullSpace[A]. Now let's consider a matrix $B$, function of a ...
5
votes
0answers
148 views

Is it possible to implement symbolic sub matrices?

The accepted answer in the following link: http://stackoverflow.com/questions/5708208/symbolic-matrices-in-mathematica-with-unknown-dimensions provides a functionality to create symbolic matrices ...
0
votes
0answers
59 views

Is there a command like meshgrid in Mathematica? [duplicate]

Just like the title, I need to do a meshgrid in Mathematica, is there any command like that?
9
votes
3answers
711 views

How to show matrix multiplication step by step?

Given a matrix, A: A = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; How can I do the matrix multiplication A times A step by step?
-1
votes
2answers
64 views

Algorithm to generate a matrix [closed]

I need to generate a matrix from the following expression Sum[c^(i+j-2 k)(-1)^(-k+j)(i*j)/((i - k)!(j - k)!k!), {k, 0, Min[i, j]}] where i, j = 0,1,2,......N ...
1
vote
1answer
98 views

Expressing a matrix in terms of four basis matrices

I have five matrices and I want to represent one in the basis of other four. So how do I find the value of coefficients? For example, if the matrices are I1, ...
1
vote
1answer
107 views

Solving a System/Matrix of Equations in Matrix Form

Ok, I am trying to solve an equation involving matrices (well, tensors actually), which is of the form: $\mathbf{e}^{T} \cdot \mathbf{M} \cdot \mathbf{e}$ = $\mathbf{N}$, where $\mathbf{e}$ is an ...
3
votes
2answers
126 views

Convert matrix rows into variables

Can anyone show me how to set all matrix rows to variables. For example, I have matrix w={{1,2,3},{3,2,1},{0,0,0}} and I need to set each matrix row to be separate ...
1
vote
1answer
120 views

finding eigenvectors of a n*n symbolic matrix [closed]

is it possible to find eigenvectors and eigenvalues of this matrix in mathematica?i have no idea about solution!please help... ...
1
vote
1answer
72 views

How to simplify symbolic matrix multiplication using the associativity of scalar multiplication?

My input is (2A).(3B). Is there a way to get 6A.B? All I could get back from Mathematica was ...
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 ...
1
vote
1answer
99 views
0
votes
1answer
63 views

Solving at zeroes of a matrix - code only works for simple equation

I have a matrix of zeroes (True) and non-zeroes (False). The matrix is generated from a table of values of two other variables. I'm trying to observe how the solution for p3 changes with small ...
5
votes
3answers
94 views

SingularValueDecomposition outputs unsolved Root expressions [closed]

I have a simple 4x10 matrix of real integers (It's a Vandermonde matrix for x=1,2,...,10, if that's relevant) that I'm trying to do SVU decomposition on. When I use the SingularValueDecomposition ...
3
votes
6answers
168 views

Change last column of a matrix

Given a (rectangular) matrix of integers, i.e. RandomInteger[4, {10, 3}] I want to apply the following rules only to the last column ...
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 ...
6
votes
3answers
231 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 ...
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 ...
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. ...
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 ...
2
votes
1answer
193 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
64 views
1
vote
1answer
196 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!
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 ...
5
votes
3answers
302 views

Visualization of matrix transformations

I define the "matrix transformation" here as follows: $\left[ \begin{matrix} x_1' \\ x_2' \\ \end{matrix} \right]=\left[ \begin{matrix} a & b \\ c & d \\ \end{matrix} ...
1
vote
0answers
87 views

NMaximize with matrix input

I defined function f[x_, fixed_] := {...}. Here x is an $M\times N$ matrix. I want to maximize $f$ with respect to $x$. I have ...
1
vote
1answer
96 views

sequence of matrix multiplications

My linear algebra book has questions that are are marked to use math software. There's probably some $50 guide on how to do everything but usually documentation has gotten me through. I've been kind ...
59
votes
2answers
2k views

Flatten command: matrix as second argument

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...
4
votes
1answer
153 views

Calculate the covariance of a large matrix

I have to compute the covariance of 50 very large integer matrices (2500x2000 elements). However, according to my estimation this will take around 10 days. Do you have any ideas how to speed things ...
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 ...
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 ...
9
votes
3answers
903 views

An inverted pyramid

I want to draw a pyramid approximately like this ...
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 ...
31
votes
6answers
2k views

How to visualize/edit a big matrix as a table?

Is it possible to visualize/edit a big matrix as a table ? I often end up exporting/copying big tables to Excel for seeing them, but I would prefer to stay in Mathematica and have a similar view as in ...
2
votes
3answers
138 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
287 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 ...
1
vote
1answer
114 views

Inverting matrix of unknown size

I have a matrix that has a variable number of columns and rows (but it is always square). The matrix is: $$ \Gamma = \begin{bmatrix} \Theta & 0 & 0 & 0 & T & 0 & R_j \\ ...
0
votes
2answers
1k 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 ...
6
votes
3answers
110 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
78 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 ...