Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

0
votes
1answer
12 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
125 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. ...
0
votes
0answers
27 views
-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
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 ...
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
34 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
68 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
53 views

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

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 ...
1
vote
1answer
39 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. ...
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
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, ...
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
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!
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 ...
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 ...
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
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 ...
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 ...
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) ...
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
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 ...
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
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 ...
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 ...
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 ...
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, ...
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, ...
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. ...
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.
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
68 views

Aguilera-Perez Algorithm of $nD$ rotation matrix [closed]

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
106 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 ...
3
votes
3answers
105 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 ...
3
votes
1answer
83 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
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 ...
0
votes
1answer
69 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
66 views

Kronecker product

I have a problem, I want to compute kronecker product as given below; ...
0
votes
0answers
50 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
60 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: ...
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 ...
2
votes
1answer
61 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
2answers
95 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 ...
3
votes
1answer
102 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
194 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 ...
1
vote
2answers
228 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... <...
2
votes
1answer
155 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 ...