Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

1
vote
1answer
58 views

How to do abstract matrix operation?

In this simple example, I have 2 lists, each of which contains 3 matrices。 $J$ here is also a matrix with the same dimension. What I want is $aJc+bJ(b+c)$, but if I use dot product, the result is as ...
1
vote
1answer
107 views

How to remove parts of an expression [on hold]

I have an expression where terms Transpose[R].R appear. R is a matrix with the property Transpose[R].R=IdentityMatrix[3]. How ...
2
votes
1answer
86 views

Python Convolve2D functionality in Mathematica

I am new to mathematica. I am looking for an alternative for scipy.signal.convolve2d. I did find functions like ListConvolve, ...
0
votes
0answers
38 views

Expectation of summation with symbolic indices

I am working on symbolic computations with mathematica. I faced an issue with taking expectation of a large expression involving summations with symbolic indices. Is it possible to take expectation ...
34
votes
4answers
5k views

Fastest way to calculate matrix of pairwise distances

It is a very common problem that given a distance function $d(p_1,p_2)$ and a set of points pts, we need to construct a matrix ...
0
votes
0answers
52 views

Eigenenergies of a symmetric tridiagonal matrix [on hold]

we consider the time independent Schrodinger equation (TISH) where we want to calculate the first few instantaneous eigenergies. Discretizing space we get : So we can rewrite the TISH as, (where ...
2
votes
1answer
299 views

Numerical comparisons of matrices

I have a matrix which should be equal to a null matrix. However due to the numerical precision, a brutal equality test with a matrix initialized with zeros does not work. How should I perform the ...
8
votes
3answers
329 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 ...
1
vote
1answer
115 views

The new introduced EulerMatrix problem

In the present version of Mathematica, there is a new command EulerMatrix[{α, β, γ}])// MatrixForm I read its document and I still don't understand it. For me, ...
1
vote
2answers
261 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$ ...
3
votes
3answers
308 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
0answers
34 views

Transform an expression into a function [on hold]

I have a matrix of the form Mat = {{2a, 7a},{5a, 3a},{a, 2a}} (the actual matrix is a hugely complicated one of size 64x64, but the idea is exactly the same). I ...
0
votes
1answer
42 views

How to make the conjugate transpose

I have a problem to make the conjugate and transpose the matrix.May anyone help me please. ...
0
votes
2answers
93 views

How to generate a Markov Matrix efficiently

A Markov Matrix is a square matrix,which have two features: All elements great than or equal to $0$(But I hope all element great than or equal to $0.1$) All the columns add up to $1$ I have a ...
1
vote
0answers
42 views

Remove columns basing on binary sequence

Possibly it is duplicate, still I could not find here elegant way to remove matrix columns basing on binary sequence. i.e. if I apply {1,1,0,0,1,0,1} to matrix it should delete columns 3,4 and 6.
2
votes
0answers
64 views

Aguilera-Perez Algorithm of $nD$ rotation matrix [on hold]

I want to compute a general $nD$ rotation matrix which corresponds to a rotation by an angle $\theta$ around an $(n−2)$-dimensional subspace. I found the Aguilera-Perez algorithm in their paper: ...
4
votes
3answers
98 views

Expanding a matrix in a set of matrices

Consider a vector $a=\{a1,a2,a3\}$. I computed $e^{i a\cdot \sigma}\qquad \sigma: {\rm Pauli\ matrices}$ and then applied the command ExpToTrig. Now I want to expand the above result in terms of ...
0
votes
1answer
40 views

Probems using 2 For and a AppendTo to cycle through my Equation to solve some matrixes

I am trying to solve a few problems here. I have an equation with multiple variables that I am trying to solve in For loop method. I will attach the file below. In addition I am trying to get it to ...
3
votes
3answers
103 views

how to update elements in a matrix with position identified in a list

I am new to mathematica. Could you pls help me on how to write this: I have a $5\times 10$ matrix, for example, ap = ConstantArray[0.001, {5, 10}] I have the ...
0
votes
1answer
20 views

How can we assign value given by Eigenvalue command to variables? [closed]

I want to assign value of eigen value given by eigenvalue command in mathematica to variables so I can use further in programme.
3
votes
1answer
79 views

How to define the following matrix

How to define the following matrix in Mathematica? $$A(n) = \begin{pmatrix} B_{1} & B_{2} & \cdots & B_{n} & 1 \\ B_{n} & B_{1} & \cdots & B_{n-1} &1 \\ \...
0
votes
1answer
61 views

How to code the partial trace of a matrix

I want to compute a partial trace using formula $\rho_A=\sum\langle B|\rho_{AB}|B\rangle$ . Example, $\rho_{AB}= $$ \begin{pmatrix} a & b & c & d\\ e & f & g & h\\ i &...
1
vote
1answer
56 views

Kronecker product

I have a problem, I want to compute kronecker product as given below; ...
0
votes
0answers
49 views

How to automate a computation and save the outputs?

I'm working with neutrino oscillations in matter and i'm computing the oscillation probabilities as functions of the Energy. This is what i have ...
1
vote
1answer
57 views

Dynamic input for Complex, Determinant output problems [duplicate]

I'm having trouble using Complex with Dynamic real and imaginary inputs. The inputs come from a matrix of popup menus: ...
1
vote
2answers
93 views

Group matrix values by column [closed]

Original Question: I have a list {{a, 1}, {b, 3}, {c, 1}, {d, 2}, {e, 3}}. I want to be able to group the the first number in each pair that has the same second ...
0
votes
1answer
62 views

