Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

learn more… | top users | synonyms (3)

2
votes
2answers
57 views

Is the MaximalBy function still used [on hold]

On the mathematica reference website it gives examples using the MaximalBy function, However when I am using it, I see no desired output. This leads me to wonder if mathematica has stopped using this ...
2
votes
3answers
87 views

Alternatives to Append/AppendTo for generating a list in an interactive DynamicModule?

I have a stack of timelapse microscopy images that I am trying to segment frame-by-frame using some of Mathematica's image processing functions. I have created a little interactive DynamicModule with ...
6
votes
1answer
222 views

Tuples without self-loop

I have a simple question coincerning the Mathematica function Tuple. Currently, I apply the following code ...
10
votes
8answers
424 views

UnFlatten an array into a ragged matrix

Trying to unflatten an array that was part of ragged array of sub matrices. As input we have flattened array: ...
7
votes
5answers
178 views

How to do DateDifference on table items containing dates

I have a Table with data in form {{date}, value}: ...
4
votes
0answers
42 views

Listable compiled functions used in NMinimize

This is an example from MMA: cListable = Compile[{x}, (x-1)^2, RuntimeAttributes -> {Listable}] In case of single entry: ...
6
votes
5answers
270 views

Find patterns in a list

again, I have a list like this: ...
3
votes
1answer
72 views

Use Style on list elements

I have a list like this: list = {0, 0, 0, 1, 1, 1} I want to color all the 0's in red, but I dont want to count through all the elements, like in my solutions, ...
4
votes
2answers
98 views

Is there a built-in function to map a list of heads to a list of data?

Assume that this built-in function is called func. What I want is func[{f,g},{a,b,c}] will return the following result: ...
3
votes
1answer
48 views

Part specification error only in LogPlot

I've a problem. I defined a simple list and a function like below: lst := {5, 10, 20} f[m_] := lst[[Floor[m/10]]]; and drew a plot ...
5
votes
2answers
90 views

Return value of Reap when using tags

I've noticed a behaviour of Reap that I don't quite understand yet. Suppose I want to Sow several values during a computation. ...
15
votes
4answers
288 views

Make MapIndexed listable

My goal is to apply MapIndexed to every element of a nested list without destroying the arithmetic operations within the elements. For example, let's start with ...
1
vote
2answers
620 views

Computing 10-dimensional volume of a 9-sphere [closed]

I'm trying to compute 10-dimensional volume of a 9-sphere with radius r using Monte Carlo. ...
1
vote
1answer
91 views
2
votes
2answers
137 views

How to get the current index during a Scan iteration?

Is there a special keyword to get the current index in Scan ? For example, let say I have the following code : ...
6
votes
2answers
188 views

Converting a string into a nested list of strings

The following string can be converted easily into a list with ToExpression ...
3
votes
2answers
95 views

How to modify the elements of a list in a loop?

I have a list with points coordinates. And I'm trying to traverse it and perform some matrix operations on each point. But I have a problem with storing modified points in the initial list instead of ...
2
votes
1answer
76 views

How to build a list of constraints for NMinimize

Let's say I have aset = {-1, 0, 2}. I would like to create a variable Var that takes values from that set, i.e. ...
5
votes
5answers
285 views

How to display operations on list elements

When applying some arithmetic operation on two lists, I'd like to display the actual operations between the elements of each list. For example, {1, 1} + {1, -1} ...
1
vote
3answers
120 views

How to ReplaceAll independent of depth?

I have a big list which in principle can be described as this more compact list : ...
0
votes
1answer
112 views

How to plot data points in the form X, Y, E(X, Y) where X and Y coordinates are not ordered?

I have got a file with field values (RF simulation of a resonator) which consists of 3 columns: X and Y cartesian coordinates ...
1
vote
1answer
53 views

Remove curly brackets _completely_ to map a function to the elements of a list [duplicate]

Most list manipulations can be done with Flatten, Partition and Take. I didn't managed to ...
2
votes
4answers
104 views

Import xls data with dates

I have an excel table that have 2 columns, the first one are dates, and the second one are values. I want to plot the value vs the date. I need to: first clean all the non numbers strings like ...
5
votes
1answer
144 views

How to split a Dataset into training and testing for machine learning?

Suppose I have iris data In the Dataset Format. How to split the iris data Into training and testing for Machine learning? For example,Transform the data for Classify.
6
votes
3answers
244 views

Rotate lines around their midpoint

I am trying to rotate a series of lines by the same angle around their centre point. Say each line is defined by a co-ordinate at each end, simplified example below of a typical dataset. ...
1
vote
1answer
72 views

How can I write a function which takes another function of a variable and the variable itself as arguments and gives a list of critical points?

This is an exercise from Power Programming with Mathematica by Wagner. I need a function which takes a function and a variable as arguments, like this: critpts[f_,x_]:= and then on the rhs I've got ...
3
votes
1answer
99 views

Read and write files

I have a text file, its content is(for example): ...
3
votes
4answers
172 views

