Skip to main content

Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

Filter by
Sorted by
Tagged with
2 votes
3 answers
156 views

Converting an algebric expression into a matrix form

Consider the following expression: a1 b1 c1 + a4 b2 c1 + a7 b3 c1 + a2 b1 c2 + a5 b2 c2 + a8 b3 c2 + a3 b1 c3 + a6 b2 c3 + a9 b3 c3 Can Mathematica convert it ...
SciJewel's user avatar
  • 452
0 votes
0 answers
52 views

A problem with obtaining the beam frequencies and mode shapes

I am supposed to find the mode shapes of two assembled beams. To this end, we must reduce the PDE equation of motion of beam to an ODE including the oscillation frequency. The solution of ODE has some ...
Sajad Mirhashemi's user avatar
0 votes
1 answer
35 views

MatrixForm not solving using defined variables

Currently, I'm experiencing an issue when using MatrixForm, I've attached the code that shows the problem, but essentially when trying to get it to solve, it just depicts the equation in terms of ...
user98918's user avatar
0 votes
1 answer
106 views

Am I transposing correctly?

I want to implement the Yang-Baxter equation (in the form of the first formula given in the link). My R-with-caron matrix (called s in the code) is not stored as a tensor with dimensions n.n.n.n, but ...
Hauke Reddmann's user avatar
0 votes
3 answers
67 views

How to parallelize and minimize the time of a simple code using ParallelTable?

Dear Mathematica users, I have simplified my real problem, lets say I have 2 matrices, Amat and Bmat, the below code generates a random 2x2 real matrix, B for each of the eth element range from 1 to ...
Kazim Ahmet Hasim's user avatar
0 votes
0 answers
40 views

Compilation error for multidimensional lists [duplicate]

Dear Mathematica users, I have a code as: ...
Kazim Ahmet Hasim's user avatar
3 votes
1 answer
41 views

Compilation error while adding two matrices [closed]

Dear Mathematica users, I would like to compile my function and my sample code is as: ...
Kazim Ahmet Hasim's user avatar
0 votes
0 answers
36 views

Find a diagonal matrix and the matrix eigenvalues [duplicate]

...
caren's user avatar
  • 115
0 votes
1 answer
29 views

Extracting matrix coefficients from multivariate matrices

Suppose we have a multivariate polynomial matrix $P(\mathbf x) = \sum_\alpha A_\alpha\mathbf x^\alpha$ (in multi-index notation) where the $A_\alpha$ are constant coefficient matrices. I am looking ...
GBaardink's user avatar
0 votes
0 answers
26 views

Calculating determinant and adjoint of a matrix of arbitrary dimensions

I am trying to compute the determinant and adjoint/adjugate of a matrix with each entry a polynomial in symbolic variables a[1],...,a[k] and dimension some ...
Curious Mind's user avatar
0 votes
1 answer
54 views

Diagonalizing a real symmetric matrix with an orthogonal matrix

$$mt1 = \pmatrix{a& b& c\\b& d& e\\c& e&h}$$ For $mt1^T.mt2.mt1$ = d, where mt1 is an orthogonal matrix, mt2 is a real symmetric matrix and ...
SciJewel's user avatar
  • 452
2 votes
1 answer
80 views

A first order differential equation: Inconsistent solutions by two approaches

