Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

Filter by
Sorted by
Tagged with
0
votes
0answers
25 views

Problem with Table with some conditions

Please see my code, I have a problem with the Table function because F6, Phi7, and Gamma6 must be added in the calculation but in the result, I want the result ...
0
votes
0answers
55 views

How can I show the calculation of the determinant of a matrix step by step? [duplicate]

I would like to emulate what Wolfram Alpha does in Mathematica. Can you help me? ...
0
votes
1answer
45 views

Symbolic Real Positive Definite Matrix

I'd like to define a symbolic real positive definite matrix. For the 2 x 2 example, I thought I could define four real variables using ...
3
votes
0answers
92 views
+250

Prove $R^\top R = I_3$ and find skew-symmetric matrix $R^\top \dot R$

Consider the following operator defined over unit vectors of $\mathbb{R}^3$: $$R(u,v) = (u\cdot v)I_3 + hat(u\times v) + \dfrac{(u\times v)\otimes (u\times v)}{1+u\cdot v}$$ ...
5
votes
2answers
73 views

Take coefficients of the variable from a Matrix

I have a question how can I take coefficients of the variable from a matrix? for example; I have a matrix such as: A={{2a,3b,4c},{4d},{1a,1e}} variable is {a,b,c,d,...
1
vote
0answers
62 views

Compute the Hessian matrix of a function [duplicate]

To compute the gradient of a function, it can be made with matematica using Grad[f[x,y],{x,y}] Suprisingly, it's not possible to compute the Hessian matrix (something as HessianMatrix[f[x,y],{x,y}], ...
0
votes
1answer
71 views

Problem with the Table function when adding together

I am a newbie, I have a problem with Table. Can anyone explain to me understand? For example, I did the expression Qk1, ...
0
votes
0answers
34 views

Can Mathematica solve matrix-based parametric (convex or semidefinite) constrained optimization problems?

I have gone through Mathematica's documentation and guides on ConvexOptimization, ParametricConvexOptimization and SemidefiniteOptimization. I am also running the latest version of Mathematica. The ...
2
votes
1answer
76 views

Multiply lists: element-wise but matrix-like in the last 2 levels

How can I do the following computation more efficiently? We have nested lists and want to multiply element-wise, where the 'element' is the deepest 2 levels treated like normal matrix multiplication. ...
1
vote
0answers
49 views

Inserting new Table/Matrix dialog in 12.2 does not work

After upgrading to 12.2 on a Linux machine, Insert->Table/Matrix->New is without any effect, i.e. the popup dialog just disappears and no table a/o matrix is inserted. Any idea or help would be ...
6
votes
2answers
134 views

How to extract a column (or a row) of a matrix as another column vector/ column matrix (or a row vector), not as a list?

Suppose I have a matrix 'mat' as mat = Table[Subscript[m, i, j], {i, 5}, {j, 5}]; mat // MatrixForm I want to extract the first column (or any row) as ...
5
votes
2answers
106 views

Position of n largest elements in each row in a matrix that satisfies certain criterion

Suppose I have a matrix m={{1,2,3},{3,-2,1/3}}; I want to find the positions of, for example, 2 largest elements in each row that is above 1/2. So, in m, 2 and 3 ...
6
votes
1answer
155 views

How to turn off the large output suppression

I am currently calculating some large matrix operations. The calculation results in some huge size matrices, and the output is sometimes suppressed as this However, I really don't want it to be shown ...
0
votes
0answers
22 views

Why summation of matrices in the MatrixForm gives wrong result? (an example is given) [duplicate]

I want to calculate the sum of two matrices, doing that in MatrixForm, I get which is wrong, but writing them as ...
-1
votes
1answer
55 views

Cannot find nilpotent elements for Tessarines [closed]

Entering the following system returns only a trivial solution (zero): ...
0
votes
1answer
66 views

How to write matrix elements in Mathematica? [closed]

For a matrix $A$, one computes the $ij$-$th$ matrix elements in a basis $\{|e_i\rangle\}$ as $$A_{ij} = \langle e_i|A|e_j\rangle$$ How can one implement this in Mathematica? As an example, consider a ...
4
votes
1answer
109 views

Trouble iterating my forest fire simulation

I'm having some trouble iterating my simulation of a forest fire. I'm new to Mathematica, so apologies for poor coding. I'm sure there are far neater and more efficient ways of doing this, but I would ...
0
votes
0answers
70 views

Function to determine number of trees surviving forest fire [duplicate]

How can I write two functions, each of which have as their argument an array mat of 0s (no trees), 1s (trees), 2s (burning trees), that can determine the trees that survived a forest fire, which run ...
8
votes
3answers
371 views

Periodic von Neumann neighbours

From Carl Woll's answer here, I have this code for pulling the von Neumann neighbors: ...
2
votes
2answers
108 views

Implementing a formula from a paper

Is this:Table[Exp[-((1250^2) dism11[[n, m]])/Sum[dism11[[i, j]], {i, n, 1250}, {j, m, 1250}]], {n, 1, 1250}, {m,1, 1250}] a correct way to implement: I am kinda ...
6
votes
2answers
209 views

Function to create random matrix, then a simulation. *EDIT* Create two functions

How can I write a function with parameters b, i, and j, which would return a i x j array of 0s, 1s, and 2s, but the array needs to be populated randomly with 0s and 1s which have respective ...
1
vote
2answers
120 views

Exploring Matrix Powers with Wolfram (using Sum Notation)

I am trying to gain an intuition for what algebraically happens to a square matrix (say a $2$-dimensional square matrix) when it is successively multiplied by itself. I have used ...
1
vote
0answers
71 views

Showing $e^{(α Ω)} e^{(β Ω)} = e^{((α + β) Ω)}$ with Wolfram Technology [closed]

Context. I am currently reading a Quantum Mechanics book in which it is stated that it is "obvious" (without proof) that $$ e^{(α Ω)} e^{(β Ω)} = e^{((α + β) Ω)} $$ where $\alpha, \beta \in \...
0
votes
1answer
41 views

How to aggregate rows/columns of a matrix by keeping row/column headings

The following code works for matrices without row/column headings and I like to carry out the aggregation of the selected rows and columns by keeping row/column ...
2
votes
1answer
24 views

How to remove zero columns/rows from a matrix while keeping row/column headings

The following code (by @kglr) correctly works if mat1 does not have any row/column headings. However, I am working with a matrix ...
0
votes
4answers
61 views

How to create special matrices of the following forms

How can I create: Matrix 1: Matrix2: Matrix 3:
4
votes
1answer
130 views

How to create a group of equations?

To solve all the a[i,j] & b[i,j] through Mathematica,I need to create a group of equations.The m & n are arbitrary.And for all the 0<=i<=m & 0<=j<=n,the equations should be ...
3
votes
1answer
163 views

Square root of a 2 by 2 matrix using MatrixPower[]

According to Wikipedia a square root of a 2×2 matrix M is another 2×2 matrix R such that M = R^2. In general, there can be zero, two, four, or even an infinitude of square-root matrices. I tried to ...
0
votes
0answers
53 views

Can I apply functions to infinite matrices or linear operators in Mathematica?

I do not know how can I apply functions to infinite matrices or linear operators. For instance, having the derivative operator, what is its sine? For instance, for finite derivative operator we have $$...
1
vote
0answers
50 views

How to let Mathematica evaluate a large amount of data

I have the following code in mathematica which runs perfectly for a small matrix of 21 x 12 matrix. But I really want to test it for a large system. My data is 35844 x 21000 elements, totaling 1.5 GB. ...
2
votes
1answer
25 views
4
votes
3answers
157 views

Constructing adjacency matrix based on a given range of numbers

Given ...
4
votes
2answers
149 views

Adding one row and column to a matrix

RotationMatrix[θ, {0, 0, 1}] // Matrixform gives $\begin{pmatrix} \cos (\theta ) & -\sin (\theta ) & 0 \\ \sin (\theta ) & \cos (\theta ) & 0 \\ 0 &...
4
votes
3answers
158 views

Identifying rows and columns of a matrix that satisfy a specific feature

Originally, I have a matrix of dimension (1040, 1040). This a very large matrix to visually inspect some features. I mimic the matrix of concern as: ...
1
vote
1answer
31 views

Specifying the position of the bottom element in a matrix when the last few elements are missing

Suppose I have a matrix (nested list) with some missing elements in the bottom region: m={{1,5},{2,6},{3},{4}}; m//TableForm 1 5 2 6 3 4 As you see, ...
0
votes
1answer
55 views

Regression of a set of (2-element) vectors on another set of (2-element) vectors

As a trivial example, here are two vectors: f = {{1, 1}, {2, 2}, {3, 3}, {4, 4}} s = {{-1, 2}, {-2, 4}, {-3, 6}, {-4, 8}} It is instantly clear (apart from my ...
2
votes
0answers
30 views

finding a transpose matrix [duplicate]

sample = MatrixForm[ RandomVariate[NormalDistribution[0, 1.2], {3, 2, 2}]] Tranp = Transpose[MatrixForm[sample]] This is my attempt to find the transpose of ...
4
votes
3answers
263 views

Function representing a forest fire after one time step

How can I create a function that would have as its argument an array mat of 0s, 1s, and 2s where the 2s are burning trees and the function would give an array that represents the forest after one time ...
0
votes
0answers
47 views

Equations with Tensor product and Ket in Mathematica:

I tried to express this equation in Mathematica: I defined necessary things: ...
3
votes
5answers
76 views

I want to Prepend the Row Number of the Matrix to all Elements within that row

I have a matrix of nested lists that looks like this: ...
4
votes
1answer
138 views

How can I direct sum matrices into the middle of one another another?

I would like to execute the mathematical operation of the direct sum of matrices in the case where the matrices are not appended one after the other along the diagonal, but instead mixed among one ...
0
votes
1answer
47 views

How I can find the eigenvalues and eigenvectors of 500 matrices with 3x3 dimensions? [closed]

I can apply the Eigensystem command to a single matrix and it worked fine. But it takes me too much time. I want to get the eigenvalues and eigenvectors of multiple 3x3 matrices at the same time. ...
1
vote
0answers
46 views

SchurDecomposition returns matrices which are not a Schur decomposition [closed]

A Schur decomposition is a decomposition $M = Q T Q^\dagger$ where $Q$ is unitary, and $T$ upper triangular. It is implemented in Mathematica by ...
0
votes
0answers
39 views

Converting Tensor product to Matrix

I have a basic question regarding matrices and tensor product forms. Given $N > 0$, I am interested in the tensor product series $\sum_{i}^{N} X_i$, where $X_i$ is the Pauli $X$ spin operator at ...
1
vote
2answers
93 views

'Do' loop acting on a global variable

I need a code that will allow me to alter a matrix (a global variable) iteratively using a function update (which depends on ...
5
votes
1answer
113 views

ReplacePart to substitute a row in a Matrix

I have a very large n x n matrix from which I want to take a row i from and substitute every element with 0. When I try the below command however, the ith row is not replaced by a list of n zeros but ...
3
votes
2answers
140 views

Replacing a random ith row and column from a matrix

Currently I am trying to delete a randomly-chosen $i^{th}$ row and column from a square $n \times n$ matrix $A$. So far I come up with the following code: ...
2
votes
3answers
30 views

Repeated ReplacePart On Each Element of a Square Matrix for Eigenvalue Difference

I have a large $n\times n$ square matrix, whose elements are all either 0 or 1. I want to see by how much the single largest eigenvalue of the matrix (which Mathematica gives as the first element in ...
3
votes
2answers
287 views

Speedup calculation of the largest eigenvalue and eigenvector of a 400×400 matrix? [duplicate]

Actually, the matrix is an adjacency matrix of a network. The code is: ...
1
vote
1answer
75 views

How to get Mathematica to return more accurate symbolic eigenvectors

This code: Eigenvectors[{{Cos[t], Sin[t]}, {Sin[t], -Cos[t]}}] returns this output: ...

1
2 3 4 5
56