Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

0
votes
1answer
23 views

Large matrix: Finding eigenvalues and ordering it with respec to the highest coefficient of its eigenvectors

I have a 900x900 matrix to diagonalize. After diagonalizing it, I have a table of eigenvalues and eigenvectors. For convenience, I start with 3x3 matrix. ...
6
votes
5answers
560 views

Elegant method of generating this matrix?

Good evening, I need to determine an elegant (as possible) method of computing an $n\times n$ matrix below (the matrix shown is just a $16\times16$ example). I've been toying with ...
0
votes
1answer
19 views

Element-wise SeriesCoefficient for matrix [duplicate]

I have a matrix expression which, when expanding with the Series[] command, returns $$\left( \begin{array}{cc} 1-\frac{1}{2}t^2+\frac{1}{8}t^4-O[t^5] & t-\...
0
votes
1answer
64 views

Improve speed of Nested Matrix exponential

I have a short Code example and I want to know whether it is possible to improve the speed. The L matrix in my code is a SparseMatrix, but for this question I just use something similiar. ...
0
votes
0answers
33 views

Part command in a matrixform [duplicate]

I do have a MatrixForm a table which I would like to pick just a part of it. Is it possible to somehow command part[[]] for a <...
0
votes
1answer
44 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 ...
0
votes
1answer
61 views

why the result not contain imaginary, I? [on hold]

Good day, First of all, sorry if my coding in this forum has mistake. I already learned it and this is the best try from me. May anyone help me troubleshoot my problem below. ...
21
votes
6answers
4k views

Best way to create symmetric matrices

From time to time I need to generate symmetric matrices with relatively expensive cost of element evaluation. Most frequently these are Gram matrices where elements are $L_2$ dot products. Here are ...
0
votes
0answers
25 views

Get rid of infinty in matrix elements (by seperately defination of diagonal and off-diagonal elements)

I want to generate a matrix in which the elements have the below rule to be generated: ...
2
votes
3answers
166 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
vote
2answers
57 views
0
votes
1answer
41 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
votes
1answer
34 views

How to use Collect[…] with matrices? [closed]

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 [closed]

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
73 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
37 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
83 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
105 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
180 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
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
350 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
335 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
85 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
55 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
556 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
42 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 ...