Replace all symbols in a matrix with their numbered forms

I have a matrix made mostly from "x" with a few 0's thrown in: ...
6
votes
2answers
137 views

Problem when defining function through NIntegrate and NDSolve and Interpolation - Bug?

More than a single question, I have some doubts about the output of certain functions when defined through the result of other calculations. I am an active user of Mathematica, but maybe I haven't ...
4
votes
3answers
150 views

unlisting a nested list

I have a list like this: list = {{a,{1,2,3}},{b,{1,2,4}},{c,{{1,4,5,5},{6,3,2,1}}}} This is a nested list which each element has a name. I want to export it to ...
1
vote
3answers
109 views

Removing some data and replacing them with new ones

I have a data list where the elements have the form (time, velocity ). I need to remove some malformed elements in places where the data does not change smoothly and then replace those points by ...
1
vote
2answers
131 views

Replace a value in a nested array

When I run the following, ...
2
votes
3answers
65 views

Take a list with the amounts of the random samples from another list while holding the index

I have a list called cant with some amounts of samples to take from the list community as follows: ...
3
votes
5answers
193 views

First pair out of order

I would like to know how to efficiently determine the first pair of elements in a list that are not in order according to some predicate p. That is, list[i] > list[j] according to p, and i is the ...
4
votes
8answers
375 views

How to sort my list?

For example I have two lists of such structure L1 = {{"Australia",a1}, {"USA",a2}, {"Norway",a3},...} L2 = {{"Russia",b1}, {"Norway",b2}, {"Japan",b3},...} I ...
3
votes
7answers
195 views

List creation/manipulation

I'd like to a create a list from A = {{a}, {b}, {c}} by taking each elements n times in the following form: ...
1
vote
4answers
96 views

Check if a scalar falls within the range given by sub-arrays of a matrix

I have a rank 3 matrix: r = {{{1, 10}, {19, 71}, {111, 159}}, {{1, 5}, {25, 63}, {118, 132}, {164, 185}}, {{1, 19}, {28, 49}, {157, 203}}}; and each of the ...
0
votes
0answers
46 views

Generate all strings of fixed length from an alphabet [duplicate]

I am trying to create all possible strings of length $8$ from the alphabet $\{+1,-1\}$. I am trying to get help from this question. But not sure where to start from. Any help?
6
votes
6answers
393 views

Convert a list of rules into 2 lists of integers

If I have a list of n number of rules, what is a concise way of breaking the data into 2 lists of the first and second part of the rule? This works, but seems like an unnecessary amount of code to ...
7
votes
0answers
86 views

How to merge Datasets representing matrices with named rows/columns?

I am working with square (non-symmetric) matrices with named rows and columns. The data I receive is sometimes messy and rows/columns may come in various permutations. I usually need to ...
3
votes
3answers
222 views

How can I change a list to a sequence without destroying nested list

I defined a function f like f[x___, y_] := something; and if xs and ...
0
votes
1answer
44 views

Map Elements of a list to be Index of matrix

I have a sublist from Tuples[{1, 2, 3}, 2], say for example L={{1,2},{2,1},{2,2}}, and a 3 x 3 matrix ...
6
votes
8answers
230 views

Merging lists and adding common elements [duplicate]

I have two 2D arrays where some of the x-values are identical, L={{1,1},{2,2},{3,3}}; J={{0,1},{2,2},{4,4}}; I want to add these lists in the following way ...
0
votes
4answers
95 views

Converting format of list

I have a 2D array, data = {{0,1}, {1,2}, {2,3}}; I would like to convert it such that I get the x- and y-values separately, specifically ...
3
votes
2answers
217 views

Weird behavior when changing parts of matrix

I have this matrix: mat = {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17, 18, 19, 20}, {21, 22, 23, 24, 25}}; and here are its second row ...
10
votes
8answers
329 views

Forming an upper triangular matrix from the elements of a list

I asked this question before, but i was closed because it the question was not comprehensible enough. So i reworded it, hope that's ok. I have a list with 6 elements. ...
1
vote
2answers
33 views

how to extract a matrix and a vector from a vector [duplicate]

I have a vector like this: V = {a*exp1+b*exp2+c*exp3, a*exp4+b*exp5+c*exp6, a*exp7+b*exp8+c*exp9} and I want to get : ...
2
votes
0answers
71 views

Convex optimization

I am playing with some Compressed Sensing (think single pixel camera) applications and would like to have a Mathematica equivalent of a Matlab package call Convex Optimization (CVX). Specifically, I ...
4
votes
2answers
93 views

Faster Alternative to DeleteDuplicates for deleting elements in list [duplicate]

I have a list in this style data={{a1,b1,c1,d1,e1,f1}, {a2,b2,c2,d2,e2,f2}} I need to delete all elements in which b1 is ...
11
votes
12answers
543 views

How to group each element with each consecutive elements in one head

Suppose I have the following list: list = {a, b, c, d} I want to generate this result: ...