Questions tagged [matrix]

Questions on the manipulation of matrices in Mathematica.

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

Solve 16x16 matrix equality with non linear combination of variables on one side and reals on the other

I am trying to solve the following problem: $A = B$ where $A_{bis}$ is a symmetric 16x16 matrix of numbers and $B$ is a symmetric matrix of variables. $B$ definition To define $B$, I first define $Y$...
0
votes
0answers
13 views

How to minimize the eigenvalues of a hermitian matrix?

Suppose I have a complex hermitian matrix, M[x_,y_] whose eigenvalues must be real.I tried to minimize the first eigenvalue by writing following command:f[x_,y_]:=Eigenvalues[M[x,y]][[1]]; Minimize[f[...
1
vote
0answers
25 views

MatrixForm a product of matrices [on hold]

I was hoping that MatrixForm[SingularValueDecomposition[{{1, 2}, {3, 4}}] ] would neatly display the singular value decomposition of a matrix in the form of a ...
0
votes
2answers
62 views

Matrix equation solving

I am new to Mathematica and I try to apply the solution given to this problem. So I have: $$A = \begin{pmatrix}50 & 3 & 10 & 2\\\ 3 & 60 & 7 & 1\\\ 10 & 7 & 55 & 4\...
1
vote
0answers
49 views

How can I evaluate a symbolic matrix [on hold]

For example if I have: Matriz = {{a, b}, {c, d}} Matriz2[a_, b_, c_, d_] := Matriz; when I run Matrix2 [1,2,3,4], the matrix is not evaluated. I would not like ...
2
votes
2answers
73 views

How to generate vectors with programming

I want to generate all possible vectors programicaly with entrys in $\Bbb Z_4$: $$A_j:=\begin{bmatrix}x_1\\ x_2\end{bmatrix}, \qquad x_i\in \{0,1,2,3\}, j=1,2,\cdots 16.$$
1
vote
0answers
28 views

Problems with the parametric Recurrence Table

I am trying to construct a minimization program where I have to minimize a function with respect to a matrix. This matrix enters into the optimization program in a convoluted manner together with data....
2
votes
2answers
81 views

rule-based element selection from a matrix

For simplicity, I give a (3,3) matrix below, though my matrix is of a larger dimension. My objective is, after some matrix manipulations, to select Maximum element(s) in a row and a column, and place ...
4
votes
1answer
53 views

find a maximum parameter for a range of target eigenvalues as a function of matrix dimension

I have a symbolic tridiagonal matrix of this form ...
3
votes
2answers
898 views

Two matrices that are not similar have (almost) same eigenvalues [closed]

I have two matrices $$ A=\begin{pmatrix} a & 0 & 0 \\ 0 & b & 0 \\ 0 & 0 & c \end{pmatrix} \quad \text{ and } \quad B=\begin{pmatrix} d & e & f \\ d & e &...
0
votes
1answer
34 views

diagonalisation of systems of symbolic equations from two cross products

A description of what I'm attempting: Given a generic vector $\vec{r}$ and a point in space $D$, I want to build a reference frame centred in $\vec{r}= (x,y,z)$, with one axis directed along the ...
8
votes
1answer
128 views

Getting scores from PCA

I'm not super familiar with Principal Component Analysis, but from what I understand, it sorts a vector in order of decreasing variance, and uses that to transform the vector to correlate variables ...
0
votes
0answers
37 views

Improve speed of NIntegrate for functions which are sums of complex exponentials

I need to improve the efficiency for numerically evaluating a matrix element, which uses NIntegrate of the several functions (which are all sums of complex exponentials). Creating the functions from ...
0
votes
0answers
44 views

What row do I change to make my determinant non zero?

I wish to make a matrix that has an inverse. I need rows that look like oscillating functions so I decided to base my matrix on ChebyshevT. This code makes an n by ...
7
votes
4answers
88 views

Take $ n^\text{th} $ sub-list with equal distances

I have been looking at Span, Take, etc. functions but I couldn't figure out how can I extract elements likes this ...
5
votes
0answers
66 views

Finding the null space of a large sparse matrix

I am trying to compute the null space of a large $n\times n$ sparse matrix. No matter how large the dimension of the matrix is, it will always look like as below: The figure on the left shows the ...
2
votes
3answers
75 views

How to use Array[] to evaluate block-diagonal matrix at different values

I would like to construct a diagonal matrix that is defined as a function and put it multiple times in a block-diagonal matrix each block evaluated at a consecutive integer. Let's say my matrix looks ...
2
votes
2answers
209 views

How to stack multiple matrices?

I have a matrix 'mat' and I would like to stack it k times $$\begin{pmatrix} mat \\ mat \\ mat \\ mat \\ mat \\ \vdots \end{pmatrix}$$ such that the result is also a matrix. I tried Join and ...
3
votes
2answers
748 views

Problem with Eigenvectors

When I want to calculate eigenvectors of the following matrix in Mathematica the only answer it gives me is zero vector, anybody knows how to fix this? here's my matrix : \begin{equation} X=\left(\...
0
votes
0answers
36 views

Definition of a matrix [duplicate]

...
0
votes
0answers
49 views

Creation of a matrix

I would like to write the matrix v[s_,ss_,qi,qj] :=( {{a/(2 r) DiracDelta[s - ss], a/r(HeavisideTheta[(s - ss) + r] - HeavisideTheta[(s - ss) - r])}, {a/r(HeavisideTheta[(s - ss) + r] - ...
0
votes
1answer
119 views

Can I diagonalize a 512 by 512 matrix? [closed]

...with Mathematica? Or is this going to be impossible? I don't want to start work if it is hopeless. I've already solved the problem on a smaller scale, which involved an 8x8 matrix. ...
0
votes
1answer
35 views

How to plot multiple functions in a graph with different colors?

I have a general {i,x,y} dimensional matrix, and I want to plot all "i" {x,y} matrices in one graph. How can I do it in a way that I can still distinguish each "i"th curve from the other (I mean ...
0
votes
1answer
58 views

How to carry a matrix in algebric form under “set delayed”

I have a small query and a related problem regarding the working methodology of Mathematica under set delayed/Do functions. Here is a simplified version of my problem. ...
5
votes
1answer
78 views

Find position equal columns of matrix

Consider the following rectangular matrix M = {{1,1,1,1},{2,2,4,4},{3,3,5,5},{9,9,3,1}} I would like to extract the position of equal columns. Is there a simple ...
0
votes
0answers
34 views

How to work with a $k$x$k$ matrix with $k$ undefined?

I have the following $k$x$k$ square matrix m: ...
1
vote
1answer
22 views

Eigenvalues and inverse of matrix which has matrix entries

Suppose I have a $2\times2$ matrix which contains $2\times2$ matrices as entries, is there a clean way to find the inverse of such object and compute its eigenvalues/vectors? My code is ...
1
vote
0answers
30 views

Simulating Stochastic Matrix Differential Equation with Arbitrary Autocorrelation Function

I want to numerically simulate a matrix differential equation that includes a stochastic (vector) Gaussian noise $\mathbf{n}$, where the different vector components are independent, and each component ...
5
votes
4answers
212 views

Manipulate a list: replace random position of a specific integer n times by 0

I have this matrix with 3 sublists: d = {{1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0}, {0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1}, {0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0}}; For ...
0
votes
0answers
34 views

Matrix Vector multiplication [duplicate]

I have a rather simple question which surprisingly i could find the answer theres a matrix $U $ whith is $4*4$ and a vector $A$ which is $4*1$ and when I wand to multiply them by $U.A$ operator i get ...
9
votes
3answers
394 views

Create Array from list of indices/values

Is there is a performat way to convert something like {{0,0},a},{{0,1},c},{{1,0},d},{{1,1},e} into {{a,b},{c,d}} The ...
0
votes
0answers
36 views

How to save a all matrices renewed in each iteration?

I have a (n by m) matrix , in which the elements are recalculated and replaced by new ones in each iteration. (In other words I have a loop in which the elements of the mentioned matrix are being ...
7
votes
2answers
162 views

Multiply vectors in a matrix by a matrix

I have a matrix of vectors e.g. mat1 = Table[Table[RandomReal[1], 2], n, n]; which is actually a matrix of cartesian coordiantes ...
5
votes
1answer
53 views

MatrixConditionNumber does not work in version 12.0

A = {{1., 0.}, {0., 2.}}; LinearAlgebra`MatrixConditionNumber[A]
17
votes
1answer
371 views

Efficiently defining a SparseArray function

I've got a fairly large SparseMatrix (~60,000 entries in a ~10,000-by-10,000 matrix) that depends on two parameters (im1 and <...
7
votes
3answers
571 views

How to convert diagonal matrix to rectangular matrix

Suppose you have the following diagonal matrix: $\left( \begin{array}{cc} a & 0 \\ 0 & \{b,c\} \end{array} \right)$ How can the above matrix be converted to the following rectangular one?...
1
vote
1answer
33 views

Identification of linear combinations in a matrix

I have a matrix R which is having a dimension of 20 cross 20. When I extracted the rank of this matrix I got 16. I just wanted to which are these four rows are or columns which are dependent on each ...
1
vote
1answer
65 views

Phase choice for Singular Value Decomposition

I'm using SingularValueDecomposition to find the unitary matrices that diagonalize a given matrix (that I have). This decomposition is unique, up to multiplication for an arbitrary phase of each ...
9
votes
5answers
1k views

How can I define a very large matrix efficiently?

Here's a 7x7 matrix: ...
0
votes
0answers
54 views

Matrix transformation

Let an expression $X^T AX+B^TX$, how can I transform it as $Y^T C Y$; where $Y=[X, 1]$, find $C$ in terms of $A$ and $B$ using Mathematica?
0
votes
0answers
38 views

Why doesn't this evaluate further [duplicate]

The figure above shows the code as typed into Mathematica. In the fourth last line (or In[15] as you prefer) the expression is not evaluated to the fullest extent possible. Why does this occur? I ...
1
vote
1answer
57 views

Inverse matrix not computing [closed]

Hi just wondering why my Inverse of matrix will not compute? I don't believe its wrapped from //MatrixForm because I copied it by hand into a new document and it still would not work. Any ides? ...
4
votes
2answers
117 views

How to import latex matrices into Mathematica?

I have a lot of $\LaTeX$ matrices, and I want to find their eigenvalues and eigenvectors. I tried to import them to Mathematica with: ...
1
vote
0answers
25 views

Computing the invariant factors of a sparse matrix

Let M be a sparse $n\times m$ integral matrix, where $nm$ is very large. The goal is to compute its invariant factors. The naïve approach ...
1
vote
2answers
59 views

Error in Assignment

I want to create a matrix with each element updated as per the formula, whose inputs are dependent on the location of element in the matrix. ...
0
votes
0answers
44 views

Solving a system of linear equations with complex unknown

I am trying to solve the system of equations which is given by $ABA^*=-B$, where A is $2\times2$ matrix, $A^*$ is a conjugate transpose of $A$ and $B$ is a $2 \times 2$ unitary matrix. Entries of both ...
6
votes
3answers
643 views

List Manipulation : {{{a,b},{c,d}},{{e,f},{g,h}}} into {{a,b},{c,d},{e,f},{g,h}}

Hi I'd like to transform the matrix : ...
0
votes
0answers
32 views

How to reduce large matrix to a multidimensional matrix?

I have a large matrix $h$ with dimension $N_x N_y\times N_x N_y $. it is related to matrix $a$ by this formula,where $i,i_1=1..N_x$ and $j,j_1=1..N_y$. ...
7
votes
1answer
75 views

SparseArray: how to efficiently extract/delete many entries?

This is a follow-up of this question. We have a large $m\!\times\!n$ matrix stored as a SparseArray a and a list of positions pos...
0
votes
0answers
33 views

FullSimplify does not simplify at all

I have some problems simplifying things with FullSimplify. Suppose a matrix ...