Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

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

Derivative of matrix functions in NCAlgebra

I mean the differentiation of complex expressions of this type, where the matrices are implicitly given, but it is known that they are a function of vectors. For example: $q_1=x^TA(x)x$ $q_2=x^TA(y)x+...
user avatar
  • 1,576
3 votes
1 answer
108 views

How do I create and combine column matrices from lists

I need to input the following list of values for x and y , each as a column matrix (7-row, 1-column). Then, combine the two into a 2 x 7 column matrix. I'm new to Mathematica. Please help. How do I do ...
user avatar
-2 votes
1 answer
77 views

Is there a way to apply a two-argument function to matrices?

Basically, I want an analog of MatrixFunction but such that it can apply a two-argument function to two matrices.
user avatar
  • 2,705
0 votes
0 answers
20 views

What is the 3rd additive compound of a general $5$x$5$ matrix? [duplicate]

How would I construct the 3rd additive compound of a general $5$x$5$ matrix? $$A= \begin{bmatrix} a_{11}&a_{12}&a_{13}&a_{14}&a_{15}\\ a_{21}&a_{22}&a_{23}&a_{24}&a_{25}...
user avatar
  • 465
0 votes
1 answer
71 views

How to approximate a function using B-spline interpolation?

I would like to approximate a simple function of y = sin(x) using 3rd degree B-spline interpolation. The formula is: where D_j are the unknown real coefficients and B_(n,j) are the basis functions. ...
user avatar
3 votes
2 answers
127 views

How does NDSolve treat matrices?

I am having trouble trying to solve a differential equation which couples the elements of a matrix. Let's say I have the following ...
user avatar
  • 71
2 votes
1 answer
57 views

NDSolve: there are more variables than equations, underdet

I am working on using NDSolve to solve coupled ODE. The following is the coupled equations. It works fine for sever orders. I used table to generate like 962 couple variables and equations, where the ...
user avatar
1 vote
1 answer
46 views

Derivative of quadratic form in NCAlgebra

I installed the NCAlgebra package in the hope that it contains enough rules for symbolic work with most branch-matrix expressions. ...
user avatar
  • 1,576
4 votes
2 answers
71 views

Looking for a efficient way of solving a matrix which is function of some variable

What is the efficient way to solve the matrix having a dependency on some varaible f. I have a simple matrix g which is ...
user avatar
0 votes
1 answer
46 views

Total Spin Matrix Squared (Casimir Operator)

I am trying to get Mathematica to compute the Casimir operator of a 4 particle system of spin $1/2$ fermions. I have the following code which does not do what I would like it to. ...
user avatar
  • 137
2 votes
1 answer
63 views

Invert a generic n x n matrix

I want to invert a generic n x n matrix. Is it possible to do this with Mathematica? Consider, as a minimal example, the $n\times n$ matrix: \begin{bmatrix}1n&0&...&0\\0&2n& ... &...
user avatar
  • 151
0 votes
0 answers
32 views

Giving a scalar and vector function to ND solve?

I'm trying to solve a coupled system of ODEs using NDSolve. In this system, one function is a scalar and another is a vector i.e. it contains multiple components. <...
user avatar
  • 1
0 votes
0 answers
24 views

PSDMatrix completion

How can I write a code which gets as an input a symmetric square matrix X with some (symmetric pairs of) entries marked, and outputs whether there is an assignment of values to the marked entries such ...
user avatar
0 votes
0 answers
65 views

How to matricize a vector?

I am wondering how to represent a vector as a matrix, using specified dimensions. For example, MatrixForm[{a, b, c, d}] gives me a column vector. But I would want ...
user avatar
0 votes
1 answer
58 views

Help with equation within adjacency matrix

(Value R seen within desired matrix equation) resistance = 0.5; (L = ???) identitymat = IdentityMatrix[30]; fullmatrix = ((AdjacencyMatrix[plot])) + identitymat // MatrixForm p.s. I believe I have ...
user avatar
0 votes
0 answers
36 views

Given a matrix with i = number of rows and j = number of columns how to process (look at all entries ) i,j,k using mathematica

I want to process the matrix using the segment of code that says "i, j, k" and then output a print statement if the condition is met" My goal is to verify that a relation represented as ...
user avatar
2 votes
3 answers
128 views

Insert a dynamic vector into a matrix

If I have the following dynamic vector Cs[NN_] := Table[{Sin[(2*i - 1) τ], Sin[(2*i - 1) τ]}, {i, 1, NN}] // Flatten The size of Cs depends on the integer ...
user avatar
  • 1,163
0 votes
0 answers
54 views

Unitary matrix with UnitaryMatrixQ

