All Questions

Filter by
Sorted by
Tagged with
0
votes
1answer
74 views

(Row?) reduction of a system of equations

For a mathematical problem I am trying to solve, I have (say) $(N+1)$ inhomogeneous linear equations in $M$ variables of the form $$\sum_{a=1}^{M}c_{i a}p_{a} = \xi_{i} \quad \text{ where } i=1,\...
0
votes
1answer
31 views

Selecting solutions that evaluate to positive

How to extract symbolic outputs of Solve that evaluate to positive at given values of parameters? For example, if ...
0
votes
0answers
31 views

How to compute a system of ordinary differential equations with initial condictions over a continuous range

I have some questions about Mathematica programming and would appreciate if you could help me. I want to solve a system of ordinary differential equations \ [Mu] '[t] and \ [Lambda]' [t] and each ...
1
vote
0answers
28 views

Problems with the parametric Recurrence Table

I am trying to construct a minimization program where I have to minimize a function with respect to a matrix. This matrix enters into the optimization program in a convoluted manner together with data....
7
votes
4answers
89 views

Take $ n^\text{th} $ sub-list with equal distances

I have been looking at Span, Take, etc. functions but I couldn't figure out how can I extract elements likes this ...
5
votes
1answer
81 views

Find position equal columns of matrix

Consider the following rectangular matrix M = {{1,1,1,1},{2,2,4,4},{3,3,5,5},{9,9,3,1}} I would like to extract the position of equal columns. Is there a simple ...
5
votes
4answers
216 views

Manipulate a list: replace random position of a specific integer n times by 0

I have this matrix with 3 sublists: d = {{1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0}, {0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1}, {0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0}}; For ...
9
votes
3answers
398 views

Create Array from list of indices/values

Is there is a performat way to convert something like {{0,0},a},{{0,1},c},{{1,0},d},{{1,1},e} into {{a,b},{c,d}} The ...
7
votes
3answers
574 views

How to convert diagonal matrix to rectangular matrix

Suppose you have the following diagonal matrix: $\left( \begin{array}{cc} a & 0 \\ 0 & \{b,c\} \end{array} \right)$ How can the above matrix be converted to the following rectangular one?...
1
vote
1answer
36 views

Identification of linear combinations in a matrix

I have a matrix R which is having a dimension of 20 cross 20. When I extracted the rank of this matrix I got 16. I just wanted to which are these four rows are or columns which are dependent on each ...
6
votes
3answers
646 views

List Manipulation : {{{a,b},{c,d}},{{e,f},{g,h}}} into {{a,b},{c,d},{e,f},{g,h}}

Hi I'd like to transform the matrix : ...
6
votes
3answers
284 views

How to append a matrix element by element?

Consider if I have some matrices constructed as such: ...
3
votes
1answer
45 views

How can I make a scatter plot from a matrix with many y-axis values for each x-axis value?

Consider matrix A = {{0, 2.54343, 3.566, 4.2323, 2.3434}, {0.1, 6.432, 4.6465, 5.656, 1.34}, {0.2, 0.3423, 1.6342, 3.323, 2.04}}; The x-axis values ...
4
votes
1answer
100 views

Selecting unique column position of a non-zero value for each row of a matrix

I have a matrix in this case of 3x11, but I want this to work for any dimension matrix. I want per row a column position on a non-zero value in that row, but that this value should be different than a ...
1
vote
0answers
44 views

Print 4x4x4x4 tensor as 4x4 matrix of 4x4 matrices [closed]

I'd like to print the LeviCivitaTensor[4] tensor as 4x4 block matrix of 4x4 matrices The following code works to display the LeviCivitaTensor[3] tensor as a 3x1 vector of 3x3 matrices. ...
0
votes
0answers
17 views

Solve, store, and access eigenvalues and eigenstates of M[x,y], for various points {x,y}

I'm interested in solving a position dependent eigenvalue problem for matrix M[x,y], where {x,y} is some discretized set of points. I may need to access the eigenstates and eigenvalues multiple times ...
3
votes
2answers
177 views

