Questions on the manipulation of matrices in Mathematica.

learn more… | top users | synonyms (1)

8
votes
3answers
391 views

Multiply a list of matrices by a list of vectors

How does one multiply a list of matrices by a list of vectors, elementwise? For example, multiplying ...
8
votes
1answer
191 views

inverse of abstract matrix

If you assume the matrix $A$ is invertible, then $A^{-1} \cdot A = I$. Is there an assumption for invertibility in Mathematica 9? How can one make the following evaluate to the identity matrix $I_3$? ...
3
votes
3answers
235 views

How to transform and swap columns of this matrix in a simple way? Version 2

So, earlier today I asked the question How to transform this matrix & swap its columns in a simple way? and was given useful and elaborated answers. Now, I'm still not used to the "Array", ...
3
votes
4answers
343 views

How to transform this matrix & swap its columns in a simple way?

I would like to transform matrix $\mathbf A = \begin{pmatrix} a&b&i&j\\ c&d&k&l \\ e&f&m&n \\ g&h&o&p \end{pmatrix}$ into matrix $\mathbf B = ...
2
votes
1answer
196 views

Can I reduce a matrix inequality such as $\mathbf x^\prime\mathbf A\mathbf x > \mathbf x^\prime\mathbf x$?

I'm new to Mathematica. When I do linear algebra, I wonder if I can have an inequality such as $\mathbf x^\prime\mathbf A\mathbf x > \mathbf x^\prime\mathbf x$, where $\mathbf x$ is a column vector ...
0
votes
1answer
152 views

Discrete 3D plots of median ratios of two 2D matrices of lists of values

Lets say I have 2 2D arrays where each cell contains a list of values: Example: ...
0
votes
0answers
47 views

Inverting a matrix [duplicate]

Possible Duplicate: Why does MatrixForm affect calculations? I am facing a strange behaviour from Mathematica when asking it to invert the following matrix: ...
2
votes
2answers
200 views

How can I shift the frame ticks to the corner of each element-cell in a Matrixplot?

I am using the following code,to create a Legend for my plot. I would like to shift (or re-position) the frameticks to the corner of each of the cell-elements instead of being in their middle. I ...
3
votes
1answer
144 views

Efficiently finding the maximum value of a column in a matrix

Imagine I have a matrix of the following form: TestArray = $((a_1,b_1,...),(a_2,b_2,...),(a_3,b_3,...),...)$, where a specific example might be: TestArray = ...
1
vote
3answers
350 views

More than one expression in the Table[] command?

I would like to construct a Matrix using the Table[] command. The issue is that I would like to use more than one expression for it. What I need to obtain is something like this : ...
5
votes
1answer
201 views

How to define and compute various properties of a variable size matrix

I have a rather simple question, but I have not been able to figure out how to implement a solution in Mathematica. I would like to define a variable size square matrix, say an N x N matrix A, whose ...
0
votes
0answers
69 views

Trying to access element of a matrix [duplicate]

Possible Duplicate: Question about MapThread and Dynamic I'm trying to extract element of a matrix. Let's suppose that the matrix is ...
3
votes
2answers
319 views

Dynamic matrix multiplication

I have the following problem: I want to multiply two matrices and sum them to another matrix C. A.B+ 2B Easy! The matrix A varies as a function of three inputs a,b and c. The second matrix, B, is a ...
0
votes
3answers
383 views

How can I fill in a matrix at every iteration of a Do loop?

I have a matrix whose dimensions are 26x26x3. For my assignment I have written a program which is using a Do loop (maxx=maxy=10,maxz=2): ...
0
votes
2answers
207 views

How to get a sub range of a larger matrix?

This should be an easy question but I only found a partial solution using All. Say I have a matrix A = 1000 x 5, how to get only a part of that matrix, say B = n x ...
10
votes
2answers
305 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 ...
8
votes
2answers
251 views

Correct way to generate large data sets (i.e.forward yield curve )

I would like to generate a set of forward yield curve matrix of size 1000 x 100. First I defined my SparseArray of 1000 x100: ...
0
votes
2answers
119 views

Matrix conditional operation

Say I have a matrix of: tmp1 = 5; tmp2 = 5; tmp3 = RandomChoice[{0, 1, 2, 3, 4, 5}, {tmp1, tmp2}]; MatrixForm[tmp3] How to do a conditional operation of elements ...
1
vote
1answer
101 views

How can I find the row differences of a matrix?

How can I compute the row differences of an m x n matrix to obtain an m-1 x n matrix; that is, given how do I obtain
3
votes
3answers
292 views

Correct way to populate a DiagonalMatrix?

I would like to create a series of correlation matrices that starts with : sensMat[[1]] = DiagonalMatrix[ { 1,1,1,1,1 } ]) // MatrixForm and iterates in 0.1 ...
5
votes
1answer
983 views

Problem with plotting eigenvalues

I want to plot the eigenvalues of a matrix which is dependant on a parameter (well, actually I want to plot a tight-binding electronic band structure). The dimension of the hamitonian matrix is ...
1
vote
3answers
708 views

How do I combine the data from two tables according to a rule of my own devising?

I have two matrices a = m x 5 and b =m x 5 (m is large, say 1,000) which are already sorted as below: How to generate a new matrix c = m x 5 which consists: Column 1: exact replica of Column 1 ...
-1
votes
2answers
344 views

Correct way to compare arrays and do conditional evaluations

I would like to compare two arrays a=: and b= and get: using: (b/.(b_?Positive->a+b))//MatrixForm but this doesn't seem to work? Can ...
0
votes
3answers
719 views

Correct way to remove matrix columns?

