Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

0
votes
2answers
44 views

Enlarge a matrix and fill in zeros [closed]

Suppose I have a dynamically generated 4-dimensional matrix L in the shape shape={d1, d2,d3,d4}, and ...
2
votes
2answers
62 views

Reliably computing the signature of a matrix with small eigenvalues

When asked to compute the eigenvalues of the following matrix ...
4
votes
2answers
132 views

Extract part of a matrix

I have imported a matrix from a .txt file (it could be better from an Excel file): ...
2
votes
1answer
46 views

Interpret hexadecimal sequence as a binary matrix that can be used in AdjacencyGraph

I have a database of hex sequences stored as blob. Each of them is a binary matrix representing the adjacency matrix of a directed graph. I want to use the ...
1
vote
0answers
52 views

Calculating in the group ring $Q[GL_n(Z)]$

I am trying to use Mathematica to check some identities in the group ring $Q[GL_n(Z)]$. Is there a package/function of Mathematica to do this? Thanks a lot in advance!
4
votes
3answers
151 views

How to plot real roots of complex polynomials avoiding branch cuts?

Lets say I have the following matrix: M={{1,3+E^(I x),-1+2I x},{3+E^(-I x),2,E^(3I x)},{-1-2I x,E^(-3I x),-2}}; $$ M=\begin{pmatrix} 1& 3+\mathrm e^{ix} ...
3
votes
2answers
121 views

Take a specific part of a matrix imported from a .xls

i would like to know if there are any ways to link headings of a table i had imported with the data in the table itself. I imported a matrix from an excel file and i want to take a specific part of ...
-1
votes
1answer
87 views

Is it possible to colour only one column of a matrix? [closed]

I was wondering if it's possible to colour a column or a row in a matrix. For example is it possible to add colour for one of the rows/columns of the following matrixform code? ...
3
votes
3answers
207 views

How to convert an output of a matrix into a PNG image?

Using @m_goldberg's code I have created a matrix with the following command: ...
4
votes
2answers
615 views

Total Variation Distance of probability matrix

How can I calculate the Total Variation Distance of a transition Matrix? is there any built in function? I've searched all documentation and haven;t found anything. ** More information: Let me try ...
1
vote
1answer
2k views

How to take transpose of a one dimensional vector? [closed]

Why the two followings giving me same output? At least one should give me a row vector and another should give me a column vector. ...
3
votes
4answers
187 views

Pack Solve results into a vector

I am currently using a really easy function to get the eigenvectors of a corresponding eigenspace: ...
3
votes
1answer
54 views

Building a matrix in block matrix format

Now, I'm aware of the threads existing about this question such as: How to enter matrices in block matrix format? How to form a block-diagonal Matrix from a list of matrices? But I wasn't able to ...
1
vote
0answers
60 views

Exponential Matrix Diffentiation

