Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

3
votes
3answers
211 views

Matrix multiplication that includes a tensor

How would I best express the following in Mathematica: $\begin{pmatrix}2 & 4\end{pmatrix} \begin{pmatrix}r_1 & r_2\\r_3 & r_4\end{pmatrix} \begin{pmatrix}6 \\ 8\end{pmatrix}$, where $r_i$ ...
1
vote
1answer
225 views

Partial row reduction of a matrix

I have an $m\times n$ matrix (presumably of full rank) with $m>n$, and I would like to row reduce it, but leave the last column unreduced; that is, I want to get output on the form $\pmatrix{ 1 ...
5
votes
4answers
801 views

How to find the index of a square matrix in Mathematica quickly?

Let $A$ be an $n\times n$ complex matrix. The smallest nonnegative integer $k$ such that $\mathrm{rank}(A^{k+1})=\mathrm{rank}(A^{k})$, is the index fo $A$ and denoted by $\mathrm{Ind}(A)$. I would ...
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 ...
2
votes
0answers
169 views

Fast calculation of commute distances on large graphs (i.e. fast computation of the pseudo-inverse of a large Laplacian / Kirchhoff matrix)

I have a large, locally connected and undirected graph $G$ with $\approx 10^4$ vertices and $\approx 10^5$ to $\approx 10^6$ edges. Moreover I can bound the maximum vertex degree as $Q_{max}$. I ...
4
votes
3answers
693 views

Compute the rank of a matrix with variable entries

Say I have a matrix like $$ M=\left( \begin{array}{c c c} x & xz & w-2x \\ wz^3 & xy & z \\ y^2-z^3 & x+w & z+x^5 \end{array} \right) $$ is it possible to ask Mathematica ...
1
vote
2answers
546 views

Matrix echelon/upper diagonal form

Is there a way to find the echelon form of a matrix in Mathematica? I see there is a function to find the reduced echelon form, RowReduce[], but I can't see ...
0
votes
0answers
200 views

Defining and Solving Systems of Equations Using Matrix Tables

I've defined a system of equations, but I been unable to get Mathematica to solve for the individual variables created by matrix tables. ...
2
votes
3answers
311 views

Dynamically filling matrix with a[[n,m]] = 1/a[[m,n]]

I'm building a square matrix, with 1s on the diagonal and elements in U the inverse of elements in L, which are random integers drawn from the sequence 1, ..., 9. Given the nature of the problem I ...
2
votes
2answers
113 views

changing a symbol into a function variable

Struggled for a while on this problem and hopefully you can help... I have a mathematical expression that currently has a symbol where I used to have a function variable. How do I make the symbol ...
1
vote
2answers
229 views

Computing distance matrix for a list

Using functional programming in Mathematica, how can I compute a distance matrix for every element in a list of matrices... The distance would be computed between the item in the list and a "target ...
8
votes
5answers
458 views

Is there a built in function to obtain the back diagonal of a matrix?

Given the following matrix: m = Array[Subscript[a, #, #2] &, {4, 4}] how can I find the skew diagonal or anti-diagonal or back diagonal of the matrix ...
1
vote
1answer
213 views

Weighted Kirchhoff Matrix?

I have a weighted graph and I want its graph Laplacian matrix (what Mathematica calls the Kirchhoff matrix in the unweighted case). Is there an easy way to get this? For example, the command: ...
1
vote
2answers
1k views

Efficient ways to create matrices and solve matrix equations

I am attempting, for the first time, to use Mathematica to do some serious linear algebra. I would like to solve systems of equations of the form $$U_{n n'} f_{n'} = b_n.$$ I have an expression for ...
0
votes
0answers
36 views

Symbolic Calculations with formal matrices [duplicate]

I want to make calculations with matrices in the form (for lovers of statistical mechanics, is just the first step replica symmetry breaking) ...
14
votes
6answers
635 views

Matrix Rotation

If I have a matrix of any size, say $\begin{pmatrix} 72 & 32 & 64 \\ 18 & 8 & 16 \\ 63 & 28 & 56 \\ \end{pmatrix}$ $\begin{pmatrix} 72 & 32 \\ 18 & 8 \\ 63 ...
5
votes
1answer
154 views

Is it possible to lower the bitwidth of (floating point) numbers?

The answer to this question will most probably be a definite no. Nevertheless, I would like to know whether it is possible to represent reals in the memory on less than the standard 32 or 64 bits ...
-1
votes
2answers
579 views

Convenient methods to sum select rows (or cols) of a matrix? [duplicate]

What are some convenient methods to sum selected rows or columns in a matrix? This question Summing along rows or columns of a matrix only addresses how to sun entire rows or columns ie, by level. ...
4
votes
1answer
139 views

Using the mouse coordinates to index a matrix

I would like to "write" on to a matrix using the mouse. That is, I would like to use the integer value of Locator coordinates (p) to index a matrix. Then, if the mouse button is down, write a 1 in ...
1
vote
3answers
139 views

Define new number set

May seem strange at first, but can you make mathematica change the value of 0 to 10 and 11 to 1 for all occurrences. Let me explain: I'm looping through a matrix and for each element, I want ...
-7
votes
5answers
483 views

Translating MATLAB's cell2mat into Mathematica

How I can define a function in Mathematica such that it acts same as the cell2mat command in MATLAB? Example (in MATLAB): ...
1
vote
2answers
645 views

How do I divide the columns of a matrix by the sum of its elements?

I am trying to create a transition matrix for a network. In order to do this, I need to sum down the column (the out degree), and then divide the column by the out degree in order to normalize it. ...
0
votes
3answers
279 views

Matrix Determinant

I have an N by N (N>3) matrix generated from fortran. I would like to find determinant of that matrix using mathematica? I could do this for a 3 by 3 matrix. I can also import the fortran output file ...
4
votes
2answers
246 views

Sorting a matrix alphanumerically

Somewhat related to Sort matrix by columns and rows without changing them, but more general. I'd like to sort a square matrix (a 3 by 3 in my case, but surely the general solution will treat any), ...
-2
votes
1answer
196 views

Fortran kind of matrix creation [closed]

I want to create the matrix H of dimensions nxn and matrix elements H(i,j). Because of the physical problem I am dealing with, it is necessary to build it in the following not trivial way. I know how ...
0
votes
1answer
149 views

Get value only from Position

If have the following command Position[{a, b, a, a, b, c, b}, b] (* Out[1]= {{2}, {5}, {7}} *) Is it possible to get only a sequence of values instead of this ...
2
votes
3answers
436 views

Convert coefficients of polynomials into a matrix

I have several sets of 5 polynomials of the form: ...
4
votes
1answer
509 views

Efficient method for inverting a block tridiagonal matrix

Is there a better method to invert a large block tridiagonal Hermitian block matrix, other than treating it as a ordinary matrix? For example: ...
8
votes
2answers
510 views

How to generate a matrix group?

I have three $7\times 7$ matrices (with real entries, lots of zeros) and I'd like to check if they generate a finite group (or, more precisely, if the group they generate is of precise order). Would ...
11
votes
3answers
3k views

Solving a time-dependent Schroedinger equation

I want to solve the time-dependent Schroedinger equation: $$ i\partial_t \psi(t) = H(t)\psi(t) $$ for matrix, time-dependent $H(t)$ and vector $\psi$. What is an efficient way of doing this so ...
1
vote
1answer
102 views

Is there a cleaner/shorter way to select-replace in matrices? [duplicate]

I love Mathematica, but I find it oddly lacking when it comes to how matrices are handled. Here is an example of code that works but seems like it should be a lot shorter (and minus the loop). I'm ...
7
votes
2answers
325 views

Why does my matrix lose rank?

I want to check the rank of a matrix for observability, but Mathematica loses a rank if the matrix contains very large numbers. Let's say my matrix is ...
4
votes
2answers
3k views

How to use a 3×3 covariance matrix to plot an error ellipsoid?

I have a 3×3 error covariance in Mathematica, but I don't know how to use it for plotting the error ellipsoid. It would be great if you can show me how I can do that for the below covariance matrix: ...
0
votes
1answer
361 views

Why is EigenValues returning Root expressions?

This is the code I have: ...
2
votes
1answer
180 views

Replace a specified portion of an array with elements from another smaller array

This may be a trivial question, but I have been at it for a couple of hours and I have not made much progress. I have a 10 x 10 array (T) that I have used to generate an 8 x 8 array (Q). I want to ...
0
votes
1answer
92 views

Why does Eigenvalues[matrix I defined] not work? [duplicate]

This is the code I have in my mathematica notebook. I want to find the eigenvalues of the matrix I created called Hmatrix as defined below. However when I type Eigenvalues[Hmatrix] I get the Hmatrix ...
0
votes
1answer
444 views

How to use Compile for accelerating matrix multiplications?

I am trying to find the inverse of the matrix $A$ m = n = 500; SeedRandom[123456]; A = RandomReal[10, {m, n}]; iteratively using the following matrix ...
3
votes
1answer
394 views

How to get the determinant and inverse of a large sparse symmetric matrix?

For example, the following is a $12\times 12$ symmetric matrix. Det and Inverse take too much time and don't even work on my ...
-1
votes
1answer
159 views

An issue regarding Eigenvalues function [closed]

Can anybody please kindly explain to me why the members of the output vector produced by the following example are not equal to zero? ...
1
vote
1answer
902 views

Importing a matrix from a text file

I have a $4 \times N$ matrix in a .txt file of the form: -17.071 137.567 16.554 0.65 -16.873 136.138 16.934 0.7 -15.397 135.738 16.894 0.7 -14.7 135.982 15.9 0.6 ...
1
vote
3answers
1k views

How do I create a matrix of functions?

I'm trying to create a matrix in which the elements are functions of two variables, but I can't figure out how to do it. Is it possible? The only way I could figure out is to define the matrix in ...
2
votes
1answer
348 views

Solving an equation involving a determinant

I have a matrix which doesn't include numerical values. There are four variables in it. It is defined by ...
3
votes
2answers
556 views

All possible solutions to the Matrix Equation (free variables appearing)

I am attempting to solve a system of linear equations using LinearSolve[] . In my case, the number of unknowns are more than constraints. I learnt that LinearSolve ...
6
votes
3answers
322 views

Permanent minors

The function Minors yields the minors of a matrix. Is there a function that yields the permanent minors of a matrix?
12
votes
1answer
1k views

Eigenvalues and Determinant of a large matrix

Can anybody kindly explain to me what is going wrong regarding a simple problem I have? I can find the eigenvalues of a large matrix using Eigenvalues[], but when I ...
1
vote
1answer
73 views

Confirming the existence of a function related to a matrix

Is it possible to get an answer to the following question in Mathematica? Let $M$ be a $n$ by $n$ matrix, is there a function $m:\mathbb{N}\times \mathbb{N}\rightarrow \mathbb{Z}$ such that ...
7
votes
1answer
535 views

TensorContract of inverse matrix

Matrix inverse in mathematica If $A$ is an invertible $n \times n$ matrix, then $A\cdot A^{-1} = I$. To get this statement in Mathematica, you need the assumption ...
8
votes
2answers
1k views

How to use “Drop” function to drop matrix' rows and columns in an arbitrary way?

The built-in function "Drop" can delete a Matrix's row and column. Typical syntax for "Drop" is as follows: Drop[list,seq1,seq2...] But what if I want to drop a ...
3
votes
0answers
129 views

How to accelerate updating some parts of sparse matrices?

I am trying to update some parts of an specific matrix as rapidly as possible. In what follows, I first set up the basics things that I want to use ...
6
votes
1answer
147 views

How to calculate only four elements per column in a block matrix?

I have a matrix generated like this : Table[Sequence @@ {f[t[[i]], j, x], g[t[[i]], j, x]}, {i, 16}, {j, 3}] where $f$ and $g$ are two different functions, $t$ ...