Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

3
votes
2answers
140 views

$\mathbf L\mathbf D\mathbf L^\top$ Cholesky decomposition

Mathematica can do a Cholesky decomposition $\mathbf A = \mathbf L\mathbf L^\top$, but how do I do a LDL decomposition $\mathbf A = \mathbf L\mathbf D\mathbf L^\top$, with $\mathbf L$ being a unit ...
0
votes
0answers
57 views

Is tensor argument passing to module expensive?

I wrote a simple module which is supposed to do recursive computation, however it turns out to be expensive even for 300 points. I am not sure why is it slow, all the computations seem to be ...
2
votes
2answers
261 views

Logarithm of a matrix in base 2?

Mathematica provides the built-in command MatrixLog, which operates on a square nonsingular matrix, but it returns the natural logarithm. How can I find the base 2 ...
0
votes
0answers
74 views

Calculating 15 coupled differential equations

I have 15 coupled differential equations linear in time that need to be solved. Rewriting the equations in a matrix form, they can be expressed following as a single equation, $\frac{d ...
0
votes
0answers
44 views

How to find multiplication of all elements in a 3d matrix?

Here's my input. It's a 15x4 matrix of 3x3 matrices (In other words a 3d matrix): ...
4
votes
2answers
171 views

Maximization in Mathematica using matrix and vector notation

I am trying to solve a simple maximization problem in Mathematica, using matrix and vector notation. ...
8
votes
2answers
180 views

Analytic determinant of a sparse 25x25 matrix?

I would like to compute the analytic determinant of the following sparse matrix ...
2
votes
1answer
106 views

When are sparse arrays effective?

Sparse arrays are not effective in Mathematica 10. More computational time is needed to perform arithmetic operations on sparse arrays. Their size is also bigger than normal arrays. Here is a simple ...
5
votes
3answers
590 views

Multiply each element of an array by another array?

I would like to multiply an array by each element of another array, and am having a lot of trouble finding a built-in or automated method of doing. Here is an example of what I'd like to achieve: ...
0
votes
0answers
20 views

Matrix Multiplication and Product [$f$, {$i$, $i_{min}$, $i_{max}$}] [duplicate]

I tried the command Product[f, {i, i_min, i_max}], where $f$ is a matrix here, as a shorthand for a product of arbitrarily many matrices with elements parametrized ...
3
votes
1answer
71 views

Evaluating the product of a matrix sequence [duplicate]

I want to compute $$ \prod_{i=1}^n A_i = A_1 A_2 \cdots A_n $$ where every $A_i$ is a square matrix. When I execute ...
1
vote
0answers
102 views

How to find matrix exponential using RootSum? [duplicate]

From what I've been able to deduce, Mathematica uses a root sum scheme to determine the exponential of a matrix. Can someone please explain to me the theory behind this? I've searched, but have had no ...
19
votes
5answers
780 views

Can (compiled) matrix permanent evaluation be further sped-up?

Update III  Mathematica 10.2.0 now ships with a predefined System`Permanent function, which the PermanentCode package ...
0
votes
1answer
58 views

Element assignment in matrix function

I have to define a function of two variables that yields a high dimensional matrix, with each entry containing a scalar function, that uses its coordinates in the matrix as input. like this: ...
6
votes
2answers
263 views

Matrix exponential via Cayley-Hamilton Theorem

I'm attempting to calculate the exponential of a matrix via Cayley-Hamilton theorem. (Following the "concrete example" from http://en.wikipedia.org/wiki/Cayley%E2%80%93Hamilton_theorem) I am having ...
0
votes
2answers
57 views

LUDecomposition for non-square matrices

How do we go about finding the LUDecomposition for non-square matrices. When i try to input the standard LUDecomposition ...
3
votes
0answers
90 views

Calculating eigensystem of a matrix containing very small numbers [duplicate]

I'm dealing with a matrix containing very small numbers like 10^(-370). When I compute the eigensystem of my matrix, it takes too much time, though the matrix size is not large. Can anyone explain ...
1
vote
0answers
115 views

Lens profile in a grid [closed]

So I have a FDTD code which works well. The propagator of the code itself is: ...
1
vote
4answers
117 views

Do not expand matrices in Mathematica calculation

Here is an example of a problem I'm having. Consider that I have defined: omega={{p[t]},{q[t]},{r[t]}} x={{a},{b},{c}} R={{1,2,3},{4,5,6},{7,8,d}} What I would ...
11
votes
2answers
186 views

Fastest way to sum the upper triangle

I feel like this is an recurring question: if there's a symmetric matrix whose diagonal is not all 0, how could I get the sum of the part of it that's above the diagonal as fast as possible? Small ...
15
votes
3answers
463 views

Compiling LinearSolve[] or creating a compilable procedural version of it

Earlier today I had a discussion with a representative at Premier Support about the 2 questions I've asked here over the past couple of days: Seeking strategies to deploy a function securely ...
3
votes
1answer
100 views

updating matrix elements based on a condition

I am (still) fairly new to Mathematica and trying to perform some operation on the matrix elements, say for the matrix ...
3
votes
0answers
135 views

The CorrelationMatrix is equal to corrcoef of Matlab?

How can I generate a matrix which is equivalent to the results of the "correlation coefficients" command (corrcoef) in Matlab? When I make a LinearModelFit, I can get a CorrelationMatrix, but is this ...
10
votes
1answer
322 views

Is it possible to implement symbolic sub matrices?

The accepted answer in the question Symbolic matrices in Mathematica with unknown dimensions provides a functionality to create symbolic matrices which behave pretty much as the name suggests. ...
0
votes
2answers
152 views

Block matrix definition and inversion

I would like to define the following block matrix $$ A=\begin{bmatrix} H-G_1 & -G_1 & \ldots & -G_1 \\ -G_2 & H-G_2 & \ldots & -G_2 \\ \vdots & \ldots & \vdots & ...
2
votes
1answer
79 views

Recursive computation using Piecewise

I am trying to create an array using a series of equations using Piecewise. I am stuck in one of them. I am just putting a simplified version of code as below. I ...
0
votes
1answer
138 views

Finite Field matrix rank calculation

How does one define a matrix over $\mathrm{GF}(p^r)$ in Mathematica in order to compute rank? I am working with $\mathrm{GF}(2)$?
2
votes
2answers
98 views

The Chart of Matrix Eigenvalues : Energy Levels

There is the possibility that this question may have been asked previously, but as we are unfamiliar with the nature of the chart below, we hope to seek a response to this query. Consider a matrix as ...
11
votes
1answer
117 views

Nearest Kronecker Product

Some people (see The ubiquitous Kronecker product by Van Loan) have worked on finding two matrices $\mathbf A$,$\mathbf B$ of specified size whose tensor product $\mathbf A\otimes\mathbf B$ is closest ...
5
votes
3answers
181 views

How to simplify symbolic expressions with KroneckerProduct

Having $X,Y$ being symbols for matrices, I was wondering if there is a way to simplify expressions like KroneckerProduct[X, X] + KroneckerProduct[-X, X] to ...
8
votes
3answers
297 views

How to build a matrix from a set of vectors and other matrices using ArrayFlatten

I want to build a 6 by 3 matrix, from the following: one vector is 3 by 1, then a matrix, which is 3 by 2. These will go to the top 3 rows. Now the bottom 3 rows, I'll have 3 vectors each is 3 by 1. ...
0
votes
1answer
45 views

Eigenvalues and Eigenvectors Order [duplicate]

Say I have a list of eigenvalues and eigenvectors produced from a matrix $M$ using the command {eig1,eig2}=Eigensystem[M], which will return the eigenvalues with ...
0
votes
1answer
34 views

Variable Definitions and Random Numbers [closed]

I have currently created the following matrix: m={{RandomReal[{0,1}],RandomReal[{0,1}]},{RandomReal[{0,1}],RandomReal[{0,1}]}} In other words, a $2 \times 2$ ...
2
votes
3answers
87 views

How to compare and remove x-coordinates (and the associated y-coordinates) that are less than previous x-coordinates?

I am using Mathematica version 9.0 and am trying to compare and remove x-coordinates, and the associated y-coordinate, that are less than previous x-coordinates. Below is an example using sample data. ...
5
votes
3answers
701 views

Complex conjugate

How do I complex conjugate a vector? ...
5
votes
2answers
217 views

delete zero rows in a matrix

If there is a matrix with some of its rows equal to zero: (its zero rows are randomly distributed and does not have an ordered arrangement): same as: ...
1
vote
1answer
47 views

Matrix issue with NDSolve

I am solving a differential matrix equation with NDSolve. ...
0
votes
1answer
48 views

Issue with Differentiation over a tensor

I am new user in Mathematica. I am working with liquid crystal theory, and one of the notation there is the tensor: $ \Pi_{ij} = \frac {\partial {F_{el}}} { \partial ( \partial {n_i} / \partial { ...
6
votes
2answers
180 views

improving sequence dot operator for matrix rows and plot of Norm-imaginary

I have written a code to Dot a row (conjugate of that) of mm to the next one: ...
0
votes
1answer
84 views

Orthogonalization is not commutative!

I get stuck into a problem: I am going to produce orthogonalized eigenvectors of a matrix and in any iteration. I shortened my question in the bellow line: Why do we face to different results of ...
4
votes
2answers
97 views

Reading from a file: complex number with small imaginary part

I'm trying to read a matrix from the next file: 1+1e-18i 24 42 23.43e-23i using u=Import["file.dat","Table"]; and then find, ...
1
vote
0answers
53 views

Simplest use of transpose given a vector and a matrix [closed]

Suppose that I have: x = {1, 1}/Norm[{1, 1}]; A = {{1, 2}, {2, 1}}; What is the simplest way of calculating $x^T A\ x$? And are there symbols on any of the ...
3
votes
1answer
46 views

Saving Dot-ed eigenvectors in a special comparison

We have produced a 4*4 matrix in any iteration containing nx from 0 to 2 by steps of 0.5. and in any iteration we have saved sorted orthogonalized-eigenvectors based on their eigenvalues with this ...
1
vote
0answers
105 views

MatrixExp of a complex matrix of size about 10000 by 10000 [closed]

I want to apply MatrixExp of a numerical, complex matrix of size about 10000 by 10000, and I also need high precision as I need to multiply several such matrices. ...
8
votes
2answers
139 views

Difficulty using LUDecomposition

I'm having trouble using LUDecomposition with pivoting. I read the Mathematica help on this particular command, but I'm still lost. Take a matrix like: ...
0
votes
0answers
49 views

Solving matrix optimization

I have the following problem. Let $X_1, X_2, \cdots, X_k$ are $n \times n$ Hermitian matrices (need not be positive) given. Let a $n \times n$ positive matrix $A$ is given such that $Tr(A.X_j)<0$ ...
7
votes
2answers
175 views

Why is mathematica eating a row from QRDecompostion

I'm attempting to calculate the QRDecomposition of the matrix: a= {{1,3},{0,5},{2,-8}} QRDecomposition [a] The answer mathematica gives me is: - Q which is a ...
1
vote
1answer
55 views

calculate relationship between cause and effect (rows/columns/delta etc.) on tableform

I tried to enter this Excel (on the right of the picture) information to program. following these codes has been used: ...
5
votes
1answer
94 views

Efficient upsampling of multidimensional array

I would like to efficiently upsample a multidimensional array. It's a 5000*5 matrix where each element is a submatrix 12*12 and it is that 12*12 matrix I want upsampled (to 24*24). The upsampling ...