In the Mathematica help, the following example for a symbolic 2$\times$2 matrix $\left( \begin{array}{cc} a & b \\ c & d \\ \end{array} \right)$, with constraints, $c=b^{*}$ and $d=-a^{*}$ ...
user avatar
0 votes
1 answer
61 views

How to use "Replace" in matrix? [closed]

I would like to change the form of matrix output, for example: A = {{1, 0}, {0, 0}}; B = {{0, 0}, {1, 0}}; B.A This will give me a matrix that is the same as the ...
user avatar
2 votes
1 answer
116 views

Speed Up the Gelman-Rubin-History function

A bit of background information I have created a function to calculate the convergence of the Gelman Rubin diagnostic (useful in Bayesian analysis). The function seems to work as I want, however I ...
user avatar
2 votes
2 answers
134 views

Find the maximum value of the minimum eigenvalue of the matrix

There is a $4×4$ matrix $Q$ where $c,d,e,m,n$ are variables. How to get the maximum value of the minimum eigenvalue of $Q$? $Q=$ $$\\\left( \begin{array}{cccc} \frac{12058305}{23104}-304 c & -849 ...
user avatar
  • 51
1 vote
0 answers
50 views

Dimension of the dot product - symbolic calculation

With the following code $Assumptions = {a \[Element] Matrices[{2, 2}]}; Dimensions[{{1, 0}, {0, 0}}.a.{{1, 0}, {0, 0}}] I get as an answer ...
user avatar
  • 625
11 votes
11 answers
2k views

How can I construct this matrix?

How can I construct this matrix by MMA? $\left(\begin{array}{cccccc}1 & 2 & 3 & \cdots & n-1 & n \\ n & 1 & 2 & \cdots & n-2 & n-1 \\ n-1 & n & 1 & \...
user avatar
  • 1,365
0 votes
1 answer
43 views

Determine value of parameters in a matrix such that it is unitary [closed]

My goal is, given some vectors, multiply them by some constants and stack them as the columns of a matrix $U$. Then I want to know what are the values of the constants such that the resulting matrix $...
user avatar
  • 123
3 votes
1 answer
133 views

Construct Special matrix in mathematica

I want to define $D = [d_{ij}]$ as the $(N+1) \times (N+1)$ lower triangular matrix given by the following recursive definitions: $$ \begin{aligned} d_{i,i-1} &= i, \qquad\qquad \qquad i=1,2,\dots,...
user avatar
  • 703
0 votes
1 answer
35 views

Partial Trace with KroneckerProduct

I have some symbolic expression of the form X=KroneckerProduct[A,B]+KroneckerProduct[G,F]+... How can I define a partial trace for this, i.e. a function f: ...
user avatar
  • 625
4 votes
1 answer
68 views

Mathematica replaces list of zeros with zero [closed]

Consider the following functions: f[x_]:= {{Im[x], Re[x]}, {Re[x], Im[x]}}; g[x_]:= {{Im[x],0},{0,0}} When applying each of the functions to the list of lists <...
user avatar
3 votes
2 answers
96 views

Set of quadratic forms and linear algebra

I have a set of quadratic forms. $L_{1}=u_1^TJ_{1}u_1$ $L_{2}=u_2^TJ_{2}u_2$ $L_{3}=u_3^TJ_{3}u_3$ where $u_{i=1,2,3}$ - 3$\times$1 vector; where $J_{i=1,2,3}$ - 3$\times$3 matrix; I need to pack ...
user avatar
  • 1,576
8 votes
5 answers
497 views

How do I flatten a matrix of lists while maintaining the structure of the list?

I have a 2x2 matrix of lists. For example, the matrix I am working with looks like matrix = {{{a,b,c}, {e,f,g}}, {{h,i,j}, {k,l,m}}} I want to define a function ...
user avatar
0 votes
2 answers
47 views

How to create a symbolic Matrix for evaluation at specific values

I want to create a symbolic matrix that I can evaluate at the given values of variables. Definitions: ...
user avatar
  • 4,391
3 votes
1 answer
74 views

Imposing constraints on any undefined symbol appearing in a matrix automatically

I want to know how can I can I tell Mathematica that all symbols that appear in an object, e.g. a matrix, obey certain constrains, without having to write these conditions by hand. More specifically, ...
user avatar
  • 517
0 votes
0 answers
34 views

Trying to map SparseArray over a defined list, the SparseArray defined with 3 subvalues i want to map the 3rd. subValue(list) over the defined list

I have a SparseArray already defined as following ...
user avatar
3 votes
1 answer
43 views

Trying to add up values into a matrix

first post here. I'm currently completely stuck and frustrated with mathematica. In retrospective, it might had been a mistake to use it for this, I'm actually considering to somehow export the ...
user avatar
  • 33
0 votes
1 answer
61 views

Working with matrices problem with MatrixForm [closed]

I'm just trying to set up a Matrix 24 by 24 with indices that start from 0 to 23 ...
user avatar
  • 199
2 votes
1 answer
142 views

How to construct this Matrix

A $4\times 4$ identity matrix $\mathbb{I}$ can be written as $\mathbb I=\delta_{ij}\delta_{kl}$. To construct this matrix, I wrote ...
user avatar
2 votes
2 answers
82 views

making elements of matrix into integers [closed]

how to make elements in a matrix into integers? here is my matrix: ...
user avatar
4 votes
1 answer
87 views

Efficient iteration of matrix multiplication into a table

Suppose I have a list of matrices $(A,B,C)$ and a vector $v$. I want to construct a table whose elements are sequential applications of these matrices to $v$, i.e., the first entry will be $Cv$, the ...
user avatar
  • 595
5 votes
3 answers
360 views

Jacobian matrix evaluation at a point [duplicate]

I have a vector function $ f(x,y) = (f_1(x,y), f_2(x,y) ).$ I need to find the Jacobian matrix for $f$ evaluated at the point $(x,y) = (a,b).$ I learnt that I can use something like the following on ...
user avatar
  • 53
2 votes
2 answers
88 views

Proving (or refuting) TU (totally unimodularity) of a matrix nxm

I am new to Mathematica and want to prove the totally unimodularity of a matrix (not a particular one, but for any matrix input). A matrix A is totally unimodular (TU) if every square submatrix of A ...
user avatar
  • 131
1 vote
0 answers
60 views

How to calculate the determinant for all the submatrix of a matrix?

I want to calculate (and see) all the submatrixes determinant for one non-square matrix with dimensions nxm. I know I can get the determinant of a matrix using Det(matrix), but I would like to know if ...
user avatar
  • 131
4 votes
3 answers
179 views

Thread Matrices, like image channels

The code With[{matA=Partition[Alphabet[],5],matB=Partition[Range@25,5]}, (* matA and matB are 5x5 matrices*) MapThread[List,{matA,matB},2] ] is fairly ...
user avatar
  • 2,588
2 votes
2 answers
368 views

How to put a FOR loop in a WHILE loop

I have a strange matrix like this one in the picture Now, my goal is to change all the 1s with random complex numbers of modulus 1, but if the element $a_{12}=z$, then $a_{21}= \bar{z}$, so the ...
user avatar
  • 123
1 vote
0 answers
29 views

Solve the current equation with respect to one of the coefficients and substitute it into each equation of the system

Good day to all! In this question about recurrence relations, I had a simple case when the k + 1th variable is represented in terms of ...
user avatar
0 votes
0 answers
61 views

Solve coupled differential equation using Matrix

I am a complete beginner to Mathematica. I am trying to solve the following equation: $\frac{d}{dt}\rho_t = -0.5* \eta* \Gamma[\rho_t]$, where $\Gamma[\rho_t]$ is a 4x4 matrix whose coefficients are ...
user avatar
0 votes
1 answer
38 views

Reduce expressions into (simplified) matrix and vector forms

I have some computation that results in a rather complicated looking expression that could be much simplified by converting it into matrix or vector expressions. For example, instead of ...
user avatar
  • 206
0 votes
1 answer
61 views

Adding every entry of two tables

I have to randomly create a polymer (random angle between parts), change a random angle by a bit (delta), and determine the energy difference. RandomAngle contains all the angles and DeltaTable ...
user avatar
2 votes
1 answer
94 views

Dot Product of Vector with matrix components

In Physics it's common to write matrices in vector components to simplify notation. This commonly occures with the pauli vector $\vec\sigma = \begin{pmatrix}\sigma_1 & \sigma_2 & \sigma_3\end{...
user avatar
3 votes
1 answer
103 views

Change of basis matrix between symmetric matrices

I have two 5x5 matrices: ...
user avatar
  • 912
3 votes
2 answers
160 views

How to define a matrix product based on a different scalar product

I want to define a product of 3x3 Matrices where the coefficient behave in a different way as usual. I defined the multiplication between coefficient as the function MyScalProd ...
user avatar
  • 199
0 votes
1 answer
98 views

Fitting data in a matrix

Consider the 'm' matrix: Link to 'matrix.dat': https://drive.google.com/drive/folders/1COdMCCBKq85vMDj6Jrb2qqoUlE9eTk6w?usp=sharing ...
user avatar
  • 939

1
2 3 4 5
63