Assuming $a>0,b>0,c>0$, in matrix A = {{a - I*b, c}, {c, a + I*b}}; I am interested in solving the following differential equation $\frac{d}{dt}R(t) = -i(...
phy_std's user avatar
  • 143
1 vote
1 answer
71 views

Use Mathematica to Implement Blahut–Arimoto Algorithm (Part: Algorithm for Rate-Distortion)

Try to use Mathematica to implement Blahut–Arimoto algorithm (here we just focus on the part of computation of Rate-Distortion). Here are some reference code snippets: Python The algorithm looks ...
138 Aspen's user avatar
  • 1,395
1 vote
1 answer
82 views

Use Mathematica to Implement Blahut–Arimoto Algorithm (Part: Algorithm for Channel Capacity)

Try to use Mathematica to implement Blahut–Arimoto algorithm (here we just focus on the part of computation of channel capacity) Here are some reference code snippets: MATLAB(a) MATLAB(b) Python The ...
138 Aspen's user avatar
  • 1,395
6 votes
2 answers
186 views

Why is Mathematica not simplifying this matrix?

I have trouble simplifying the following matrix ...
phy_std's user avatar
  • 143
5 votes
5 answers
455 views

How can I build a symmetric matrix of up to 100?

I have a square matrix of 100 elements in the form: A = {{a^0, a^1, a^2, a^3,...,a^99}, {a^1, a^0, a^1, a^2,...,a^98}, {a^2, a^1, a^0, a^1,...,a^97}, {a^3, a^2, a^1,a^0,...,a^96}...{a^99,a^98,...,a^2,...
Edinardo Rodrigues's user avatar
3 votes
1 answer
63 views

Solving a first order linear matrix differential equation

I am struggling in solving the following differential equation (with B and g real numbers) ...
phy_std's user avatar
  • 143
0 votes
1 answer
87 views

Simplification of arrays of a matrix

I want to simplify the arrays of a matrix, first I tried to define my constants then used "FullSimplify" but it does not work. Please see the screen shout. ...
Ali Bizhanpour's user avatar
0 votes
0 answers
17 views

Is it possible to find a closed-form expression for determinant of the $k+1$-dimensional three-diagonal matrix whose entries obey particular rules?

I have this $k+1$ dimensional three-diagonal matrix in which $k=0,1,2,3,...$. I want to compute its determinant. Of course, for each fixed $k$ it is easy to compute the determinant. My question. Since ...
charmin's user avatar
  • 1,159
1 vote
1 answer
67 views

Retrieving only first function in matrix ODE using NDSolve

I have a very stupid question, but I don't use Mathematica very often, so here it goes: I'm trying to solve some "matrix" ODE using NDSolve. The matrix in ...
user3914956's user avatar
3 votes
0 answers
68 views

Inconsistent solutions in two representations

Consider the following differential equations: ...
phy_std's user avatar
  • 143
4 votes
1 answer
87 views

How can I extract a matrix and vectors of coefficients from this quadratic expression?

Consider the following expression (x-y+a)^2 + (x-z+b)^2 // Expand The result is ...
user1620696's user avatar
2 votes
2 answers
138 views

How to solve a matrix differential equation $\frac{d X}{dt} = i(X Y- Y^\dagger X)$?

In eq (21) on page-5 of this article, we have matrix HEP = (\[Omega]/2)*{{-2*I, 1}, {1, 0}}; and I am interested in finding matrix ...
User101's user avatar
  • 613
0 votes
0 answers
63 views

JacobianMatrix function flattens input in column order

The JacobianMatrix function appears to flatten its input in column order. Both of the following queries (Wolfram Alpha syntax) give the same result: Q1: "JacobianMatrix of {{a_1+a_2, a_1+ a_2, ...
xformat's user avatar
1 vote
0 answers
81 views

How to decrease the computation timing while using NIntegrate?

I'm trying to calculate the $A$ and $F$ values by using this code, ...
Entangled Quark's user avatar
0 votes
2 answers
53 views

Automatic matrix operations with parameters obtained by random numbers

I have matrix T defined by 2 parameters: T = {{0, 0, 0},{0, 0, a},{0, a, b}}; These 2 parameters are randomly generated by means: ...
Gae P's user avatar
  • 657
0 votes
0 answers
83 views

Why won't my matrix remain Hermitian?

I have a $4\times 4$ Hermitian matrix called $A_{x}$ whose elements are labelled $a_{ij}$ $(i,j = 1, 2, 3, 4)$. (See definitions below.) The $a_{ij}$'s are functions of two variables $x$ and $y$ and ...
Quantum Kid's user avatar
0 votes
2 answers
82 views

Get transformation matrix from transformations

I want to find a matrix corresponding to certain transformations I already know. Basically I have a set of vectors $x_i$ and I need the matrix $m$ that transforms $x_i$ to another set of vectors $b_i$ ...
avnar's user avatar
  • 1
1 vote
1 answer
60 views

Defining a symbolic block matrix

I'm a total beginner in Mathematica and I have been struggling with defining the following symbolic matrix with entries in $\mathbb{Z}_2$ Here, $\mathbb{1}_{m_i}$ and $\mathbb{0}_{m_i}$ stand for the ...
Mohammed Sabak's user avatar
9 votes
3 answers
1k views

Taxicab Geometry

According to taxicab geometry, there are 1226 possible paths from A(2,5) to B(7,9), all with a distance of 9 units, |2-7|+|9-5|=9. I wanted to write a code where I could be obtaining the plots of some ...
Rubens Vilhena Fonseca's user avatar
5 votes
2 answers
508 views

Fill a matrix with randomly placed elements that are a certain distance apart

Problem statement I want to populate a matrix of points with randomly placed elements, here denoted as x. In all matrix rows there must be an equal number of x-...
eldo's user avatar
  • 75.1k
0 votes
2 answers
54 views

How to use FoldList for matrix multiplication?

I'm trying to use FoldList to create successive matrices that depend on a changing parameter n, so the transition matrices are ...
magg13__'s user avatar
3 votes
3 answers
204 views

Finite Differences:

I am having difficulty implementing finite differences in the correct columns of my code. ...
Rubens Vilhena Fonseca's user avatar
2 votes
3 answers
486 views

Why is Mathematica not simplifying eigenvalues?

For matrix A = {{x*Exp[I*y], z}, {z, x*Exp[(-I)*y]}}; , Mathematica yields the following eigenvalues: ...
Jee's user avatar
  • 386
12 votes
3 answers
450 views

Visualizing diagrams needed to compute $\operatorname{Tr}(A^3 (A^T)^3)$

I'm looking for help getting Mathematica code to construct diagrammatic expressions like the following, obtained by River Li as a way to compute $\operatorname{Tr}(A^2 (A^T)^2)$ for $d\times d$ matrix ...
Yaroslav Bulatov's user avatar
0 votes
1 answer
62 views

Generate all commutators and anti-commutators up to a certain order of a list of matrices

I am given a list of matrices. At first order I want to evaluate the commutators and anti-commutators of all pairs in the list and return a new list that contains two lists: one containing all ...
JohnnyB's user avatar
  • 95
8 votes
5 answers
343 views

Element-wise vector-matrix exponentiation

I would like to exponentiate the vector x = {x1,x2} element-wise with the non-square matrix A = {{1,0},{1,1},{0,1}} so that the ...
hr8tpa's user avatar
  • 83
0 votes
0 answers
32 views

Evaluating determinant with entries from ./ output

I generate 16 values (this is a differential equation shooting method problem) from this kind of evaluation, y41 = Evaluate[y4[tf1] /. torsolve4]; When I use them in Det[], it does not work because ...
mrejr923's user avatar
1 vote
0 answers
137 views

Cross product of a vector and a matrix

I defined a symbolic matrix with vector elements as: ...
Harken's user avatar
  • 105
5 votes
3 answers
120 views

Tally elements in a list of matrices up to an overall sign

I have a list of matrices like the following one with 6 elements: ...
JohnnyB's user avatar
  • 95
0 votes
0 answers
32 views

Modeling with different outputs size

I have lists of input and output. I want to perform the prediction operation but my outputs are different for each input and this causes an error. Can someone help me to write the model in such a way ...
Erfan's user avatar
  • 169
1 vote
1 answer
37 views

Strange errors of exceeding RecursionLimit in a function with two arguments, one set delayed and one fixed

INTRODUCTION Hi. I feel a bit embarrased asking this question as the answer may be staring me in the face and there are at least two other stackexchange articles related to it. MINIMAL WORKING EXAMPLE ...
Russell Jay Hendel's user avatar
4 votes
2 answers
80 views

Speed up sparse Hermitian matrix-vector product

I am interested in speeding up as much as possible the dot product in the specific case of a multiplication of a $n\times n$ sparse hermitian matrix $H$ (where $n$ is typically large, let's say $\...
Matteo's user avatar
  • 283
0 votes
1 answer
41 views

Get explicit formula after matrix derivation with Mathematica

I want to calculate the derivative of a matrix with respect to a vector with mathematica, and I would like to know if it is possible to have a formula as an answer instead of an expanded matrix. For ...
ZchGarinch's user avatar
4 votes
1 answer
98 views

Efficient way of creating matrices from a very large array while avoiding singular values

I need to create matrix from a large array (>>10000 elements) for further use. I have tried Outer and ParallelTable commands, among which Outer seems to be faster when the array size is not so ...
user91411's user avatar
  • 400
4 votes
2 answers
76 views

How do I generate a table of cofactors from minors of a matrix?

I'm trying to figure out how to find the determinant of a 5x5 matrix by co-factor expansion in the second row. I have already calculated the minors of the matrix using ...
Lucas Conklin's user avatar
1 vote
1 answer
56 views

NonCommutativeMultiply in Matrix Multiplication

Is there a way to preserve the order of elements in the multiplication of matrices when the elements themselves are matrices? For example, if I have: ...
Matthew Crawford's user avatar
4 votes
1 answer
158 views

Writing a matrix as a linear combination of matrices

Suppose I have two matrices A and B. After some calculations, I arrive at a matrix M and ...
Ruben Campos Delgado's user avatar
1 vote
0 answers
31 views

NDSolve with matrix variables and SymplecticPartitionedRungeKutta [closed]

I'm experimenting with solution of differential equations with matrix variables, where the right hand side is defined as a numerically evaluated function of a matrix. Here is a simple example: ...
Igor's user avatar
  • 303
4 votes
1 answer
159 views

Formulate and solve a system of linear, first-order ODEs in Mathematica

I know this code is wrong, but I am not sure why. I have a system of coupled differential equations. The model is given by the following equations: $\frac{dS_0} {dt} = (1 - \mu_0) \rho_0 S_0 \frac{S_\...
Ben Hardisty's user avatar

1
2 3 4 5
72