Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

Filter by
Sorted by
Tagged with
0
votes
0answers
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 <...
0
votes
1answer
81 views

How to solve this equation with matrix rank condition

It is known that quadratic form $f\left(x_{1}, x_{2}\right)=x_{1}^{2}-4 x_{1} x_{2}+4 x_{2}^{2}$ can be transformed into quadratic form $g\left(y_{1}, y_{2}\right)=a y_{1}^{2}+4 x_{1} x_{2}+6 y_{2}^{2}...
2
votes
0answers
78 views

Integration that involves inverse of a big symbolic matrix

I have a $300\times300$ symbolic matrix and I want to calculate its inverse matrix. It has been two days and Mathematica is still executing Inverse[T]. $T$ is the name of that matrix. Why am I ...
3
votes
0answers
38 views

Does MMA have a built-in function or a user-defined function to judge whether the two matrices are congruent

It can be seen from the following relationship that matrix A and matrix B must be congruent matrices with each other: ...
3
votes
1answer
84 views

How to solve a Matrix of ODEs

Hey could you help me solving this matrix of linear ODEs. This exercise comes from the book "Transport Phenomena" by Byrd, Stewart and Lightfoot [23.D.4]. I managed to get this matrix of ...
5
votes
2answers
123 views

Finding the similarity transformation between two matrices

I have difficulty in finding the transformation matrix of two similar matrices. It is known that matrix $A=\left(\begin{array}{ccc} -2 & -2 & 1 \\ 2 & x & -2 \\ 0 & 0 & -2 \end{...
3
votes
2answers
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 ...
3
votes
1answer
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 ...
0
votes
1answer
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: ...
4
votes
2answers
118 views

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

I wrote the following code: ...
0
votes
1answer
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 ...
1
vote
1answer
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 ...
12
votes
4answers
742 views

How to rewrite a tensor as a matrix

I put {TensorProduct[{1, 0}, {0, 1}, {0, 1}, {0, 1}, {0, 1}]}/Sqrt[2]//MatrixForm and I got $$ \left( \begin{array}{cc} \left( \begin{array}{cc} \left( \begin{...
5
votes
1answer
138 views

Derivative of real antisymmetric matrix in mathematica

Is it possible to find the derivative of components of a real antisymmetric matrix using index notation? Eg: I have a very large real antisymmetric matrix. Then from Matrix Cookbook, we know the ...
4
votes
1answer
51 views

Need help to fill this matrix

I have a listo of 1000 numbers $\{x_0,x_1,\cdots,x_{999}\}$, I need to fill a matrix with these numbers. The matrix must have this form: $$\left( \begin{array}{cccc} x_{9} &x_8 &\cdots& ...
3
votes
2answers
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: ...
3
votes
1answer
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 ...
1
vote
1answer
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 ...
3
votes
2answers
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 ...
6
votes
3answers
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: ...
4
votes
5answers
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 ...
4
votes
2answers
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 ...
2
votes
3answers
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 ...
5
votes
2answers
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 ...
3
votes
3answers
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 . ...
1
vote
0answers
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 ...
4
votes
1answer
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 ...
7
votes
4answers
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 ...
2
votes
0answers
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 ...
3
votes
1answer
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: <...
1
vote
1answer
41 views

How a symbolic matrix can be Hermitian

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

Replacing a submatrix of a matrix

Minding the fact that In[102]:= {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}[[1 ;; 2, 1 ;; 2]] Out[102]= {{1, 2}, {4, 5}} is the upper left submatrix. I would like to do the ...
2
votes
2answers
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 ...
1
vote
0answers
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, ...
6
votes
3answers
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: ...
0
votes
0answers
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 ...
5
votes
4answers
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, ...
5
votes
1answer
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-...
2
votes
2answers
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 ...
1
vote
0answers
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 ...
2
votes
1answer
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 ...
2
votes
1answer
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 ...
1
vote
0answers
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. <...
2
votes
0answers
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 ...
4
votes
1answer
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 ...
3
votes
1answer
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_- & ...
0
votes
1answer
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. ...
1
vote
1answer
40 views

Unexpected data about function GraphDistanceMatrix

This is a weighted undirected graph generated from Excel table data. ...
2
votes
1answer
26 views

User defined function for creating Row only listing first column of matrix or first element of a vector

I cannot figure out why my rowNameValue[] is only listing the first part of a column or vector. Below is the code. ...
3
votes
2answers
210 views

Solving matrix equation for a matrix

Is there any way to define the matrix M that achieves the following equation? the two defined matrices are ...

1 2
3
4 5
54