# Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

2,682 questions
Filter by
Sorted by
Tagged with
60 views

### How to deal with this problem of abstract matrix

First question: Let A and B be n-order square matrices, and r(X) denote the rank of matrix <...
81 views

151 views

### How to find the eigenvalues of the abstract matrix satisfying the condition

It is known that $E$ is a third-order identity matrix and $A$ is a third-order real symmetric matrix. Matrix $A$ satisfies the condition of $A^{2}+A=2 E$. How to find the eigenvalue of this abstract ...
126 views

### Fast approach to do Summation in Compile[]?

My code does massive Summation and Matrix multiplication Compile[] has boosted it distinctly. But I read some literatures related to my program, It seems there are ...
125 views

### How can I obtain the matrices of coefficients of quadratic form?

I'm trying to find the matrices of coefficients of a quadratic form: ...
118 views

### 4X4 matrix of distinct cubed integers with identical row and column sums

I wrote the following code: ...
93 views

### How o use singular value decomposition function to find the natural frequency and mode shapes

I have a matrix R which is having a dependency on ω, I am interested in finding the natural frequency and mode shapes of this matrix using SVD how to do this?. The regular way is to take the ...
94 views

### Comparing and Modifying two Matrices (list of list)

I need to compare two matrices with the same number of columns but a different number of rows (please see an example of Matrices A and B). I would like to know how I can compare the second column of ...
742 views

228 views

### How can I dynamically allocate a matrix?

I am trying to allocate the following matrix in Mathematica. It has 1s where i=j, -1/2 in i-1,j and i+1,j. This is the code I am using to try to achieve this: ...
54 views

### Use of a function inside of a table

I have a function that I want to generate a square matrix whose entries are run from 1,...,n and whose i,jth entry is f(i,j) for some function f. My code that I have right now is ...
44 views

### Find the condition under which an inequality holds

I've got an inequality of 8 non-negative parameters (arising from a 5x5 matrix) and would like to find a condition under which my inequality holds. The condition would be an inequality too of these ...
38 views

### How to use ReplaceAll iteratively over a list of lists?

I want to build a matrix J for each of the solutions of an equation. And each solution is also a set of 3 variables (x,y,z). In ...
156 views

### Verify an inequality of many parameters

I've got an inequality of 10 non-negative parameters (arising from a 5x5 matrix) and would like to verify whether it holds. I tried the following, which doesn't seem to work: ...
363 views

### How to form a diagonal matrix from sub-matrices?

I have a 3x3 matrix (let's say G) and a 3x3 matrix of zeros (let's say zero). I want a diagonal matrix in the form Diag[G; G; G; zero] such that the size of matrix becomes 12x12. I actually have to ...
85 views

### Building a matrix from the columns of others

A is a n x m matrix, B is a matrix p x m, I wish to build C from appending the ith column of A and ith column of B, for all i ...
123 views

### How to create a matrix with specific element subscripts and input subscripts into function as arguments

I'd like to create a matrix with specific elements subscripts. Matrix is like below. This matrix is sized at M*M and subscripts are indexed by ...
260 views

### Basic questions on matrix multiplication [duplicate]

I'd like to implemente a matrix multiplication among three matrices sized at 1*256, 256*256 and ...
124 views

### Find rules for the similar “Conway's Game of Life”, and initial input on an 11x11 torus board. Descripted on the “Puzzel Chalenge IBM May”2020"

I solved on May 2020 this using mma . I am aware of this command - Cellular automata. But I can't use it on this challenge, because there's no concept of "Torus" in the CellularAutomaton . ...
59 views

### creating uppertriangularized matrix [closed]

I am trying to create an uppertriangularized matrix of arbitrary size,max of the form {{1,2,3,4,5},{0,1,2,3,4},{0,0,1,2,3},{0,0,0,1,2},{0,0,0,0,1}} using the code ...
94 views

### How to get the class of neighbors in a 2D periodic matrix?

I'm trying to analyze the spatial structure of some rectangular arrays by counting the number and class/type of neighboring points around every point in the arrays, with periodic boundaries. For ...
385 views

### Correcting the Color Scale of a MatrixPlot

I did a MatrixPlot of a set of values that range between 0 and 1. I got the following first plot with no problems: As we can see from the legend, the values range between 0 and 1. Now, I am doing ...
63 views

