Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

0
votes
0answers
31 views

Gaussian Elimination with full pivoting

I have some problems with an implementation of the Gaussian elimination with full pivoting. It seems to me that I've programmed it correctly, but nevertheless it throws errors and I can't find my ...
0
votes
0answers
25 views

Generating vectors with restrictions on a lattice

Suppose we are given a certain adjacency matrix that contains the information for a given lattice. I want to generate a configuration of vectors that satisfy a restriction. Specifically, if I have ...
3
votes
1answer
196 views

Spectral Clustering

I am attempting to implement a spectral clustering routine using Mathematica, but I am encountering difficulties. Using the standard Gaussian similarity function found in section 2.2 of this paper ...
8
votes
3answers
339 views

Plotting triple data points while xy data are not regular

I plotted recently some figures in Matlab and their quality was not that satisfactory, so I come to Mathematica as my supervisor suggested. This is how such figure looks like in Matlab: . In Matlab, ...
10
votes
1answer
275 views

Drop selection of columns from a ragged array

I have an application where I need to drop some arbitrary list of columns from a ragged array (where of course the shortest array rows have at least all the specified columns). E.g., given a ragged ...
8
votes
2answers
515 views

Is there any fast way to solve a quadratic matrix equation in Mathematica approximately?

Let the square nonsingular matrix $M$ is a given convergent matrix. What are the best scalar values for $\alpha$ and $\beta$ (in the real numbers domain), at which the following quadratic matrix ...
4
votes
2answers
130 views

Improve simulation speed using Compile

I have two square matrices, a hermitian matrix h and an unitary matrix v. I am interested in the following function ...
0
votes
1answer
59 views

Creating Matrix,Inverted and Upper Triangulate inside Module

I was trying to fit this into a module but I didn't have any luck. And for some reason it won't Inverse the Matrix. Here's the code: Input: ...
81
votes
7answers
22k views

Elegant operations on matrix rows and columns

Question The Mathematica tutorial has a section 'Basic Matrix Operations', describing operations like transpose, inverse and determinant. These operations all work on entire matrices. I am missing a ...
-1
votes
1answer
59 views

Help needed with assignment [on hold]

Can I get some help with this: Write a module which as an input receives two matrices, the first matrix transforms in to the same matrix, but in the new matrix occur absolute values of the first, ...
6
votes
2answers
616 views

Sort matrix by columns and rows without changing them

I would like to sort a matrix in descending order first by the total of each column, then by the total of each row, but without changing their content. For example, if I had: ...
0
votes
0answers
50 views

Which method to use for finding maximum without actually computing optimization function explicitly?

I am new to Mathematica and I am currently working on an optimization problem. The optimization function that I have easy to calculate for some assignment of variable but it is very difficult to ...
-1
votes
1answer
60 views

Module whose input is a function of 2 variables [on hold]

I need to make a Module whose input is a function of 2 variables and 2 variables m,n so i can make a Matrix with Array. Basicaly, I need this: ...
-1
votes
0answers
30 views

Estimating fundamental matrix for stereo pair

I want to calculate fundamental matrix for stereo pair. Matlab has this function - estimateFundamentalMatrix. Is there an analog in Mathematica? If no how I can calculate it?
7
votes
1answer
256 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 ...
1
vote
2answers
70 views

Matrix with infinity on main diagonal

The question is trivial, however, there might be unexpected solutions. What would be nice way to create a square matrix with $\infty$ on main diagonal, and some arbitrary constant everywhere else? My ...
2
votes
2answers
208 views

How to make Mathematica show matrices and vectors nicely

It shows me like {{0}, {1}, {0}, {-1}} . Is it possible to make it look like a vector, always?
0
votes
1answer
74 views

Finite Field matrix rank calculation

How does one define a matrix over $\mathrm{GF}(p^r)$ in Mathematica in order to compute rank? I am working with $\mathrm{GF}(2)$?
3
votes
2answers
227 views

Binarizing a matrix

I have an image with a few bright pixels with the remaining ones very dark. The difference is in orders of magnitude. I want to binarize this matrix (corresponding to the image) making all values ...
-3
votes
0answers
39 views

Harris corner detection and plots [closed]

Could someone help me recreate these plots using Mathmatica. https://youtu.be/9-F5-gUIAWE?t=20m28s The are applying a hessian matrix to an image, and calculates the eigenvector.. And They then ...
5
votes
3answers
157 views

Constructing a grid from a matrix

I would like to construct a grid from a matrix. For example, one possible matrix is $M1$. $$M1= \begin{pmatrix} c2 & a1 & a1 & a1 & a1 & a1\\ a2 & b1 & c2 & a1 & ...
0
votes
0answers
51 views

Does Mathematica support Laguerre Polynomials of Matrix Argument?

I am wondering whether Mathematica can also compute the Laguerre polynomials of matrix argument as the appear in multivariate statistics? For example, they appear in this paper here: ...
0
votes
1answer
87 views

Extract coefficient matrix $A$ from expression $f(x)$

