Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

0
votes
1answer
24 views

How can I compute the difference in Y-axis values between data sets with similar X-values

I am new to Mathematica, so this might be a very basic question; however, I cannot find a solution to this and it is taking me very long. For my research I am probing the photoluminescence response ...
1
vote
2answers
126 views

Create a 900x900 matrix and diagonalize it

I have to create a 900x900 matrix and then diagonalize it. It is something similar to the below matrix. The value of a,b,c,d....up to 900 values (which are the first column and row) are the number. ...
-1
votes
1answer
30 views

How to use Collect[…] with matrices? [on hold]

I have a matrix function $T_4(t)$ which is evaluated as follows: $$\left( \begin{array}{cc} \frac{1}{48} \left(t^4-8 t^2+48\right) & \frac{1}{768} t \left(t \left(t \left(t^3-32 t+64\right)+256\...
0
votes
0answers
37 views

Mathematica Not finding Eigenvectors? [duplicate]

I have the following matrix: mat = {{-60., 0., 2.1*10^-35 II + 2.1*10^-35 (-1. II + Istar), 2.1*10^-35 II + 2.1*10^-35 (-1. II - 4.7619*10^6/Istar)}, {-6.4*10^22 II - 6.4*10^22 (-1. II - ...
0
votes
0answers
30 views

Show full output for a matrix in mathematica [on hold]

I have a very large rectangular matrix. It is an incidence matrix that I obtained from a bipartite graph data. I want to view the whole matrix. It only shows SparseArray[...] and specifies dimensions ...
1
vote
1answer
70 views

Tensors constructed using KroneckerDelta's - and/or displaying KroneckerDelta as a matrix

I am doing some work in elasticity and as a result am working with tensors. In particular, I would like to calculate the contraction of a fourth order tensor (the stiffness tensor) with a second order ...
0
votes
0answers
35 views

Optimization of the process of obtaining a global stiffness matrix

I created this code in a detailed manner so that i can understand. However it is not optimized. I think that may be a bit confusing. Anyone who is interested in analyzing and understanding my ...
-1
votes
0answers
55 views

Creating a Symbolic Singular Matrix

I am trying to differentiate an expression involving a matrix. When evaluating the input, Mathematica assumes the matrix is invertible, when it is not. How do I specify a symbolic singular matrix to ...
1
vote
1answer
82 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: ...
0
votes
0answers
53 views

Why is the Output of Mean and StandardDeviation an expression, and not a value? [closed]

I'm using Mathematica for the first time, and to practice, I want to manipulate a matrix of data. My problem is that when I use the Mean function on the matrix, or the StandardDeviation function, I ...
77
votes
3answers
3k 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 ...
1
vote
2answers
100 views

How to export an output matrix obtained in mathematica to a matrix in python with the correct format?

I have a large sparse matrix as the output and I want to save the output and open it as a matrix in python. The output is a 6000 x 6000 matrix and I don't know how to make changes to the file such ...
0
votes
2answers
57 views

How I can calculate product of series matrices

How I can calculate product of series matrices: A= Im...In. In-1 ...I1 which In = {{n,7n-2,3,2n-1},{3,4,n,6n-1},{9,3,n,n-3},{n-2,1,8,7n/3}} thanks!
1
vote
1answer
40 views

How do I plot the columns of an $M \times N$ matrix as separate lines on the same graph using ListLinePlot?

I have seen many examples that show how to plot several functions on the same graph using ListLinePlot is this manner: e.g. ...
5
votes
1answer
179 views

Find positions where two matrices differ

I have two matrices A and B of identical dimensions. What's the simplest (shortest) way to find the indices of differing ...
10
votes
3answers
341 views

How to extract the list of all matrices from a Block Diagonal Matrix?

I am working on a function to do the opposite operation of How to form a block-diagonal Matrix from a list of matrices? Here is my current algorithm: For i ...
0
votes
1answer
56 views

Why the Value of degree (cos and sine) not same when multiply [closed]

Good day, I have a problem regarding substitute the value in Cos and Sin function. Here the matrix, ...
0
votes
1answer
31 views

Iterating certain variables in a predefined function [closed]

I have a function which is dependent on a number of variables. I need to evaluate this function at the particular locations given by, ...
4
votes
2answers
185 views

Elementwise dot multiplication for lists of matrices

I have lists of matrices and want to do element-wise matrix multiplication. Is there an easy way to do this that I've missed? e.g: {A, B, C}.{X, Y, Z} = {A.X, B.Y, C.Z} where A, B, C, X, Y, and Z ...
8
votes
6answers
453 views

Assigning row of values to a lower triangular matrix

I want to assign a linear row of values to the elements of a lower triangular matrix, i.e., if the row of values is {1,2,3,4}, then the matrix (4 X 4) should be: ...
2
votes
2answers
349 views

Need an efficient method for finding certain matrices

I am trying to write a function which produces square matrices with certain characteristics. The function should have two inputs: number of the rows, n number of ...
0
votes
1answer
329 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)$?
4
votes
1answer
84 views

Subscripted (or superscripted) variables in Mathematica

When I first learned of Mathematica and started to use it, I soon discovered that Mathematica supported subscripted and superscripted variables such as $M_{i j}$. Naively, I first thought that I ...
1
vote
1answer
54 views

How to do matrix operation if the first matrix is an operator? [duplicate]

Suppose I have: mM = {{D[#, x]&, D[#, y]&}, {D[#, y]&, D[#, z]&}} v = {f[x, y, z], g[x, y, z]} I want to get $u=mMv=\{\frac{\partial f}{\partial ...
4
votes
1answer
58 views

Why am I losing precision in computation of eigenvectors of sparse matrices?

I compute the eigenvectors and eigenvalues of the same matrix in its dense and sparse version. The eigenvalues are the same to great precision, but the eigenvectors are not: when I compute the ...
4
votes
5answers
552 views

Creating overlapped block matrices

I'm doing an FEM assignment using Mathematica. (EK1 = {{a11, a12}, {a21, a22}}) // MatrixForm (EK2 = {{b22, b23}, {b32, b33}}) // MatrixForm I don't know how ...
0
votes
1answer
70 views

How to plot columns of a matrix as vectors

Related: How to plot vectors in Mathematica I am not interested in vector fields and field plots. I'd like to pass a $(2 \times n)$ or $(3 \times n)$ matrix into a function (or 2 different functions) ...
1
vote
1answer
128 views

How to generate a Wavelet Matrix?

The Wavelet Matrix, also called the Haar matrix, is very useful. We can find some useful information in MathWorld on how to generate it, but this document is too hard for me. From my reading of the ...
0
votes
0answers
19 views

Adding an external magnetic field to the Ising model Hamiltonian [migrated]

If I take the evolution of the Hamiltonian of the Ising model in terms of the Pauli operators, i.e. $\exp(-it(\sigma^z_i\otimes\sigma^z_j)/\hbar)$ where $\sigma_i$, $\sigma_j$ are the Pauli operators ...
2
votes
1answer
41 views

Diagonal part of product of matrices

I am trying to find the best way to compute only the diagonal part of a product of two (or three) matrices. I tried two different approaches: computing the standard matrix product and then extracting ...
1
vote
1answer
82 views

A question on JordanDecomposition in Mathematica

How can I have Mathematica show me also the inverse matrix of the similarity matrix of JordanDecomposition of a matrix? Obviously I need to use here the ...
2
votes
1answer
59 views

How to obtain a matrix from a certain expression? [duplicate]

I deal with structural problems where I have to obtain the stiffness or mass matrix from the kinetic and potential energy of the system. For example: ...
0
votes
2answers
57 views

Random Matrix with criteria

I want to construct $k$ lists $M$ of positions $(i,j)$ for a matrix $X$ of size $n\times m$, where all entries are "painted" with "white" color. The distribution of such a list $M$ must obey the ...
0
votes
1answer
30 views

Determination of coefficients matrix in one dimensional Kronig-Penney Model

In page 169 , Chapter 7, from book "Introduction to solid state physics (Eighth Edition)" by Kittel, there are 4 equations as below. Without need to any additional physics information I just want to ...
7
votes
2answers
3k views

How do I keep the right ordering of eigenvalues using Eigensystem?

I'm having an issue with the Eigensystem command. I need to diagonalize a bunch of 3 by 3 complex valued matrices, but more importantly, I need to keep the exact ...
0
votes
0answers
49 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 ...
3
votes
0answers
41 views

Sparse matrix multiplication mod p

Let A and B be sparse matrices with integer coefficients between 0 and ...
1
vote
1answer
67 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
109 views

How to remove parts of an expression [closed]

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
91 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, ...
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 ...
2
votes
1answer
301 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
120 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
268 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
309 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
1answer
50 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
101 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
44 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.