Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

2
votes
0answers
43 views

How to calculate a projection of x,y,z data to x any y plane?

I have a List containing x,y,z data, which I can plot nicely in a ListContourPlot: ...
1
vote
1answer
60 views

How do I extract the matrix from an density matrix equation?

I have a density matrix equation and I wish to put it in the form of a matrix. For example, if I have: $$\rho =Ax_{1}x_{1}+Bx_{1}x_{2}+Cx_{2}x_{1}+Dx_{2}x_{2}$$ Copy-and-paste version ...
0
votes
1answer
43 views

Matrix definition using some rules for the elements

I'm gonna produce a matrix in which the matrix elements obey the following rules $\left<n \right|M \left| m \right> = m^2 \delta_{m,n},$ $\left<m \pm 2 \right|M \left| m \right> = (1-m) ...
1
vote
1answer
54 views

Why doesn't the matrix rank decrease in this case?

Consider the square matrix $M(k)$ of dimension 6 $ M(k) = \frac{1}{\sqrt{2}}\begin{bmatrix} 0 & 0 & 1 & i & 0 & 0\\ 0 & 0 & 0 & 0 & ie^{-ik} & e^{-ik} \\ 0 &...
5
votes
4answers
379 views

Looking for a simple way to manipulate one column of a matrix

Given {{a, b}, {c, d}} I want to get {{c, b}, {a, d}} with one simple expression. Is this possible?
1
vote
2answers
80 views

Selecting matrices based on existence of unique column and row of all equal terms

So, I have a list of lists of lists such as the following: {{{4}}, {{7, 7}, {7, 7}}, {{5, 5}, {6, 6}}, {{2, 1}, {1, 1}}} Interpreting the elements of this list ...
0
votes
0answers
25 views

Relation between matrices

Maybe this is not a usual question for this forum... I have the following two matrices, Ds and Dss, respectively: ...
1
vote
2answers
50 views

Matrix with simplified EngineeringForm

I have the following numerical matrix: Ds={{0.0002773500981126146, -0.0002773500981126146},{0.0005547001962252292, -0.0002773500981126146}} I would like to ...
0
votes
0answers
31 views

