Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

-2
votes
1answer
55 views

solve Z of matrix [on hold]

x=Cz+(lambda)z x and z are n*1 column vectors C is n*n matrix (lambda) is a scalar it want to solve for z. the hint is z=Iz where I is n*n also C+(lambda) is an invalid expression, but C+(lambda)I ...
3
votes
3answers
490 views

Using Wolfram Alpha-syntax for transpose, etc

Consider this expression: {{0, 1}, {0, 2}, {0, 3}}*Transpose[{{0, 1}, {0, 2}, {0, 3}}] It returns an error in Mathematica but works perfectly fine in Wolfram ...
2
votes
1answer
86 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 ...
4
votes
3answers
242 views

Constructing Tri-Diagonal Matrices

Fractional Calculus Course, we are instructed to create an $n \times n$ Tri-Diagonal matrix in the form of: \begin{array} a A &= \begin{bmatrix} 2 & -1 & 0 & 0 & ... ...
-1
votes
1answer
34 views

How to create pairwise difference matrix entry?

I have a $16\times 1$ array of integer entries named $H$. How do I create a $16\times 16$ pairwise difference matrix between all entries in array?
1
vote
2answers
45 views

DiscretePlot3D: Part specification is neither a machine-sized integer nor a list of machine-sized integers

I want to plot a 3D histogram of a matrix and I am using this line: DiscretePlot3D[lmat[[x, y]], {x, 1, 3}, {y, 1, 3}, ExtentSize -> Full] where ...
8
votes
4answers
617 views

Verify Cayley-Hamilton Theorem

Consider the matrix: A = {{-1, -4, -2}, {0, 1, 1}, {-6, -12, 2}} Now, the characteristic polynomial is found: ...
1
vote
2answers
119 views

Are variables always assumed to be real in Jordan Decomposition?

If you give the following input in Mathematica 9.0 (Student Edition): JordanDecomposition /@ ({{1, #}, {#, -1}} & /@ {i, I}) Mathematica gives you two ...
5
votes
3answers
727 views

Complex conjugate

How do I complex conjugate a vector? ...
1
vote
2answers
327 views

What's the best way to generate all the upper triangular matrix whose singular values are given?

For example, given $\lambda_1 = 1, \lambda_2 = 2, \lambda_3 = 3$, what's the best way to generate all the upper triangular matrix ($3\times 3$) whose singular values are $\lambda_i$? Note:Given a ...
4
votes
1answer
282 views

Polar Decomposition

I'm new to Mathematica 10 (half-a-month user). I'm looking for a function of polar decomposition but for now I cannot find it. Can anyone tell me about related functions. Thanks in advance.
1
vote
0answers
71 views

Mathematica program for PLUR decomposition of a symbolic matrix using full pivoting

I wanted to ask if there is a Mathematica program for PLUR decomposition of a symbolic matrix M, such that M = P*L*U*R, using FULL (row and column) pivoting, and where R = reduced row echelon form of ...
6
votes
2answers
187 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
60 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
269 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
78 views

Calculating 15 coupled differential equations [on hold]

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
45 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
177 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
181 views

Analytic determinant of a sparse 25x25 matrix?

I would like to compute the analytic determinant of the following sparse matrix ...
2
votes
1answer
108 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
592 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
790 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
59 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
266 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
190 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
467 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
101 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
323 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
156 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
80 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
142 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
101 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
122 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
185 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
300 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
88 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
2answers
219 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