### Matrix integration just spits out the inputs

I just started to use Mathematica two days ago. I am trying to solve a stiffness (K) matrix of a 4-node is-parametric truss element for my exam on next Monday. The integrand is a 4 by 4 matrix with ...
40 views

### How does one control the output format of Eigenvectors[]?

Given the matrix: m = {{Cos[x], Sin[x]}, {Sin[x], -Cos[x]}} Calculating the eigenvectors: Eigenvectors[m] gives the result: <...
41 views

### How a symbolic matrix can be Hermitian

How can I learn Mathematica that the ham matrix with symbolic elements is Hermitian? ...
39 views

### Replacing a submatrix of a matrix

Minding the fact that In:= {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}[[1 ;; 2, 1 ;; 2]] Out= {{1, 2}, {4, 5}} is the upper left submatrix. I would like to do the ...
113 views

### How to program a situation like the following in mathematics and generalize the process to other configurations?

Distribute the numbers from 1 to 10(view image) so that the sum of each row and each column is the same and a) the maximum possible b) the minimum possible (I put it from 1 to 10 for ease) I know it ...
58 views

### Display detail of a function [closed]

I wrote a function to create and allow loading of a ll x ll upper triangular matrix and would like to see it in detail, matrix elements displayed. Specifically, ...
117 views

### How to get elements corresponding to UpperTriangularize

For a generally non-square matrix M, I want the upper triangle that include the diagonal entries. Specifically, this is implemented via UpperTriangularize: ...
63 views

### Is it possible to implement this Matlab code for the normal form of a bipartite operator in Mathematica?

I am interested in converting the $16 \times 16$ ("density") matrix ...
225 views

### Create special Matrix in mathematica

I want to generate the following matrix for any n: Table[A[i, j], {i, 0, n}, {j, 0, n}]; Where, ...
72 views

### Split Expression Into Constant And Non-Constant Summands

I have a partially t-dependent matrix which I want to split into its t-dependent and its t-...
56 views

### Applying a function when using ReplaceAll

For example, I have a list m={{1,-1,3},{-2,1,-3},{-2,3,3}} and a function f[x_]=-x^2. What I want to do is to apply ...
46 views

### Creating a function to implement the Jacobi method [closed]

Suppose A is a 50 x 50 tridiagonal matrix with entries ai,i = 0.5 on the diagonal, ai,i-1 = ai,i+1 = 0.25 on the super diagonal and sub diagonal and zeros elsewhere. Take b to have i-th entry equal to ...
71 views

### Best way to work with Tensor Networks

I have to write a script in which I have to work with a very simple tensor network but I can't find a nice scalable way to make this work. The basic object I am working with is a tensor more or less ...
50 views

### How to grab two points from linear equations and from a matrix m.x == b for the purpose of creating lines or planes from each row.?

Don't get me wrong I can easily do it on paper and I could probably write convoluted code that will get the job done but I feel like there has to be an easy Mathematica way to do this. A few users on ...
34 views

### Export Large Sparse Matrix As .mtx File

I'm trying to export a large sparse matrix of dimension 1164960 by 1164960 with 17815680 elements as an .mtx file so I can import it into Python. I first the run the following code successfully. <...
39 views

### How to calculate the numerical integration of the product of two entries of an exponential matrix? [closed]

Lets define a $6\times6$ matrix $M(t)$ with entries $m_{ij}$ as ...
184 views

### Finding all Magic Squares of order n

I think there is exactly one magic square of order 3 (though I could be wrong about that). When I run this, it does not come up with any solutions. Can you help? The following code is meant to ...
73 views

### If I have the eigenvalues, can I find the corresponding eigenvectors?

The eigenvectors ($\psi _i$) of the following matrix are rather complicated  \rho =\left( \begin{array}{cccc} G_+ & k & k & G_- \\ k & L_+ & L_- & k \\ k & L_- & ...
48 views

### Nonrectangular Tensor Encountered error with rectangular matrices

I have two matrices which are rectangular. This code works with other applications I have but not this one. ...
40 views

### Unexpected data about function GraphDistanceMatrix

This is a weighted undirected graph generated from Excel table data. ...