Linked Questions

6
votes
4answers
248 views

Swap elements in list without copy [duplicate]

I have a lists with 100,000 elements and would like two swap to entries without dublicating the list Example: ...
3
votes
4answers
86 views

Subtracting list from list of same dimensions [duplicate]

This might seem like a basic operation I have already searched for similar answers but found none. I want to subtract the second elements of my list ct from the corresponding element in lt, and ...
-1
votes
2answers
443 views

Convenient methods to sum select rows (or cols) of a matrix? [duplicate]

What are some convenient methods to sum selected rows or columns in a matrix? This question Summing along rows or columns of a matrix only addresses how to sun entire rows or columns ie, by level. ...
0
votes
1answer
100 views

How to extract data from a list? [duplicate]

I have a long list of coordinates defined in some 8D space. I need to extract the first three coordinates only. How ? For example : ...
1
vote
2answers
46 views

List operation on specific elements [duplicate]

Let's consider two tables given by T1 = Table[{i,j,f1[i,j]},{i,0,2},{j,0,3}]; T2 = Table[{i,j,f2[i,j]},{i,0,2},{j,0,3}]; The functions ...
0
votes
1answer
55 views

Extracting second value of each sublist [duplicate]

How can one get the second value of every array inside the outside array? I have the following data data = {{10, 20}, {30, 40}, {50, 60}}; I want to extract ...
0
votes
1answer
53 views

Manipulating lists with constant values [duplicate]

let us assume we have some data in the following form. Table[data[[1,i,{1,2}]],{i,1,Length[data[[1]]]}] This would give all $x-y$ pairs of the first file. What I ...
0
votes
0answers
50 views

Construct matrix B from columns of matrix A? [duplicate]

Starting with Mathematica and working with matrices, I am looking for a way to construct a new matrix B from columns of matrix A. For example, matrix a has 8 columns and 4 rows, I want matrix B to be ...
0
votes
0answers
44 views

Arithmetic operations on columns [duplicate]

I have imported a file, data.txt, then plotted columns 2 and 3 as function of column 1 using the commands below. ...
0
votes
0answers
27 views

How to switch elements i,j in a list? [duplicate]

Are there any direct function to switch elements i,j in any list? or is necessary to create one with Do / If ? (I don´t ask for making me this function if it doesn´t exists) My target is can ...
291
votes
12answers
52k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
11
votes
10answers
646 views

Elegant way to map a function to only the last element of each sublist [duplicate]

Suppose that I have the following list, called test: test = {{{a1}, {a2, a3}}, {{b1}, {b2, b3}}, {{c1}, {c2, c3}}}; Now ...
24
votes
5answers
3k views

What is the most efficient way to add rows and columns to a matrix?

Say I have a matrix m and a vector v. ...
10
votes
6answers
690 views

Multiplying two dimensional data by a constant

I have a list of lists of the form: {{1, 2}, {2, 4}, {2, 8}} But I want to multiply only the second dimension of that data by a constant. I know I could do this ...
8
votes
10answers
336 views

15 30 50 per page