Root (#1^3 …) How exploit the result of Matrix Eigenvalues [closed]

I try to determine the Eigenvalues of matrix[4x4] (algebraic results) but I don't understand the result. How exploit the result with #1^3 ? I would like find a algebraic result for each eigenvalues. ...
0
votes
1answer
47 views

Strange result of MatrixFunction

Let us consider the sum of the matrix series m = 2; n = 3; Sum[MatrixPower[{{1, 2}, {3, 4}}, m + k*n]/(m + n*k)!, {k, 0, Infinity}] {{-(32 E^(-(5/4) - Sqrt[33]/...
1
vote
1answer
41 views

Why am I getting incorrect Eigenvectors for my matrix? [closed]

When i try and compute the Eigensystem using Mathematica i am getting negative values for my Eigenvector, but my Eigenvalues are correct but my Eigenvectors are incorrect and i do know why is that? \...
4
votes
3answers
785 views

How to speed up large double sums in a table?

I am calculating a 3-by-3 matrix whose elements are given as follows: $$ M_{mn} = \frac{1}{N}\sum_{i=1}^N \sum_{j=1}^N (r^i_m - r^j_m)(r^i_n - r^j_n) \tag{1} $$ where $N$ is the total number of ...
0
votes
1answer
37 views

Simplifying an expression involving a matrix and functions of it

I have implemented the following two matrices in Mathematica in order to compute s, but I don't know how I can further simplify the resulting expressions, e.g., ...
1
vote
1answer
28 views

Verify that a PDE is satisfied by a matrix consisting of functions satisfying a different PDE

My problem is as follows: I have two matrices $P$ and $Q$ which are made up of algebraic expressions of a function $q(x,t)$ which solves a somewhat complicated pde, and its derivatives, for example, ...
0
votes
1answer
50 views

How do I create a Jacobian matrix for a large system of equations?

I would like to create a Jacobian matrix using the simplified functions below: f1[a_,b_,c_]:= a^2 + b^2 f2[a_,b_,c_]:= c/2 f3[a_,b_,c_]:= b^3 I say simplified ...
1
vote
2answers
49 views

Matrix whose coefficients are functions

What is the right way to declare of matrix whose coefficients are functions of a variable $x$ ? I tried : Table[Table[a[i,j][x_],{j,1,NN}],{i,1,NN}]
3
votes
2answers
342 views

How to denote matrix elements succinctly? [closed]

Is there a more elegant way of dealing with the following subscripting? ...
1
vote
1answer
15 views

Show result of matrix operation in terms of user defined matrices

I have defined some matrices K[0],K[1],...,K[9] and S[1],...
6
votes
4answers
354 views

Find the identical rows in a matrix [duplicate]

Suppose I have the following matrix: ...
0
votes
1answer
35 views

How to create a dot product version of the product function

I would like to create a function to matrix multiply (dot product) n matrices together, where n is large, for example M1*M2*M3*M4*M5*...*Mn I know there is the 'product' function that can do this ...
0
votes
0answers
73 views
0
votes
0answers
49 views

How to make a compiled version of a function?

I'm trying to make a compiled version of this function ...
2
votes
1answer
54 views

Efficient computation of matrices involving large sums of KroneckerDelta's

I was wondering if one could benefit from Mathematica's rich linear algebra methods for diagonalizing 2nd rank tensors. Namely, in the context of systems (fluids) comprised of capsule-like particles, ...
0
votes
1answer
24 views

Problem with solving a system of equations based on a matrix

I am trying to solve a system of equations based on a matrix in order to find the "stationary" matrix. the code I've written should break the matrix down into a system of equations such that some ...
2
votes
1answer
39 views

Matrix Decomposition and Collect

I am looking to decompose a matrix in terms of a sum of matrices with the same coefficients, i want something in this form : $ m1= \begin{pmatrix} a^2 + 2a + 3 & 1 \\ 2a & a^2 \end{...
4
votes
2answers
310 views

`FindRoot [ ]`::jsing: Encountered a singular Jacobian at a point…WHY

I have a large system of linear and nonlinear equations. I know that the system is not singular at the point given because I calculated the Jacobian and evaluated it at a given point. The resulting ...
0
votes
0answers
40 views

Why is this iterative process with matrix calculation so slow?

I am trying something similar to the following code with Ntime as large as 100 or so. Now it's very slow as shown by the Ntime=3 ...
0
votes
2answers
50 views

Apply matrixform to limited rows and columns of a matrix

I have a big matrix, you can say 1000*1000 whose elements are functions of several parameters such as a, b. I wish to see just a ...
3
votes
1answer
59 views

What's the easiest way to combine specific columns of two matrices?

given matrices A = {{3, 10, 10, 5.`}, {4, 10, 10, 6.`}, {5, 10, 10, 7.`}} B = {{6, 10, 10, 5.`}, {7, 10, 10, 6.`}, {8, 10, 10, 7.`}} how can i get a matrix which ...
0
votes
1answer
88 views
1
vote
1answer
46 views

Matrics manipulations

this is a basic question in Mathematica, I hope to get help to resolve it, How I can extract elements from matrics for example I have ...
0
votes
2answers
68 views

Function for finding the nth unique minimum value in a list?

I have this matrix... mat = Table[{k, 0}, {k, 0, limit}]; After a series of dynamic iterative operations, some of the 0 initialized entries (i.e., those of the ...
1
vote
2answers
42 views

Locate all row and column pairs containing a value in a table

I would like to find all row and column pairs that contain 1 in a table. For example, the row and column pairs that contain 1 in the table are (a,b),(b,a),(b,c),(c,b),(c,d),(d,c),(d,e),and (e,d). <...
1
vote
1answer
30 views

Defining a function that outputs a matrix, and later finding its eigenvalues

I am trying to do the following: I have a simple 2x2 matrix that depends on three parameters (physically -- momentum coordinates kx, ky, kz). Then I want to replace each of these parameters by a ...
0
votes
1answer
67 views

Vector and matrix multiplication

I have a question: Given a vector $v=(1,0)$ and a matrix $A(φ)= \begin{pmatrix} cos(φ)&-sin(φ)\\ ...
1
vote
0answers
44 views

Confusion matrix using data from two matrices

I have a problem. Any help will be appreciated. In order to calculate the accuracy, sensitivity, sensibility and F1 score between diseases and their symptoms, I have two matrices with a different ...
0
votes
1answer
114 views

Wrong calculation with matrix exponential (MatrixExp)

I've been doing some calcultations on mathematica which involve exponential of matrices. It's well known that if [A,B]=0 then [A,F(B)]=0 where A,B are matrices and [,] is their commutator. Nonetheless,...
3
votes
2answers
88 views

Efficiently find all values of parameter such that any of the eigenvalues of a matrix is equal to 1

I wish to find all values for a parameter such that my matrix has an eigenvalue of 1. Here is an example 16-by-16 matrix with elements depending on the parameter x ...
2
votes
2answers
77 views

Using good method to produce a regular matrix

The matrixform is as follow, and how can I use good method to produce it? H = {{1, 1, 0}, {2, 2, 0}, {0, 1, 1}, {0, 2, 2}, {1, 0, 1}, {2, 0, 2}}
1
vote
1answer
56 views

Least squares fit of a symmetric linear system

I have $q$ measurements with $p$ different excitations. In one special case, they might be equal in length. For example, I might have 12 measurements ($q=12$) with three excitations each ($p = 3$), ...
2
votes
1answer
28 views

Maximally expand tensor series?

I am trying to obtain a power series expansion in some real parameter, but all the terms are arbitrary products of tensors. I.e. I want to expand an expression containing sums/products/powers of this ...
0
votes
0answers
44 views

How can I speed up my code finding the parameter which yields zero determinant for increasingly larger matrices?

I build a square matrix with matrix elements dependent on the parameter x. I need to find all values of x within a reasonable ...
1
vote
1answer
21 views

How to define a function, that generates matrix of variables, which can be later used in Reduce?

My goal is to generate matrices, on which I will put different constraints in Reduce funcion, e.g.: ...
3
votes
1answer
110 views

Identify maximum difference in Matrix

i am trying to find the Maximum difference between two matrices and identify where this maximum occurs. I illustrate what I mean using an example. Given ...
4
votes
1answer
43 views

Strange bug in LUP Decomposition

I have written LU decomposition with partial pivot, but for some matrices, the entry L[[1,1]] isn't equal to 1 like it should be,...
1
vote
0answers
46 views

Noise covariance matrix

I am trying to find the noise covariance matrix of a random vector $\mathbf{x}$ with itself. The elements of this vector represent image pixels and are treated as random variables i.e, $\mathbf{x}=\{...
0
votes
1answer
54 views

How to replace the entries of a matrix by another matrix?

I have a two matrix mm and nn. Matrix mm is of dimension 8 cross 8 and nn is of dimensions 4 cross 4. I want to replace the first four rows and columns in mm by nn. How to do this? ...
0
votes
0answers
32 views

Dynamical PlotLegends with two indices

I need to plot several eigenvalues from different matrices, so I would like to know how can I change the name of the curve with each set of matrices-eigenvalue. What I am doing is the following: <...