Tagged Questions

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
142 views

Extracting counts of contiguous zeros and ones from a binary array

I'm a novice with Mathematica, but you guys have been very helpful to me in the past. I have a binary array [100, J repetitions] consisting of zeroes and ones. I'd like to extract a histogram of the ...
0
votes
3answers
95 views

How can I generate a generalized product to two lists in a special way? [duplicate]

Let's say I have two lists, and I'd like to generate a "cartesian product" from these two. Specifically Inputs: A = {{{1}}, {{2}}, {{1}, {2}}}; B = {8, 9}; ...
0
votes
0answers
70 views

Importing specific columns of a .txt file [duplicate]

I have text delimited file, with data in four columns. How to use ReadList to extract only the first and the fourth column.
0
votes
2answers
138 views

How to put a list of values on a single axis and add custom labels

I have a table in the following format: Apple 2 Pear 3 Banana 5 Orange 6.5 .... I would like to put the values on a single horizontal axis and add corresponding descriptive labels (apple, pear, ...
7
votes
9answers
435 views

Convert list of lists to cumulative join

I have this: list[1]={1,2,3}; list[2]={7,8,9}; list[3]={15,20,22}; I want this: ...
1
vote
2answers
337 views

Building a new table by repeating elements from another table

I have a small problem that I cannot solve. I have two tables, one with three elements: a = {0, L/c, 2L/c}; and the other with 9 elements, all 0: ...
2
votes
2answers
243 views

Removing pairs that meet a given criterion from a list [duplicate]

Let $(x_{min},x_{max})$ and $(y_{min},y_{max})$ represent lowerbound and upperbound acceptable values for some coordinate $c_i$. Setting $x_{min} = y_{min} = 1$ & $x_{max} = y_{max} = 9$, how ...
-1
votes
2answers
101 views

Extracting only complete records from two data sets and combining them

I have two data sets: ...
3
votes
1answer
137 views

Combining the items with common available dates from two lists [duplicate]

I have two lists of data including dates such as data1 = {{{yy, mm, dd}, a}, ...} data2 = {{{yy, mm, dd}, A}, ...} There are some missing dates from each list, ...
1
vote
1answer
187 views

Bincounting a list

I'm a Mathematica novice here. I'm trying to execute the following code to add random 1's into a zero matrix, repeat this many times, and then bin/histogram the number of nearest neighbor 1s. Can ...
19
votes
7answers
1k views

Elegant and fast way to join all string sequences

I want to do what title says: {"a","b",1,2,3,4,"a",2,2,2,"edg","?"} => {"ab",1,2,3,4,"a",2,2,2,"edg?"} in the most elegant way. For example one replacement rule for ...
10
votes
3answers
317 views

Looking for an elegant way to construct this tensor-product-ish list

I would like to make the following matrix: ...
0
votes
1answer
74 views

How does PolarPlot render a nested list of functions?

I am getting unexpected plots from PolarPlot when I provide a list of functions that I generate using Table. I suspect the ...
4
votes
2answers
339 views

Removing not-a-number entries from an array of numbers

I have a list of {x, y, z} coordinates from a wavefront sensor I'm working with. However, not all of the imported points have actual values, but they still get ...
2
votes
1answer
130 views

list manipulation [duplicate]

I have a list like the following: {{1, 3}, {2, 5}, {3, 6}, {2, 4}} I want the final list to be like that : ...
3
votes
2answers
107 views

Non-canonical re-ordering of nested lists

I have some data in the form: ...
2
votes
2answers
126 views

Select rows of matrix that are higher than a given row

Imagine I have the following matrix: X={{0,0,0},{1,0,1},{1,1,1},{1,2,1},{3,3,3}}. I want to select the sublists that are greater or equal than this list ...
4
votes
1answer
187 views

How can I randomize order of elements in a list?

Is there a straightforward way to go from an ordered list like: ord = {a, b, c, d, e, f, g, h} to a disordered list like: ...
3
votes
1answer
123 views

Assigning Sequence to Part of a SparseArray (bug?)

Part ▪ You can make an assignment like t[[spec]]=value to modify any part or sequence of parts in an expression. ▪ If ...
3
votes
2answers
309 views

Find local maximum in 3D list

I have a set of data of the kind {{$x_i$, $y_i$, $z_i$}, ...} at randomly chosen points $x_i, y_i$. The $z_i$ are supposed to be a smooth function of the $x_i$ and $y_i$. Unfortunately they turn out ...
4
votes
0answers
192 views

Strange behavior of undocumented RawArray and ArrayObject expressions

I discovered several strange results and inconsistencies while trying to understand what undocumented RawArray and ArrayObject ...
1
vote
1answer
298 views

Measuring the area of non analytical regions in a plot [duplicate]

As the title says, I want to measure the area of different closed regions in a plot. Let me be more specific by giving a characteristic example. In the following figure, we observe that inside the ...
2
votes
1answer
156 views

Coarse-graining and/or sorting of a list of arbitrary triades {x,y,z} in the (x,y) plane [duplicate]

In general my question is related to an approach to make an interpolation of a data which is not on a regular mesh. Another aspect of this question has already been discussed after my question ...
12
votes
6answers
539 views

Sort+Union on a list

Probably this is too trivial question for this forum but for some reason I am not getting it on my Mathematica 7 so far. I have a list ...
9
votes
6answers
404 views

Performing Computations on Sets

I would like to find a permutation of $\quad S=\{\frac{1}{10}, \frac{1}{2}, \frac{4}{7}, \frac{3}{5}, \frac{2}{3} \}\quad$ that maximizes the sum of theses elements raised to unique powers: ...
0
votes
0answers
111 views

How can I revise my program to avoid “No more memory available”? [duplicate]

I have a program for calculating a type of list. ...
1
vote
1answer
117 views

Forming product of function of prime factors

Given a list of numbers each containing 2 prime factors, I wish to make a list of the products of the logs of each factor. For example, given L = {4,6,9}, I would like to form P = ...
1
vote
1answer
304 views

Find elements of a list which are empty

Sorry for the most basic of questions. How would I find the positions of a list of elements which are empty, for example I have the list ...
1
vote
1answer
266 views

Simpson's rule with ListConvolve or ListCorrelate

I have a function that's represented as a long list of values that I want to integrate. I can do it procedurally with Simpson's rule. ListConvolve generally runs faster then procedural code, so i ...
3
votes
1answer
155 views

Little problem with Through

list = Partition[Range[20], 5, 5, 1, {}] {{1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17, 18, 19, 20}} ...
2
votes
1answer
178 views

Equating two lists, element by element

Say you have two lists: listA = {a, b, c} listB = {d, e, f} How would you produce a listC that equates each of the two's ...
1
vote
0answers
92 views

Optimized subset algorithm implementation

I was reading a paper from Mathematica Journal.It mentions a code for calculating subsets. ...
5
votes
3answers
560 views

How do I find the intersection of a closed 3D curve given by numerical data with a specified plane?

I have a list of 3D data points which form a closed curve. My own data can't be easily generated analytically, but the qualitative behaviour is well represented by a parametric curve families such as ...
1
vote
0answers
144 views

Why doesn't ParallelMap improve the performance of FoldList?

This question arose during my analysis of the following problem: filling gaps. (The code used here is Simon Woods's work.) FoldList seems to not cooperate with ...
2
votes
4answers
209 views

How to improve the quality of the ListPlot output

I need to plot massive data stored in external ASCII files. Below is the Mathematica code I use for this job: ...
12
votes
10answers
613 views

How can I generate a nested array like this one?

Well, this is how the array looks like: I came up with this code: n = 10; Nest[ArrayPad[#, 1, 1 - #[[1, 1]]] &, {{1}}, n] /. {1 -> "*"} Any better ...
3
votes
2answers
157 views

Modify all the second elements of every pair in a list of pairs

I have a list in the form {{a, 1}, {b, 2}, {c, 3}}. Let's say I want to operate a transformation on all the second elements of each sublist, but this transformation is a function of them all ...
16
votes
6answers
572 views

How do I replace a missing value in a column with the value immediately above throughout a table?

I have a large table (7000 rows × 17 columns) of terse textual data. In many of the columns, empty entries have been replaced with "." as a marker. Working from the top of the columns downward, I want ...
14
votes
7answers
634 views

A function that accepts a pair or a list of pairs

Probably a duplicate, but it's not easy to search on "lists". I have a function that accepts a list of lists, say {{a1, b1}, {a2, b2}, {a3, b3}} and performs some ...
8
votes
5answers
274 views

Wrapping a function in count

I am working through the Programming Paradigms via Mathematica (A First Course) and am attempting to answer the following: Use recursion to count how many times the argument can have its square ...
20
votes
15answers
1k views

How do I extract the middle element(s) of a given list?

How do I extract the middle element(s) of a given list? Here is some code that works, but seems a little too long: ...
5
votes
1answer
169 views

What is the fastest way to maintain a large set of expressions?

In my algorithm I need to maintain a set (an unordered list of distinct elements) of expressions supporting two operations: Test an expression for membership in the set Adding a new expression to ...
2
votes
1answer
67 views

Adjust the results of evaluating Table so it can be used as a argument to Point

I have a list generated by Table as below. ...
0
votes
1answer
108 views

Displaying Values of Fuction at end of Period by Grid

My intention is to place the values of two function into a small box within my chart. To be more precise I have two vectors. A meanvector which shows the average value of all simulated stochastic ...
1
vote
2answers
282 views

Scatterplots for subsets of multivariate data [Updated]

Update/Re-write There has been a lot of ambiguity over what i'm am trying to do with this question so I have decided to give it a full rewrite. I'm really sorry for the confusion. If you want to see ...
8
votes
4answers
392 views

Partitioning a list by recursion (Programming Paradigms via Mathematica (A First Course))

I am working through the course Programming Paradigms via Mathematica. One of the homework exercises for the section Recursion I: Passing the Buck is as follows: Use recursion to partition a ...
5
votes
4answers
482 views

Combining the second elements of a set of ordered pairs based on their first element [duplicate]

I have a large set of ordered pairs and I am trying to add the second elements together for any group of pairs that has the same first element. For example my data looks like: ...
0
votes
1answer
126 views

Stopping- threshold and stopping- time of stochastic processes.

Rod Lm helped me to generate the following code, which I want to extend a little bit. So my intention is to use the threshold (the green line) as boundary in the following way: as soon as the process ...
1
vote
1answer
127 views

WeatherData acquirement in ListStreamPlot

I am trying to show the wind streams in a geographic area as following code for a range of time.Even if it works for realtime data but it doesn't work for range of time.I am filtering and also taking ...
0
votes
1answer
195 views

Brownian Motion with stopping threshold

I just want to generate one stochastic process, whereas I want to be able to manipulate the start value and the volatility. Furthermore, the process should stop when it reaches 5 However, as soon as ...