Questions tagged [matrix]
Questions on the manipulation of matrices in Mathematica.
3,147
questions
2
votes
0
answers
35
views
Algorithm for the resolvent of a matrix, and LUBackSubstitution
Suppose A is a complex n x n matrix where n is quite big, given as a numeric array. For many ...
2
votes
0
answers
88
views
Filling the space with rectangles
The problem concerns filling the matrix m x n with rectangles.
...
1
vote
1
answer
77
views
Inverse of a matrix with symbolic variables
I want to evaluate the inverse of the following colossal matrix
...
0
votes
1
answer
42
views
How to solve this equation of n-order matrix?
Question:
Let i be an n-level identity matrix and j be an n-level matrix with all elements of 1.
Let n-order matrix m be
$M=\left(\begin{array}{ccccc}k & \lambda & \lambda & \cdots & \...
1
vote
2
answers
67
views
Timing for generating long matrix
I need a code for thermodynamics research that generates a matrix of 32768 by 32768 elements.
The code is the followng:
...
3
votes
1
answer
115
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 ...
-2
votes
1
answer
78
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.
0
votes
0
answers
21
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}...
0
votes
1
answer
76
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.
...
3
votes
2
answers
135
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
...
2
votes
1
answer
58
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 ...
1
vote
1
answer
48
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.
...
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 ...
0
votes
1
answer
47
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.
...
2
votes
1
answer
66
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& ... &...
0
votes
0
answers
33
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. <...
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 ...
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 ...
-1
votes
1
answer
59
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 ...
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 ...
2
votes
3
answers
130
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 ...
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^{*}$ ...
0
votes
1
answer
62
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 ...
2
votes
1
answer
117
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 ...
2
votes
2
answers
135
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 ...
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
...
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 & \...
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 $...
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,...
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:
...
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 <...
3
votes
2
answers
97
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 ...
8
votes
5
answers
498
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 ...
0
votes
2
answers
49
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:
...
3
votes
1
answer
76
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, ...
0
votes
0
answers
35
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
...
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 ...
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
...
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
...
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:
...
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 ...
5
votes
3
answers
366
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 ...
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
...
1
vote
0
answers
61
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 ...
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 ...
2
votes
2
answers
370
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 ...
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 ...
0
votes
0
answers
62
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 ...
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 ...
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 ...