Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

0
votes
2answers
49 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 ...
0
votes
1answer
41 views

Tolerance of PositiveSemidefiniteMatrixQ [closed]

I believe the following should be True but returns False for me: ...
2
votes
2answers
71 views

Reliably computing the signature of a matrix with small eigenvalues

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

Extract part of a matrix

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

how can i associate the headings of columns/rows with content of itself and then recall what i want after i've imported the excel file in mathematica

Hello, i make another try... I have to import a file like this below (it is an excel file, i show you just the beginnig. it should have thousend of rows and columns). After i've imported the file i ...
2
votes
1answer
57 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
58 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
170 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
129 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 ...
15
votes
5answers
549 views

A quicker than outer

I need to get a matrix $\{a(x_i-x_j)\}$, where $x_i$ form a partition of an interval, $a(x)$ is a given function. I use ...
-1
votes
1answer
89 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? ...
2
votes
5answers
379 views

Create a Pascal Matrix

I am trying to write a function that can create a Pascal matrix. So far I have ...
4
votes
1answer
64 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
62 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} ...
1
vote
2answers
97 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
68 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. ...
1
vote
1answer
60 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: ...
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
2
votes
3answers
48 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: ...
10
votes
0answers
111 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
131 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
85 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 ...
18
votes
2answers
205 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 ...
10
votes
7answers
263 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
51 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
50 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
75 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
163 views

Simple code to write differential equations in a matrix formulation

Is there a simple code to transform the following differential system equations : ...
2
votes
2answers
72 views

Problem with ArrayFlatten to concatenate matrix

I would like to concatenate 2 matrix : - the first which is a line of 2 elements - the second which is a matrix of 2-2 elements I use the following code : ...
7
votes
1answer
91 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 ...
4
votes
2answers
145 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 ...
1
vote
0answers
63 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 ...
3
votes
1answer
146 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 ...
4
votes
4answers
106 views

How to force MatrixPlot to differentiate distinct expr?

I thought MatrixPlot can differentiate different expressions in color until I found this: ...
1
vote
1answer
52 views

NMinimize error

I want to use NMinimize in the following way: ...
3
votes
3answers
244 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: ...
18
votes
1answer
473 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
236 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
54 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 ...
7
votes
2answers
375 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 ...
1
vote
0answers
126 views

Speed matrix multiplications

I am trying to run this function ...
11
votes
3answers
487 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 ...
1
vote
0answers
46 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]$, ...
3
votes
1answer
34 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 ...
0
votes
0answers
132 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, ...
1
vote
2answers
136 views

Row-wise matrix multiplication

I have a matrix $A=\{a_{ij}\}$ of dimensions $n$ rows by $m$ columns, and I would like to multiply each row of the matrix by a constant $b_i$, $i=1,\ldots,n$, and store the result in the same ...
4
votes
1answer
225 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?
1
vote
0answers
49 views

Sampling from an one-dimensional Wishart [closed]

I searched for a similar question but could not find one. My problem is sampling from an one-dimensional Wishart distribution. The Mathematica specification is ...
4
votes
1answer
118 views

Is it possible to find the vectors that span the nullspace of a large, symbolic matrix

My problem is composed of two parts, a large sparse matrix $L$ ($m$x$n$ where $m=10^3$, and $n=10^5$, with $10^7$ non-zero complex numbers), and a dense, symbolic matrix $F$ ($m$x$m$ where $m=10^3$), ...