Condition on all eigenvalues of a matrix

I am going to help Mathematica to satisfy the condition: If all elements of a matrix's eigenvalues are different from zero, then print "ok" For ...
1
vote
1answer
65 views

How to join two matrix with different dimensions?

I have two matrices with different dimensions I want to join them together in one matrix. for example, I have two lists of diseases associated with their symptoms in both matrix, what I want is to ...
2
votes
2answers
82 views

Is there an efficient way to fill in the elements of a matrix as m11,m12…etc?

I want to autofill the elements of a matrix (or list) by m11, m12, etc. I am able to autofill using ...
2
votes
0answers
45 views

How to calculate a projection of x,y,z data to x any y plane?

I have a List containing x,y,z data, which I can plot nicely in a ListContourPlot: ...
5
votes
4answers
399 views

Looking for a simple way to manipulate one column of a matrix

Given {{a, b}, {c, d}} I want to get {{c, b}, {a, d}} with one simple expression. Is this possible?
1
vote
2answers
82 views

Selecting matrices based on existence of unique column and row of all equal terms

So, I have a list of lists of lists such as the following: {{{4}}, {{7, 7}, {7, 7}}, {{5, 5}, {6, 6}}, {{2, 1}, {1, 1}}} Interpreting the elements of this list ...
6
votes
4answers
366 views

Find the identical rows in a matrix [duplicate]

Suppose I have the following matrix: ...
0
votes
0answers
47 views

Why is this iterative process with matrix calculation so slow?

I am trying something similar to the following code with Ntime as large as 100 or so. Now it's very slow as shown by the Ntime=3 ...
0
votes
2answers
52 views

Apply matrixform to limited rows and columns of a matrix

I have a big matrix, you can say 1000*1000 whose elements are functions of several parameters such as a, b. I wish to see just a ...
1
vote
1answer
62 views

Matrics manipulations

this is a basic question in Mathematica, I hope to get help to resolve it, How I can extract elements from matrics for example I have ...
0
votes
2answers
78 views

Function for finding the nth unique minimum value in a list?

