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

learn more… | top users | synonyms (3)

1
vote
5answers
170 views

How do I find the maximum value from the given set of data?

I have a set of data like {{x1, y1},{x2, y2}, ...,{xn, yn}}. From this data can I find the value of x for which ...
0
votes
1answer
81 views

Use a pre-computed list instead of RandomInteger

I would like to replace RandomInteger[{1, 10}, {10, 10}] in the following code: ...
5
votes
2answers
176 views

Interactive grid

I would like to create an interactive grid, whereby one number from a grid is selected by the cursor ("3" in the example below), and all other numbers in the grid are highlighted that are related to ...
0
votes
2answers
132 views

Combining graphics & lists / tables

I have: created with: ...
1
vote
1answer
112 views

How can I pass in parameters for multiple controls to a function that returns a Manipulate?

For instance, I have a some "commands" that I use regularly, for example: ...
0
votes
1answer
121 views

Interpolation problem on the list

I have a List of Latitude, Longitude and Measurement. a = {{{93, 104}, 290}, {{94, 103}, 292}, {{95, 105}, 291}, {{97, 109}, 294}, {{97, 102}, 295}}; And, I ...
0
votes
1answer
100 views

replace is not happening for specific vector valued expression

Given x[t_] := {Subscript[x, 1][t], Subscript[x, 2][t]} following replace works fine x[t] /. x[t] -> 0 0 but following ...
4
votes
4answers
171 views

How to delete mirror symmetric point pair efficiently

Look at following pic There are five points, I can generate the following point pairs ...
7
votes
4answers
278 views

Generate PrimePower counting function

Is there a way to generate a counting function for prime powers - i.e. to create a similar function to PrimePi, but including prime powers. The following will, of ...
1
vote
2answers
105 views

Delete duplicates from hierarchy of lists

Is it possible for Mathematica to compare a number of lists of different sizes, and delete duplicates in a hierarchical manner? For example, given the following lists: ...
1
vote
3answers
191 views

Generating a list of cubefree numbers

I am trying to generate a list of cubefree numbers (i.e. numbers when prime factorized contain no tripled factors) within a given range. Of DivisorSigma, ...
3
votes
1answer
71 views

Why does Thread FileDate give an error message?

I tried for example Thread[FileDate[FileNames["new*", "h:\\temp\\", 1]]] It gives FileDate::fstr: File specification ...
2
votes
2answers
184 views

Iteration problem

I am trying to write a simple program - perform f1 as long as t is smaller than 800. t is ...
18
votes
5answers
430 views

How to split list into disjoint lists?

I wonder if there is any simple way to split a list into its disjoint sublists, e.g. from list={{a,b},{e,f},{b,c},{c,d},{f,g,h}} get a result ...
0
votes
0answers
43 views

is there a way to speed up rule replace? [duplicate]

I am currently doing calculation with 7 parameters, each parameter set corresponding to a value. And I store the data in the format as a list of rule, like following ...
2
votes
2answers
248 views

Covariance of a P x M x N matrix

I have a stack of tiff files. When imported to Mathematica, they form a $P \times M \times N$ matrix, where $P$ is the number of single images in the stack, $M$ is the number of horizontal pixels and ...
0
votes
4answers
92 views

Seek a quick way to bring standard order back to original after Complement [duplicate]

the Complement gives result in standard order. But that's not what I want. I want it to keep the original order. say I have a list ...
0
votes
1answer
194 views

Passing lists to functions in a manner that works like pass-by-reference in other languages?

Is it possible to use a list as a variable, i.e., to pass it by reference to a function? In particular, I have a two-dimensional array and a function to get one element specified by its position: ...
5
votes
7answers
378 views

How to find the longest matching sublists in a list

Given a list of 2D points, i.e. {p1, p2, ..., pn} the list may contain equal points, i.e. pi = pj. In this case it may also be true that a sublist of ...
3
votes
1answer
115 views

Timing Total crashes kernel