Plotting Matrix versus Matrix [closed]

So I recently started using Mathematica and I haven't been able to figure out how to simply plot elements of one matrix versus another matrix which are not directly related or are not a function of ...
0
votes
2answers
393 views

Nonlinear matrix equation solving in Mathematica

is it possible to solve below equation in Mathematica? A.X+B.Exp[X]==C A, B are square ...
2
votes
1answer
60 views

Antrisymmetrized product of matrices

Let $X_{1},...,X_{N}$ be $N$ matrices. I want to compute an antisymmetrized product of $X_{i}$'s in mathematica: $X_{[a_{1}...a_{N}]} \equiv \tfrac{1}{N!}\sum_{\sigma}(-1)^{P}X_{\sigma(a_{1})}X_{\...
1
vote
1answer
59 views

Matrix equations solving

can you explain me the easiest way for solving this matrix equation? I have this matrix: a={{-4,1,3,0},{-2,7,1,-1},{1,-1,9,-3},{-1,0,5,-10} and the Equation is: ...
3
votes
1answer
100 views

Efficiently compute this Table of NullSpace

I have two $(2n,2n)$ matrices, $A_1$ and $A_2$, and I would like to compute $$\ker(A_1^p A_2^q -I)$$ for $p,q\leq 2n$. Both matrices are orthogonal and have exactly four non-zeros values on each ...
2
votes
5answers
193 views

Finding the most common n-tuples of a list of lists where order does not matter

I am still learning to use Mathematica and I need some help. How could I get the most common pair, and generally the most common n-tuple of a list (row vector) given a list of lists of ...
9
votes
4answers
5k views

Matrix Multiplication in context of row and column vectors

I've been looking at some matrices in Mathematica and I've noticed something very weird: They're extremely temperamental when it comes to dot products! For example, if I have the following, ...
2
votes
1answer
149 views

How to sort eigenvalues?

I am trying to find Eigenvalues to a 12x12 Matrix ($H$) dependent on two variables $x$ and $y$. Later I want to do a 3D plot of one eigenvalue ($E$) over $x$ and $y$. An analytical solution is not ...
1
vote
2answers
225 views

MatrixPower performs slower than Do loop

I have two almost identical pieces of code: one with MatrixPower responsible for matrix multiplication and another with Do loop. Why the latter performs much faster? It looks counterintuitive... <...
26
votes
5answers
965 views

Can (compiled) matrix permanent evaluation be further sped-up?

Update III  Mathematica 10.2.0 now ships with a predefined System`Permanent function, which the PermanentCode package ...
5
votes
1answer
2k views

How to obtain the orthogonal matrix that diagonalize a symmetric matrix [closed]

I have a real symmetric matrix H which is in symbolic form, I need a matrix P that can diagonalize H; also P is orthogonal and its columns are the eigenvectors of H. How can I doing this in ...
1
vote
2answers
91 views

Output the tensor product of two matrix as a matrix

How do I output the matrix form like the RHS without the tensor product sign remaining $\otimes$? I need it for display purpose where I can see easily what the form of the whole product matrix is.
0
votes
1answer
55 views

How to generate a random matrix and its average value is a specified value

I want to generate a random matrix whose average value is a specified value,such as 5.5. I found these function here.But I don't know how to use it to do this.I think ...
0
votes
1answer
321 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)$?
0
votes
1answer
67 views

How to map data from one set to another set

I have a set of numbers that has a non-injective, surjective correspondence to another set of numbers and I would like to quickly create a list of the output. For example, suppose I have ...
-1
votes
2answers
52 views

Rearranging the columns of a matrix [duplicate]

How do I rearrange the columns of a matrix? I really have o idea how to do this. Thankfs for any suggestions!
0
votes
1answer
50 views

How can we do LDU decomposition modulo $p$?

If we have an $n \times n$ matrix, with all entries taken modulo $p$, how can we output the three matrixes in LDU decomposition, with all entries again modulo $p$? We can assume the input matrix is ...
2
votes
0answers
27 views

Using Arnoldi Method with Multiple Options

I have a matrix with many complex eigenvalues, but I only need a few near a particular complex number. I am only looking at the imaginary parts, so I need the few closest on the imaginary scale to my ...
8
votes
2answers
304 views

Why is IdentityMatrix not defined as a SparseArray by default?

Simple (possibly silly) question: why are IdentityMatrix, DiagonalMatrix, ConstantArray ...
3
votes
1answer
47 views

Use of Inverse Matrix

I solved a matrix as follows: {{0,1,1},{0,2,4},{0,3,9}}.{{0},{25},{20}} Resulting: {{45},{130},{255}} I tried to use an ...
1
vote
1answer
43 views

Solve matrix equation for matrix

Is there any function like Solve but designed to deal with matrix equations? Something like: ...
3
votes
1answer
94 views

Irreducible representations for the symmetry group $T_d$

I am trying to get the explicit two dimensional irreducible representation matrices for the symmetry group $T_d$. I need the matrix representation for each element in the group. Are there any ...
1
vote
1answer
69 views

generating random algebraic matrix using elementary operations

I generate several algebraic matrices of 12x12 where each element is a combination no repeat of the variables x, y, z and operations +, -, *, /, power, establishment (square root), any of them or any ...
-1
votes
1answer
56 views

How to solve trigonometric matrix

I need help for my problem according to matrix. Given a matrix, ...