I have been struggling with the following question while solving an optimization problem in $\mathbb{R}_{+}^G$. Basically, I have $$\min_{y \in \mathbb{R}_{+}^G} F(y) = y^{T}\mathcal{K} + \exp(-y^{T} ...
3
votes
1answer
55 views

Automatically discover the class of an arbitrary matrix

In Wolfram|Alpha it is possible to discover some specific classes to which a matrix belongs. For instance, typing this in Wolfram|Alpha ...
1
vote
1answer
56 views

Count and NMinimize don't seem to work together

Initially I write down a 2x2 unitary (Uni) , make a tensor product 4 times (LocalUni) and apply it to an initial numerical matrix Rho, to obtain RhoLU, that depends on 12 parameters. This is my code: ...
1
vote
2answers
91 views

Finding matrix given null space

Suppose I input a very large $n$ integer vectors and I wish to compute the matrix whose nullspace is spanned uniquely by these vectors. Is there an appropriate command/module to do this using ...
0
votes
1answer
55 views

How to merge 2 columnar matrices into a row matrix? [duplicate]

if i have two columnar matrices A,B . then how can i merge both matrices into a row matrix. ...
0
votes
0answers
41 views

How to combine two matrices.? [duplicate]

let A, B are any 4 by 2 Matrices , i want to know whether it is possible to obtain a 4 by 4 matrix by using equation A=B Thanks in advance
4
votes
2answers
123 views

How to be more efficient/faster with this MatrixExp-vector multiplication?

I am looking for expertise that helps to improve speed of the code below. First, a little bit of background: There is some system of differential equations $\dot{\vec{m}}(t)=S(t)\vec{m}(t)$. In order ...
2
votes
3answers
47 views

Assigning sections of a matrix to lists based on row value

I'm working with a very large (4x41355) matrix and I'm trying to make lists out of sections of rows based on the value in the fourth row. It's like this: ...
12
votes
2answers
3k views

Badly conditioned matrix (General::luc)

With some matrices, I am receiving the following message: ...
17
votes
2answers
182 views

Speeding up generation of block diagonal matrix

I'm struggling with the following problem. I have $48$ square matrices (full, filled with real machine precision numbers, thus are packed, all different) of size $128$. I wolud like to place them on a ...
9
votes
0answers
84 views

Efficient solution of huge sparse linear system

I'm trying to improve efficiency of my code in which main task is a solution to huge (~$10^4\times 10^4$) but sparse linear system $$Ax=b$$ (In fact my aim is to solve nonlinear equations $F(x)=0$, ...
0
votes
1answer
95 views

Getting mathematica to factor out constants and apply euler's identity to a table

I'm doing some quantum mechanics homework that I'm going to eventually generalize to higher spin states, so the solutions are going to need to be decently independent of the dimensions of the table ...
2
votes
2answers
80 views

Merge two trees into a rectangular matrix in Mathematica

How can I merge two trees, t and s, so as to form a square matrix below, where both trees starts from top-left (as shown), and ...
10
votes
7answers
243 views

Extract left-upper triangular data from a square matrix-form list

Hopefully, this question is not too basic or obscure. I'd like an idea on how to extract this {{1}, {5, 2}, {9, 6, 3}, {13, 10, 7, 4}} from ...
4
votes
0answers
47 views

How to transform a tree-form list to matrix-form list in Mathematica? [closed]

Excuse my naive question. Is there a quick/efficient way to transform {{1}, {1, 2}, {1, 2, 3}, {1, 2, 3, 4}} to a lower-triangular matrix-form ...
1
vote
0answers
48 views

Mapping over two indices with a condition

How can I use Map over two indices with a condition? I am trying to calculate second derivative of an eigenvalue, $\lambda_i(x)$, of $n \times n$ matrix $M(x)$ ...
4
votes
1answer
67 views

How do I put matrices next to each other? [duplicate]

So I want to be able to put matrices "next to each other", or in other words if I have two matrices $A$ that is $n\times k$ and $B$ that is $n\times m$, I want to be able to create a matrix $C$ that ...
2
votes
1answer
104 views

Is there a good way to check, whether a small value produced numerically is a symbolic zero?

I have a complicated 4x4 matrix and need to know the eigenvalues. I expect a zero eigenvalue for physical reasons. Giving numerical values first gives me an eigenvalue of $\mathcal O(10^{-15})$. Now ...
6
votes
1answer
88 views

Count degrees of freedom of a polynomial

I want to count the independent degrees of freedom of a polynomial in three variables $(z_0,z_1,z_2)$. Therefore I take the coefficients of $f$ and compute the rank Jacobian with respect to the ...
1
vote
0answers
55 views

Multivariate Path Construction using Sobol numbers

I am sharing my code,which I have tried to perform as per the instruction mentioned below. Please correct it so that I could get my output. Instruction: Use the first m dimensions of the Sobol vector ...
4
votes
4answers
104 views

How to force MatrixPlot to differentiate distinct expr?

I thought MatrixPlot can differentiate different expressions in color until I found this: ...
3
votes
1answer
120 views

Update or Animate an ArrayPlot or MatrixPlot?

I am trying to add new row or column or points to a 2D plot as I keep generating the values. The trick is by using this method I will not be required to store the big array or matrix and will be ...
1
vote
1answer
44 views
7
votes
2answers
289 views

Finding a unitary matrix in Mathematica

I have the following equation : $ \tilde{B} = U B U^{\dagger} $ I also know both $ B $ and $ \tilde{B} $ , I just want to find the matrix U, that gives me the transformation. I tried using ...
18
votes
1answer
414 views

Sparse Cholesky Decomposition

I am working with square matrices with a special form, which for large rank ($> 100,000$) would be best stored and manipulated as a SparseArray. I believe that ...
6
votes
3answers
221 views

How to create a general format of a matrix with specified entries?

I want to create a PNG picture of a matrix where its entries are the following: ...
1
vote
2answers
50 views

Bin data from an imported excel file by adding 5 elemets of y axis each [closed]

So i imported a file from excel and viewed it as a grid. but now i need to add groups of 5 elements from the y axis and plot them against every fifth entry from the x axis. Thanks Edit: Sorry about ...
1
vote
0answers
124 views

Speed matrix multiplications

I am trying to run this function ...
10
votes
3answers
424 views

How do you concatenate matrices? And how do you make block matrices?

This is pretty trivial to do in Matlab, but I have not seen a function for it in Mathematica. Here is how you can do it with Join and ...
2
votes
1answer
154 views

Eigenvectors of numerical matrix

I have a large numerical matrix whose eigenvalues are all distinct. In the documentation for Eigenvectors it says: For approximate numerical matrices m, the ...
1
vote
0answers
44 views

matrix multiplication performance

I would like to evaluate $$ f(x,y)=\sum_{i=1}^{N} X_i(x)\,Y_i(y) $$ where $X_i(x)$ and $Y_i(y)$ are known functions for all $i=1,\ldots,N$, and $x$ and $y$ are from the rectangle $[0,A]\times[0,B]$, ...
0
votes
0answers
81 views

LU factorization

Basically what I need to do is this: Write an algorithm that finds the LU factorization of the following matrix. The algorithm should perform the necessary elementary row operations to reduce A to U, ...
3
votes
1answer
32 views

Difficulty with LevelSpec. Product of empty set should be 1

I have a matrix newm = {{{}, {}, {-p}}, {{d}, {e}, {p}}, {{g}, {h}, {i}}}; MatrixForm[newm}; whose elements are lists. I would like to multiply the elements of ...
2
votes
3answers
64 views
9
votes
7answers
258 views

Custom Matrix product

I have a list: list1 = {{{a1, a2, a3}, {b1, b2, b3}}, {{c1, c2, c3}, {d1, d2, d3}}}; I want an operation that gives me: Is there a built-in way of doing ...
4
votes
1answer
172 views

What is the Mathematica equivalent for corr2?

What is the Mathematica equivalent for MATLAB's corr2, which gives the correlation coefficient of two 2D matrices?