I have expression: $$f(x)=\sum_{i=0}^{K-1}\sum_{j=0}^{N-1}a_{i,j}e^{ix}x^j.$$ I want to extract coefficient matrix $A$ from expression $f(x)$ where $$A=\left( \begin{array}{ccccc} a_{0,0}& ...
0
votes
1answer
40 views

symbol matrix calulation

I have question about matrix calculation. like $\mathbf{b}^{t}\Sigma \mathbf{b}$, where $\Sigma$ is 7 by 7 matrix, and $\mathbf{b}$ is vector of 7. and each element in the vector b or $\Sigma$ is ...
0
votes
1answer
48 views

Symbolically solve system of equations involving matrix

I need to solve the following system of equations symbolically for a_i, b_i, and c_i: ...
14
votes
3answers
567 views

Why is calling Dot with many arguments so inefficient?

Say I want to multiply a reasonably large list of symbolic matrices. ...
8
votes
3answers
926 views

How to manipulate gauge theory in Mathematica?

I want to know if there is a way of typing into Mathematica an expression like the following, $$\epsilon^{\mu \nu \lambda} f^{abc} A^a_\mu A^b_\nu A^c_\lambda + g\epsilon^{\mu \nu \lambda} A^a_\mu ...
3
votes
1answer
107 views

$\mathbf L\mathbf D\mathbf L^\top$ Cholesky decomposition

Mathematica can do a Cholesky decomposition $\mathbf A = \mathbf L\mathbf L^\top$, but how do I do a LDL decomposition $\mathbf A = \mathbf L\mathbf D\mathbf L^\top$, with $\mathbf L$ being a unit ...
2
votes
0answers
54 views

Factor out a constant from a matrix

I've got a matrix in which every entry is of the form x/4. I cant find out how to factor out the 1/4 so that the actual matrix is clearer. Thanks for your help!
2
votes
1answer
49 views

Efficient Implementation of Resistance Distance for graphs?

Is there an implementation of the resistance distance matrix (or just resistance matrix) for graphs available in Mathematica?
0
votes
0answers
44 views

in the part assignment is not a symbol, create different matrices with a “Do” loop [duplicate]

Im trying to assemble new matrices from some previous matrices I have created, but I can´t. What Im trying to do is the following: 1) I have different matrices: ...
0
votes
1answer
53 views

Returning functions that are partly evaluated

I have some performance issues when calling Table[{h, Slow1[h, n]}, {n, nlist}, {h, 0.1, 10, 0.5}]; for a given list ...
1
vote
1answer
70 views

How to construct a kernel from a function?

I would like to convolve an image with a mathematical function. I understand that I need to have the mathematical function in a matrix form. How can I build it? Thanks
12
votes
1answer
233 views

Why does partitioning increase Dot execution speed?

I have noticed that multiplying a list of matrices can be significantly sped up by partitioning the list, calculating the product of the partitions matrices, and then multiplying the results. ...
3
votes
3answers
221 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 ...
0
votes
1answer
76 views

whats wrong when I use for loop for creating a matirx? [closed]

When I use separate value for "i" and "j", I get the correct desirable answer. ...
1
vote
1answer
326 views

Usage of Piecewise/RSolve to solve an equation based on condition

I am trying to compute price of call option on a stock using the finite difference method. I have a VBA code for it, and I am trying to find out how I can use Mathematica memoization functions and ...
0
votes
1answer
57 views

Symbolic matrix inversion

If I try to get an inverse of a matrix: a | b | c b | d | 0 c | 0 | 0 Inverse[{{a, b, c}, {b, d, 0}, {c, 0, 0}}] I get the answer: ...
21
votes
0answers
165 views

Does Mathematica store hidden information for matrix objects?

Bug introduced in 10.0.0 and persisting through 10.1.0 or later I found a case where calling one built-in function (HermitianMatrixQ) for a given matrix changes ...
0
votes
3answers
56 views

Simplifying Terms in a Matrix

Given the following 3 matrices: M1=1/3*{{1,1,1},{1,α,α^2},{1,α^2,α]}} Z1={{Z+Zg,Zg,Zg},{Zg,Z+Zg,Zg},{Zg,Zg,Z+Zg}} M2={{1,1,1},{1,α^2,α},{1,α,α^2}} where alpha ...
0
votes
2answers
25 views
-1
votes
1answer
48 views

Beginner Question: Assigning an indexed Variable to a given list

I am pretty new to the game and have a problem, which i am sitting on for hours. 1) I created a random Matrix 5x5 ...
4
votes
1answer
67 views

Speed up the auxiliary function magicSquare when $n$ is doubly-even

Today, I saw a question about magic square. Please see here When $n$ is doubly-even.Namely, Mod[n,4]==0 ...
1
vote
1answer
61 views

Divide each element of a list of 500 matrices by another matrix

Lets say that I have a Table of dimension (3,3,500) and I'd like to perform element-wise division by a 3x3 matrix along the third dimension (of length 500 in this case). What is the most elegant way ...
8
votes
3answers
647 views

The magic square function

There're some matrices that the sum of columns, sum of rows, and sum of diagonals are the same value. Here is an example: ...
1
vote
1answer
66 views

Assigning some results after a solve procedure to the coefficients of a matrix

I have a matrix M[3,3]. After a solve procedure, I obtained these results. {{M[1, 2] -> Cos[ψ[t]], M[1, 3] -> 0, M[2, 3] -> 0, Cos[θ[t]] -> M[3, 1], M[3, 2] -> 0, M[3, 3] -> 1, M[2, 1] -> ...
0
votes
0answers
32 views

Parametrizing a matrix given its trace and norm

I have a problem where I have to generate random matrices with the following properties: ($a$ is a given fixed number) $\mathrm{Tr}\, A=0$ $\mathrm{Tr}(A^\dagger A)=\|A\|_F^2=a$ I was wondering ...
4
votes
4answers
113 views

Express block matrix in terms of matrix basis

I'm trying to construct a function that returns the multiplication table of a matrix Lie algebra. Assuming a basis of matrices, my definitions: ...
-1
votes
1answer
89 views

Laplace equation

I tried to run this code, but it doesn't work for NDSolve ...