I start off with m = 1000 x 5 matrix, and I would like to remove first column to get 1000 x 4 matrix and repeat again for ...
-2
votes
1answer
118 views

Can Depth be used as an equivalent for MatrixQ?

Given an expression x, are the following two statements interchangable with no exceptions? Depth[x] - 1 == 2 ...
-1
votes
1answer
385 views

How to efficiently fill in matrix values?

I would like to efficiently fill in or assign values to matrix m: m={ {a[1,1],a[1,2],a[1,3],a[1,4]}, {a[2,1],a[2,2],a[2,3],a[2,4]}, {a[3,1],a[3,2],a[3,3],a[3,4]}, ...
2
votes
3answers
201 views

MatrixForm explanation as why row extract is displayed as a column?

I have a 5 x 5 matrix: cdsSpread5yrs = But after doing a row extract, why is it displaying as a column? ...
9
votes
2answers
783 views

How to transform a 3D image by an affine transformation matrix

I have a question concerning Image Processing: I have a stack of images, which I can compose to a 3D image using Image3D. Additionally I have a 4x4 affine transformation matrix. I would like to ...
0
votes
2answers
361 views

Matrix Plot – Little Exercise

Hi there, mathematicians. I'm not very good at coding plots in Mathematica, so I was hoping that one of you could help me solve a problem I'm having. I have the following matrix plot: ...
4
votes
2answers
548 views

Exact cover solution

Is it possible to get a exact cover solution(s) and/or number of possible solutions in Mathematica?
3
votes
3answers
187 views

Need Help Writing (a Pascal) Matrix in Mathematica

I want to write a function $f[n]$ in Mathematica which gives me an $n\times n$ lower triangular Pascal matrix with a row of zeros in between each nonzero row. That is, I want the matrices ...
9
votes
1answer
257 views

Verifying and deriving basic (block) matrix identities

How can I use the new symbolic matrix/tensor capabilities to verify matrix identities, such as (1) or (2) Even better, how can I ask Mathematica to derive expressions for X, Y, Z, and U like ...
5
votes
2answers
399 views

Sort matrix by columns and rows without changing them

I would like to sort a matrix in descending order first by the total of each column, then by the total of each row, but without changing their content. For example, if I had: ...
1
vote
1answer
314 views

A lot of matrix multiplication

So I have a set of 15 $4\times 4$ matrices which I call $X_i, (i=1,2..15)$ and a set of 6 $4\times 4$ matrices which I call $y_j, (j=1,2...6)$. Now I have to calculate $(X_i y_j)-(y_j X_i^*)$ for ...
6
votes
3answers
717 views

How to manipulate gauge theory in Mathematica?

I want to know if there is a way of typing into Mathematica an expression like the following, $$\epsilon^{\mu \nu \lambda} f^{abc} A^a_\mu A^b_\nu A^c_\lambda + g\epsilon^{\mu \nu \lambda} A^a_\mu ...
3
votes
3answers
225 views

Are table headings functional?

Are table headings for aesthetics only? If I have: ...
7
votes
4answers
192 views

Generating all matrices with 1 (possibly) replaced by -1

I have a matrix $M$, whose dimension I am unsure of, which has only $\lbrace0,1\rbrace$ entries. I would like to generate all the possible matrices that result from changing (some subset) of the $1$'s ...
1
vote
1answer
153 views

Optimization of correlation calculation

How can I make the following line of code run faster? Is there a way to do this calculation as a matrix vs vector than vector vs vector? In the code below, f is a ...
2
votes
1answer
277 views

How to modify a matrix to satisfy a special condition?

I have matrix like this: How do I modify this matrix to make it satisfy the following condition: For each element {i, j} in the matrix the sum of the elements of row i must be equal to the sum ...
4
votes
6answers
238 views

Sorting Matrix elements

I have matrix in as shown, consisting of real numbers and 0. How can I sort it to become out as shown? ...
5
votes
3answers
388 views

How to sum matrix elements based on finding the first (and second) non-zero elements of each row?

I have a matrix: I would like to sum all the first non-zero elements of each row so that I get a value of $$25.5317 + 8.85471 + 6.90018 + 32.9436 + ... $$ and so on and simply ignore zero rows. ...
1
vote
1answer
274 views

How to do conditional matrix division when elements are a combination of zero and real numbers?

I tried to divide two large matrices DLand PL of size 100,000 x 5 each and they look like this, DL= and PL= By using conditional function: ...
0
votes
0answers
35 views

Why isn't the matrix product computed? [duplicate]

Possible Duplicate: Why does MatrixForm affect calculations? I have the following input: Why is the matrix not computed, giving me a $2 \times 2$ matrix?
1
vote
1answer
216 views

How to Sort on row by row basis?

Say I have matrix how to sort on row by row basis to get:
1
vote
2answers
630 views

How to take matrix elements as input to another matrix or loop?

Say I have matrix tmp1 of size 1000 x 5 (shown is just a small section for illustration purpose), consisting of real numbers and 0: How can I iteratively take every non-zero real number elements and ...
2
votes
3answers
336 views
0
votes
1answer
535 views

using Mathematica's matrix multiplication in C++

Is there any way that I can utilize Mathematica's matrix multiplication in a C++ program? I'm making a 3D graphics engine (for class) in C++ and I would really like to use Mathematica for all of my ...
1
vote
1answer
498 views

Matrix Multiplication Modulo 2

I would like to perform matrix multiplication modulo 2. Hence, instead of the usual: A.B I did: ...
0
votes
2answers
234 views

How to do equality check of a large matrix and get the corresponding index position?

Say I have a matrix A = 1000 x 5, and I want to compare it's first element (uppermost top left) to each of the 5 elements in the first column of matrix B of size 5 x 5. Whenever the first time the ...