I have this matrix... mat = Table[{k, 0}, {k, 0, limit}]; After a series of dynamic iterative operations, some of the 0 initialized entries (i.e., those of the ...
1
vote
2answers
46 views

Locate all row and column pairs containing a value in a table

I would like to find all row and column pairs that contain 1 in a table. For example, the row and column pairs that contain 1 in the table are (a,b),(b,a),(b,c),(c,b),(c,d),(d,c),(d,e),and (e,d). <...
2
votes
2answers
82 views

Using good method to produce a regular matrix

The matrixform is as follow, and how can I use good method to produce it? H = {{1, 1, 0}, {2, 2, 0}, {0, 1, 1}, {0, 2, 2}, {1, 0, 1}, {2, 0, 2}}
0
votes
1answer
55 views

How to replace the entries of a matrix by another matrix?

I have a two matrix mm and nn. Matrix mm is of dimension 8 cross 8 and nn is of dimensions 4 cross 4. I want to replace the first four rows and columns in mm by nn. How to do this? ...
0
votes
0answers
42 views

How to save a multidimensional matrix in separated files for each dimension

I need to export to a file a multidimensional matrix, each dimension to a file. For example: ...
4
votes
2answers
106 views

Element-wise multiplication of matrices with different dimension

I am interested in efficient element-wise multiplication of matrices with different dimension. Here is my solution: Matrix 1 with dim = {3, 4, 4} ...
4
votes
4answers
184 views

Changing the position of rows and columns in a matrix

I have the following self-explanatory question. https://1drv.ms/u/s!AsyHs3E_aioxhipb3wSPSX_heN-t As seen from the above matrices, I start with the "original" ...
3
votes
2answers
319 views

The multiplication of list of matrices

I need to multiply 3 lists of matrices (b.a.b) as the following code ...
1
vote
2answers
98 views

reducing matrix size by linear operations on rows and columns

Suppose that I have the following matrix: matrix = Table[i+j, {i, 5}, {j, 0, 4}]; which generates I like to write a ...
0
votes
0answers
47 views

How to optimize the code [duplicate]

How can I write the following code using lesser number of characters? Table[Table[{y - x, y}, {y, 8}], {x, 8}] I tried using ...
7
votes
2answers
162 views

Time-efficient matrix elements grouping and summing

I'm interested in finding the quickest way of grouping the elements of a large matrix in sub-groups of NxM elements and them summing them together. To be completely clear, I'm actually not interested ...
4
votes
1answer
215 views

Setting Some Elements in a Matrix to zero

Assuming I have the a 5x7 matrix below: b = ((1, 4, 9, 16, 25, 4, 2), (36, 49, 64, 81, 100, 5, 1), (121, 144, 169, 196, 225, 8, 9), (256, 289, 324, 361, 400, 9, 5), (441, 484, 529, 576, 625, ...
2
votes
2answers
81 views

Elements Replacement

Please I need help on how to replace elements in a matrix with another elements. For example, I have a (5,5) matrix, and I like to replace elements from All rows and column 3 to 5, with zero. such ...
0
votes
2answers
81 views

How to calculate $(X^tX)^{-1}X^tY$? [duplicate]

This is MatrixForm[ {{1., 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, 1.5, 1.5, 1.5, 2, 2, 2.2, 2.4, 2.5, 2.5, 2.8, 2.8, 3, 3, 3.2, 3.3}}] $X^t$ ...
0
votes
0answers
35 views

Reshaping list of matrices

I have a list of square matrices $A_i$ as follows $$ \left(\begin{matrix}A_1 & \ldots& A_n \\A_{n+1}&\ldots &A_{2n} \\ \vdots & \ddots & \vdots \\ A_{(k-1)n+1} & \ldots &...
1
vote
2answers
84 views

Joining $4 \times 1$ vectors defined through functions to form a $4 \times n$ matrix

I define a $4x1 $column vector through a variable as: Z[i_]:=List[{a[i]},{b[i]},{c[i]},{d[i]}] I then want to make a $4\times n$ matrix by joining a specified ...
4
votes
5answers
448 views

How to join many columns of data in array?

I have large number of columns of data. How to put in single matrix? For example, with test data of 1 x 3 matrixs ...
1
vote
1answer
43 views

Selecting from a matrix according to elements of a column — efficiency and speed?

I need to select all elements from matrix M that have in their 3rd column elements from some given list L (3rd column and L are real numbers). I have written the most obvious (to me) command to select ...
11
votes
4answers
805 views

Set every element to zero in matrix unless it's 1 or 1/2

I have the following code: ...
1
vote
2answers
36 views

Add value to nonzero elements of symbolic matrix

I would like to add a certain placeholder O to any nonzero element of a matrix. The matrix has elements which are not number but complicated symbolic expressions. ...
2
votes
1answer
119 views

Indices of nonzero rows in a sparse array

Given $A\!\in\!\mathbb{Z}^{m\times n}$ stored as a=SparseArray[{...},{m,n}], how can I obtain the list of all indices $i\!\in\!\{1,\ldots,m\}$ for which the $i$-th ...
5
votes
2answers
145 views

Fast element-wise division of matrix, generated from vector with `Outer`, and another matrix

m = {a, b, c}; n = {{e, r, t}, {y, u, i}, {g, h, j}}; k = Outer[Divide, m, m]; k/n gives ...
3
votes
3answers
170 views

Replacing a column of a matrix

I want to replace a column of a matrix. The best I've been able to come up with is ...
3
votes
2answers
228 views

How to drop certain elements in certain positions from a list using drop function

a = Table[i, {i, 1, 10}] Drop[a, {5, 8}] If go with the above procedure, It will delete all the elements from between position 5 to 8. How to drop elements which ...