Tagged Questions

Questions on the manipulation of matrices in Mathematica.

2answers
231 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 ...
1answer
124 views

How do I compose two functions (matrices) in Mathematica? [closed]

I'm new to Mathematica. I've been reading the 'Documentation Center' but can't find a clue about composing two functions which in my case are matrices. Here's the setup. let ...
3answers
179 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): ...
2answers
135 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 ...
0answers
61 views

please help to me, Where is my mistake? [closed]

e = {{v, -37925.9}, {-37925.9, s}} v = (37925.9 - 12.74 x) s = (7585108 - 15029 x) Solve [e == 0 , x ] please help to me, Where is my mistake?
2answers
181 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 ...
2answers
191 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: ...
2answers
99 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 ...
1answer
80 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
3answers
233 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 ...
0answers
82 views

Not getting the required eigenvalues [closed]

I'm trying to use Mathematica to show that the eigenvalues of $U$ are $\pm\dfrac{1-i}{\sqrt{2}}$, where $U = (I + T + iS)(I - T- iS)^{-1}$ where \$ S = \left( \begin{matrix} 1 & 1 \\ 1 ...
1answer
290 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 ...
3answers
209 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 ...
2answers
136 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 ...
3answers
172 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 ...
1answer
112 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 ...
1answer
173 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]}, ...
3answers
144 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? ...
2answers
511 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 ...
1answer
107 views

RowReduce Problem

Here are two examples: RowReduce[{{3, 1, a}, {2, 1, b}}] evaluates to {{1, 0, a - b}, {0, 1, -2 a + 3 b}} but ...
2answers
214 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: ...
2answers
295 views

Exact cover solution

Is it possible to get a exact cover solution(s) and/or number of possible solutions in Mathematica?
3answers
132 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 ...
1answer
157 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 ...
2answers
161 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: ...
1answer
238 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 ...
3answers
322 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 ...
3answers
162 views

Are table headings functional?

Are table headings for aesthetics only? If I have: ...
4answers
170 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 ...
1answer
118 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 ...
1answer
196 views

Find an inverse matrix, regarding a parameter as real

I have the matrix ...
1answer
121 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 ...
6answers
185 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? ...
3answers
191 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. ...
1answer
120 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: ...
0answers
26 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?
1answer
94 views

How to Sort on row by row basis?

Say I have matrix how to sort on row by row basis to get:
2answers
215 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 ...
3answers
269 views

Is there a way to do conditional matrix loop using 'continue'

I have the following: ...
1answer
331 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 ...
1answer
244 views

Matrix Multiplication Modulo 2

I would like to perform matrix multiplication modulo 2. Hence, instead of the usual: A.B I did: ...
2answers
153 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 ...
1answer
386 views

vectorial ODE in mathematica with matrix exponentials

I want to solve the following equation in mathematica : DSolve[{X'[t] == A.X[t], X[0] == ( {{0},{0}} )}, X[t], t] It is a system of 2 ODEs coupled by the matrix A, ...
3answers
278 views

How do we solve Eight Queens variation using primes?

Using a $p_n$x $p_n$ matrix, how can we solve the Eight queens puzzle to find a prime in every row and column? ...
0answers
154 views

Mathematica Complains about Non Symmetric Covariance matrix, when it's not the case

I was doing some fitting with Mathematica7 using NonlinearModelFit. It's quite long the program to do the fit and that's why I am not displaying here ... It goes ok, and I can get the fit parameters ...
1answer
100 views

how to get modify the following correlation matrix with a specific list of financial prices?

The following takes the last 5 members of the Dow Jones index and plots the correlation matrix of the last 5 years of daily prices: ...
1answer
177 views

Tridiagonal matrix for any n

I'm pretty new to Mathematica and I need to figure out how to create a $n\times n$ tridiagonal matrix for any $n$. I don't have the slightest clue where to begin. Edit: got this far, not sure how to ...
1answer
130 views

Creating a matrix from the output of a variable inside a for loop

I would like to enter the results of the following loop inside a matrix as its elements: ...
0answers
170 views

Can mathematica simplify an expression setting simplified answer equal to zero?

Basically I want to reduce something like: Subscript[P, 4] - Subscript[P, 5] == Subscript[R, 4, 5]* Subscript[i, 4, 5] when only one of them is known (...
2answers
321 views

How to calculate FDCT

I'm new to Mathemtica and I'm trying to calculate Discrete Cosine Transformation FDCT. I found the FourierDCT built-in function, but not DCT, so I need to implement it. I have tried couple of ideas ...
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 19, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9021876454353333, "perplexity_flag": "middle"}