Here is a simple test function test[n_] := Module[{i = 0}, Total[Nest[{++i, #}&, {0}, n], -1]] On my system V9.0.1 running OS X 10.6.8 and with a clean ...
1
vote
3answers
365 views

ListPlot multiple datasets over same x-values

Is there a better way to enter my data into a list plot? ...
5
votes
4answers
224 views

How to split a list with respect to its nested sublists?

I have a problem with the following task: having some nested list list = {{k6},{k1,k3,k5},{k7}} I would like to replace all sublists by their permutations and ...
2
votes
6answers
208 views

Manipulating List

I have a list: b={{1, 1}, {2, 2}, {3, 3}, {5, 5}, {6, 6}, {8, 8}, {10, 10}} I want to insert the elements in this list: ...
1
vote
0answers
69 views

The number of real values assumed by combinations of complex roots of a decic

Define complex conjugate as the pair of complex numbers $a+bi,a-bi$. Assume you have 5 such pairs and they are the 10 roots $x_i$ of a 10th-deg equation with integer coefficients. In general, how many ...
6
votes
9answers
495 views

combining and comparing lists

I have 2 lists (of lists), where most of the contained lists match. That is, the lists contained in list1 mostly match the lists contained in list2. In this simplified example each of the inner ...
14
votes
5answers
335 views

Partitioning a list of numbers the Mathematica way

I have two sorted lists, one list will be called the "fences" and the other the "values" Fences could be: $\{1, 5, 9, 14\}$ Values could be $\{-1, 1, 3, 4, 6, 9, 10, 13, 14, 15\}$ I want to ...
1
vote
4answers
161 views

Add Brackets to a string list

Hello stackexchange community! I have a stringlist with a value and his error for eg: {{"12","1"},{"13","2"}} Now i want to output this as something like this ...
3
votes
4answers
180 views

Pattern matching in nested lists

I'm sure this has been asked before, but I can't find the right combination of search keywords to find it. Apologies. I want to do a ReplaceAll on a list of lists, ...
3
votes
2answers
107 views

How to partition a list according to a nested table structure?

This question is related to this quesion. The goal is to use ParallelMap to map a function to a nested Table to get the ...
-1
votes
1answer
119 views

Efficient Table Generation & NDSolve Error

I'm currently working on solving an SEIR model with data from the CDC. I've created a function to calculate the Square difference for the model and want to create a table of values for the 4 variable ...
3
votes
3answers
136 views

Lists - pairing up

I have two (fairly large) lists of equal length & would like to pair them up. eg - from: a = {{0, 1}, {0, 2}, {0, 3}}; b = {{1, 2}, {1, 3}, {1, 4}}; I would ...
1
vote
3answers
206 views

Matlab-style Find in Mathematica? Value list and Boolean List, how to select values according to the boolean list?

I want to select elements with the true value (Indices list) in the corresponding point to the value list (MCS). Is there anything like Matlab-style Find to get the indices of true values in the ...
1
vote
3answers
98 views

ArrayRules for a ragged list

Let there be a sample list as , l = {a, {{b, c}}, {d, e}, {f}, {{g, {y}, u, h}, {{{{k, j}}}}},k, {{{{q}, {w}, {r}, {x}}}}}; ArrayRules[l] ArrayRules::rect: ...
2
votes
1answer
89 views

Putting values into a grid after iteration process

I'm developing a model of thermodynamic cycle in Mathematica. I wrote several functions, applied them to a list containing starting values and iterated, for the model to converge. ...
6
votes
5answers
234 views

Removing reverse versions of lists from a nested list [duplicate]

I need to remove the reverse versions of lists from list of lists. I.e.: {{1,2},{2,2},{2,1},{a,1,2},{2,1,a}} I need to reduce to ...
12
votes
4answers
364 views

Equivalent Nested Loop Structure

Consider the following examples: ...
3
votes
2answers
119 views

Change all values of a series to positive values

I would like to change all values of a series to positive values. I refer to my previous question, answered in the most part, very elegantly by RunnyKine. However, there remains a slight glitch that ...
3
votes
3answers
93 views

Filling in explicit zeros in a (x,y) list for nonexisting y values for discrete Fourier transform in Mathematica

I have a list of (x,y) values in Mathematica for various discrete x values, as in ...
4
votes
1answer
156 views

List manipulation - various

Update OK, Please forgive the messiness of this, but I am working with something like: ...
0
votes
0answers
27 views

Eliminate some value from a matrix [duplicate]

I have a function that return a table consisting of a 2D points. These points are either {x,y} or {0,0} ...
2
votes
4answers
137 views

Looking for mismatches between two lists

I'm able to do what I need, but it seems like there's always a better way. I have two lists, epiExcel and epiDB. Each has 3 columns and about 2,500 rows. I need to find out if the first 2 columns ...
1
vote
1answer
97 views

Replacement variable in list plot

I would like the replacement: /. {ComplexInfinity -> 0} to be treated as a variable. I am trying to overlay the following list plots: ...
8
votes
1answer
268 views

Two ways of map a function on the list: Which one is faster?

There are 2 ways to make a function listable on the list: Use Map or use SetAttributes. My question is, which one is faster, ...
2
votes
2answers
146 views

How to delete all rows in datafile that contain a string

I'm importing some data from a file. However, the file was created by an unreliable instrument, such that the data looks like this: ...
3
votes
3answers
86 views

How to get different items in a list to interact to get a result?

I have two lists, for example (the real lists are much longer): list1 = {1, 2, 3, 4, 5, 6, 7}; list2 = {9, 10, 11, 12, 13, 14, 15}; I want to create a single ...
5
votes
3answers
151 views

Preserving a bijection between arrays when shuffling elements in one array

Imagine I have two lists of elements like the following: listOne = RandomReal[{0,2}, {100,2}]; listTwo = RandomReal[{0,2}, {100,2}]; Let $f: X \to Y$ be a ...
3
votes
2answers
197 views

Provided an array of 2D point clouds, can we quickly replace distance- and index-based cliques of points with their median or mean values?

Imagine I have $N \approx 10^5$ clouds of points in an array of the form: UPDATED ...
11
votes
9answers
548 views

How to partition a list of numbers in two lists of numbers such that each lists elements sums up to the same number?

I have the following list of squares. {1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256} Their sum is $1496$, I want to make two partitions ...
0
votes
1answer
38 views

Pruning coordinates in subarrays of a list conditional on them having non-real components

If I have a list of 2D coordinates placed in subarrays of a data structure like the following: ...
1
vote
2answers
298 views

Swapping elements of list

Say I have a directed graph inputted in the following format in Mathematica: g = {{1, "a", 2}, {2, "b", 1}} I'd like to plot this graph using ...