Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

Filter by
Sorted by
Tagged with
1
vote
1answer
57 views

How do I solve a large system of differential equations with indexed functions?

I strongly suspect that matrix methods are the right answer here, but I am having trouble visualizing how to set it up. Imagine a large number of coupled functions: ...
1
vote
1answer
81 views

Problem when solving Kalman filter in Mathematica: How to define a spectral density matrix and calculate the covariance matrix?

I am reading the classic book on state-space control theory by Bernard Friedland. In order to strengthen my understanding of Kalman filter, I want to reproduce Example 11A (Inverted pendulum on page ...
0
votes
0answers
53 views

Prove that a sum is bounded

I have a matrix called x[n_,m_]: and I have to evaluate the next expresion: but the code has errors. How can I fix it? ...
8
votes
4answers
333 views

Simplify makes Mathematica forget that a matrix is Hermitian

Using Simplify with certain trivial assumptions makes Mathematica forget that a given matrix is Hermitian. See the minimal example below: ...
2
votes
2answers
91 views

How to overlay MatrixPlot with GridGraph?

I have a Matrixplot and a grid graph and I want to overlay them. But when I use show[g1,g2], it did come out what I wanted. I wonder how can I overlay them and make them like this? To make the points ...
3
votes
1answer
49 views

Evaluating Toeplitz determinant [closed]

How can one evaluate $-\text{log}~ \text{Det}(I_{i-j}(x))$ where $x>200$ and $I_{\nu}(x)$ is the modified Bessel function of first kind and $i,j = 1 \cdots 100$ and the determinant is take of the ...
4
votes
2answers
90 views

Create a $N\times N$ random matrix with correlated off-diagonal elements

I am working on spectral distribution of random matrices. I need to use simulations and I have been switching between MATLAB and Mathematica. I wish to perform all my computations on Mathematica. In ...
2
votes
1answer
86 views

Gauss Jordan code for mathematica

I want to find the inverse of the matrix using a unit matrix. I know it's done directly using Inverse, but I need to write a simple code. I can't write because I'm just starting to learn. How can I ...
2
votes
0answers
36 views

What kind of performance should I expect out of Eigensystem using FEAST?

I'm numerically solving a time-independent Schrödinger equation using Eigensystem's FEAST method. It takes a lot longer than I ...
4
votes
2answers
94 views

Replace the diagonal of a list of matrices

I want to replace the diagonal of a square list of matrices with another list of matrices. What is the fastest and most efficient way to do so. (I will need to do this for very large arrays) Small ...
1
vote
2answers
225 views

Finding specific eigenvalues

Given an $n\times n$ matrix $Q$ (with e.g. $n\approx10^4$) I am only interested in the 3rd smallest eigenvalue of $Q,$ and not the entire spectrum (assume all eigenvalues are real, e.g. a Hermitian ...
4
votes
2answers
258 views

Sum of all matrix entries

For large $n\times n$ symmetric matrices $T,$ where $n\approx10000,$ is there an efficient way of computing the total sum $S$ of its entries in Mathematica without having to loop over all its entries? ...
2
votes
2answers
72 views

Triangular matrices with conditions

I would like to generate a lower triangular matrix that has checkmarks in the non-zero entries. The way that I created this matrix is the following ...
7
votes
2answers
221 views

Fastest way to update rows of an array of SparseArrays

I have an array of sparse arrays (check update 3 below for a concrete example that has the same qualitative features as what I use in my real code) , say ...
6
votes
3answers
523 views

Joining matrices together

Given the following matrices (where $n$ can be any integer number, It is just for a general dimension of my space): ...
0
votes
3answers
125 views

listing matrices with some special constraint

Let we have list = {{4, 4, 4, 4}, {-4, 4, 4, 4}, {4, -4, 4, 4}, {4, 4, -4, 4}, {4,4, 4, -4}, {-4, -4, 4, 4}, {-4, -4, -4, 4}, {-4, -4, -4, -4}} I would like to first obtain the list of all ...
0
votes
0answers
31 views

Not really sure what am I doing wrong in Newton Euler iterative method

I am trying to perform iterative newton Euler method for dynamics of an RP manipulator. I have the DH table, inertia vectors and was able to get the value of wdot[i] (angular acceleration) but having ...
1
vote
0answers
41 views

Inverse[m1 m2] not equivalent to Inverse[m2] Inverse[m1], m1,m2 are 3x3 matrices, why? [closed]

I would like to use Mathematica to show that $(AB)^{-1} = B^{-1}A^{-1}$ I used ...
2
votes
1answer
92 views

Quadratic form for specific formula as matrix reprezentation [closed]

So I have problem for specific formula to create Quadratic_form form from $$y = 3 + x_1 - 2 x_4 + 2 x_3 x_4 + x_2 (-x_3 + x_4) $$ as matrix \begin{bmatrix} 1 & 0 & 0 & 0 \\ ...
0
votes
0answers
35 views

HermitianMatrixQ Ignores Assuming, $Assumptions

HermitianMatrixQ seems to ignore a variety of ways I tried to help it get the right answer. For example, ...
0
votes
1answer
65 views

Why sum of two simple matrix is not in correct way? [closed]

clear[a]; a = List[{0, 1, 2}, {1, 2, 3}, {2, 3, 4}] a // MatrixForm; M2 = Transpose[a] // MatrixForm; a + M2 I am trying to run this code for ...
0
votes
2answers
28 views

Create symmetric array of function values

I have function B[i,j] where i,j are integers. Then I create array: b = Array[B, {3,3}] now I set values of ...
3
votes
3answers
137 views

easiest way to construct the following determinant

What is the easiest way to construct the following determinant?] p is variable, I want to vary value of p each time and get the appropriate determinant.
0
votes
0answers
26 views

How to select multi vectors with particular condition

I have a matrix as: a01={{225., 1, 2, 3, 4}, {225.5, 2, 3, 4, 5}, {226., 3, 4, 5, 6}, {226.5, 4,5,6,7}} And I want to choose head: ...
5
votes
3answers
416 views

Defining a big matrix for iterative algorithm

I need to solve this system of equations with Seidel and Jacobi methods, so I tried to define a big matrix in Wolfram. I have read documentation, and I wrote the following command that should help me,...
3
votes
1answer
222 views

Solve the vector-matrix equation. Minimize the length of the desired n-dimensional vector

There is the following vector-matrix equation: $$\mathbf x^\top\mathbf M\mathbf x=\begin{bmatrix}x_1&x_2&x_3\end{bmatrix}\begin{bmatrix}a&b&c\\d&e&f\\g&h&i\end{bmatrix}...
1
vote
1answer
57 views

How to save matrices from each iteration of i? [closed]

I am trying to get the transformation matrices from DH parameter table and would like to save each matrix (Ai) getting after each iteration of i. How can I do that? ...
4
votes
4answers
111 views

How to transform an UpperDiagonalMatrix into a symmetric matrix in Mathematica 5.2?

I have an UpperDiagonalMatrix as the following, how to transform it into a symmetric matrix in Mathematica 5.2? Note: don't use the command ...
0
votes
1answer
54 views

Homogeneous Transformation matrix from DH table

I am very new to mathematics and I'm trying to write a code for getting the link frame transformation equations (0T1, 1T2...) using for loop. I am having some success with a poorly written code ...
6
votes
2answers
163 views

Element-wise multiplication of an array and a matrix

How can I express multiplication of an array and a matrix so that {x, y, z}*{{10, 20, 30}, {0, 1, 2}} gives ...
4
votes
1answer
75 views

Reduce memory cost with three matrices multiplication

My program is eating up all my RAM and the operation is related to 3 matrices multiplication, as the code shown below. example code: ...
0
votes
0answers
26 views

Filling Regions (Blocks) of a Binary Matrix with Different Probabilities

This is an extension of the following question: How to generate binary array whose elements with values 1 are randomly drawn, where the most elegant answer was posted in the comments: ...
0
votes
0answers
40 views

How to do Matrix Row Reduction but on a specific field in Mathematica?

Normally for $\mathbb{R}$ or even $\mathbb{C}$ row reducing a matrix is as simple as doing: MatrixForm[RowReduce[{a,b,c},{d,e,f},{g,h,k}]] But let's say I want ...
0
votes
1answer
129 views

How to multiply vector to create a matrix? [closed]

There might be related posts but so far I'd not been able to find them: u={u1,u2,u3} v={v1,v2,v3} where $u$ and $v$ are two column vectors. I want to use $u\...
7
votes
1answer
147 views

Efficiently calculating matrix exponential of a recursively generated matrix

Given a matrix $A$ of size $N \times N$, I want to evaluate the function \begin{equation} F(t) = |\operatorname{Tr}(\exp(-i A t))|^2 \end{equation} as a function of $t$. Here, $A[n]$ is constructed ...
0
votes
1answer
42 views

How do I implement formulas within matrices? [closed]

I'm learning Mathematica through examples given in Engineering Vibrations by Daniel J. Inman. However, there is a huge mistake given in this bit of code offered: ...
1
vote
1answer
108 views

Symbolic matrix equation with summation

Considering a set of points: Let Matrix A be: And B: Where $\bar{x}$ is given by: And the same goes for $\bar{y}$ and $\bar{z}$. I want to solve this equation: But without specifying any values. ...
0
votes
0answers
23 views

Why Dimensions of an element of a matrix in not 1? [duplicate]

I was checking the dimension of an element of a matrix all the elements are symbols. I was expecting dimensions of an element to be {1,1}. But it is not Why? ...
10
votes
2answers
234 views

Solving “Lyapunov-like” equation AX+X'B=C

Is there some way I can solve the following equation with $d-by-d$ matrices in Mathematica in reasonable time? $$AX+X'B=C$$ My solution below calls linsolve on $d^2,d^2$ matrix, which is too ...
1
vote
2answers
75 views

Determinant of matrix with asymptotic expansion

i have determinant which each element have asymptotic expansion. $\begin{bmatrix}1+5/s+6/s^3+O[1/s^4] & 1+8/s+4/s^2+O[1/s^4]\\1+2/s+2/s^3+O[1/s^4] & 1-1/s+8/s^3+O[1/s^4]\end{bmatrix}$ ...
2
votes
0answers
87 views

Block diagonalizing a complex anti-symmetric matrix

I am going to evaluate the block diagonal form of few skew-matrices. When matrix elements are real I can simply follow the approach suggested in this thread which I have implemented that as ...
1
vote
2answers
191 views

How do you implement metric tensor in Mathematica?

I'm trying to follow several tutorials on metric tensors. One of the common exercises is a polar metric. I'm stuck trying to implement this in Mathematica. According to the derivation, the polar ...
0
votes
1answer
53 views

Convert input word into vector matrix

I wold like some help of converting an input (word or number or mix) into a single row vector, such as the following: If input is ">DAVID123<" I want it to be as {>,D,A,V,I,D,1,2,3,<} where ...
2
votes
1answer
94 views

How to RowReduce a sparse matrix?

I want to compute the reduced row echelon form of a sparse matrix, but RowReduce returns a dense matrix. Is there a build-in function that computes the reduced form ...
1
vote
1answer
95 views

(Row?) reduction of a system of equations

For a mathematical problem I am trying to solve, I have (say) $(N+1)$ inhomogeneous linear equations in $M$ variables of the form $$\sum_{a=1}^{M}c_{i a}p_{a} = \xi_{i} \quad \text{ where } i=1,\...
2
votes
1answer
59 views

How to remove curly brackets in a two dimensional array near the edges?

Suppose I have a matrix {{1,2,3},{4,5,6}}. I want to remove the curly brackets near the edges, i.e., I want an output as '{1,2,3},{4,5,6}'. Somebody please help me to solve it.
8
votes
1answer
316 views

Optimization of the following code

Consider the function $$ h:[-1,1]\times I_{\sigma}\to I_{\sigma} $$ $$ (\omega, x)\mapsto \sqrt[3]{x + \sigma \omega} $$ where $ \sigma > \frac{2}{3\sqrt{3}}, I_{\sigma} = [x_-(\sigma), x_+(\sigma)]...
0
votes
1answer
68 views

Selecting solutions that evaluate to positive

How to extract symbolic outputs of Solve that evaluate to positive at given values of parameters? For example, if ...
4
votes
3answers
204 views

Eigenvectors in the limit $ \mu\rightarrow 0 $ are not the same as eigenvectors when setting $ \mu=0 $ from the beginning

I would like to find the eigenvectors of a matrix and see what the eigenvectors look like in the limit of $ \mu\rightarrow 0 $: ...
0
votes
0answers
24 views

Find the max 2nd entry of a vector in a matrix

I need to find the max of the numbers found in the 2nd entry of the lists of (7 lists of 3 lists of 5 numbers ) So example would be a 3 by 5 matrix where element in the matrix has a list . And I ...

1
4 5
6
7 8
52