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

learn more… | top users | synonyms (3)

6
votes
7answers
61 views

Count the sequences in an array

Is there a short and easier way to count number of sequence in a list? Let's say I have three lists: list1 = {0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0} ...
2
votes
2answers
26 views

Join data imported in different variables [on hold]

I've imported data from Excel into several variables and I would like to join all data in one "big" variable. I seem to have a problem when one variable contains numerical data... ...
1
vote
2answers
70 views

Ask about the variable and constants in partial derivative in a loop

EDITED I have a function in a list like : func={2(x^2)+x*y+3(y^2)}; I want to have a UI that ask me which parameter (x or y) is a variable in a ...
0
votes
1answer
23 views

Transpose four lists of data into two lists for use in List Plot [on hold]

I have four lists of data x1 = {1,3,5,7} y1 = {0,2,4,6} x2 = {10,12,14,16} y2 = {8,10,12,14} In one line is it possible to use transpose to get two lists which ...
0
votes
0answers
53 views

Switching ArcTan argument from a sequence to a list

The objective is to determine the angle formed by the line connecting two points in the plane, say p and q. The ...
4
votes
3answers
121 views

How to get multiplication of the elements of a specific list/Matrix

Assume there is a list: List1={a,b,c,d}; Then I want to get these calculation: ...
0
votes
2answers
31 views

How to get Complement function working in a For loop? [on hold]

I've been working on a piece of code that will delete small components from a nested uneven matrix (n pages, n rows, 3 columns), by deleting the pages with less than ~30 rows. However, I've notice ...
4
votes
2answers
106 views

Initializing several values of a function

How do I initialize several values of a function at once? Consider the function f[0] := 1; f[1] := 2; f[2] := 3; f[n_] := f[n] = f[n-1] + f[n-2] + f[n-3]; Is ...
2
votes
4answers
155 views

Given a matrix of integer, create a matrix with 1 or 0 according to which numbers are in the first matrix

Not sure the title gives the idea of what I need, so here is a sample: I have ten (w) combinations (subsets) of 20 (n) numbers taken 4 (k) at time. I need a matrix of dimension w x n with 0/1 in each ...
0
votes
2answers
68 views

Write list of numbers to a file

I have a list of numbers: e.g. list={1,2,3,4,5} To write the list to a file I use (here each integer number occupies 7 spaces): ...
0
votes
0answers
14 views

Selecting elements from list based on list of positions [on hold]

I have a list with elements I want to select: list = {1, 34, 98, 4, 5} Now I want to select elements of those list based on a list with positions like: ...
2
votes
2answers
91 views

How to remove multiplicities from for a list in way meeting special criteria

I have a list of pairs, tabul, which has the property that the second element of each pair is also an element in my list data. I ...
7
votes
4answers
186 views

How to Apply Functions to Lists with Many Curly Brackets?

For example, consider the list defined below. samplelist = {{{1,2,3,4}}, {{5,6,7,8}}}; How would I apply the Times operator ...
0
votes
0answers
27 views

FoldList[Union,…] version 8 vs version 9 [duplicate]

I have a list of matrices something like shown below A = {{{1,1,1,1,1},{2,2,2,2,2}},{{3,3,3,3,3},{4,4,4,4,4},{5,5,5,5,5}}} When I try to run the code ...
-1
votes
0answers
44 views

Building Pythonic Programming style to Mathematica with visually-accessible list comprehensions?

The question List comprehension in Mathematica has comment about this Functional style using lazy lists? where they build some sort of style for lazy lists: I understand it so that it is impossible to ...
3
votes
1answer
52 views

Iteration variable in variable [duplicate]

Is it possible to create following list by some sort of iteration? {a1,a2,a3,...,a100} I cannot think of any way to append a to ...
3
votes
1answer
134 views

Union of two or more lists

I have a number of lists (only 3 shown here) ...
1
vote
0answers
36 views

Generate a list of values of a function for each value of the parameters already found

The following question is an extension of this question Find all roots of a function with parabolic cylinder functions in a range of the variable. Now I want to use the roots found to calculate a ...
1
vote
0answers
42 views

How to remove brackets from this list? [closed]

I have some lists which have many brackets. I'd like to remove brackets from the lists. For example, I need to change the list ...
2
votes
3answers
100 views

Efficient extraction of a subset

The context is molecular dynamics. The data is in the format (index_1, index_2, distance). The goal is to find all of the distances to the neighbors of point index_0 and to present a set listing the ...
6
votes
3answers
187 views

Merging lists of pairs

I want to add several fluorescence spectra. They are lists of the format ...
1
vote
2answers
121 views

Query in Lists Mathematica - Pivot table

Recently, I finished a simulation, and I got the following data: ...
3
votes
5answers
120 views

How to filter list of list of rules on certain condition?

For example, Solve[] returns all solutions as a list of list of rules. And mine looks something like this: ...
1
vote
2answers
47 views

Formatting a table of values

How do I display a list of values $\{a_1,a_2,\ldots,a_n\}$ in a two column format? --------- 1 | a_1 2 | a_2 3 | a_3 ...... n | a_n I tried ...
10
votes
3answers
350 views

Modifying strings in a list efficiently

I have a list of strings $\{s_1,s_2,\ldots,s_n\}$. I would like to to produce the following list of strings: $$ \{s_1<>1,\ 1<>s_2<>1,\ldots,\ 1<>s_n\} $$ In other words, I want ...
3
votes
3answers
192 views
3
votes
0answers
74 views

speed up evaluating a listable function

I apologize in advance for the vagueness, but I can't think of a more descriptive title. I am trying to find the average value of the square of BesselJ[0, x] ...
2
votes
1answer
44 views

Defining a function which takes lists as it arguments and threads over them [closed]

I want to define a function with lists as variables, which has the form like m = Table[2, {i, 5}]; f[x_, y_] = m*x + x*y; x and y are list variables; m is a ...
13
votes
4answers
334 views

I have the minimum Y value. I want to find the corresponding X value from the list [duplicate]

I have a very big file and contains data in the format of {x,y}. I got the minimum Y value by using data[[All, 2]] // Min[#] & Now I want to get the X value ...
5
votes
4answers
137 views

Create Nested List from tabular data

Im trying to create a nested list from tabular data, then onward into a nested association. I can get part way with the help of this answer but it only works for the first level. Repeated use of this ...
1
vote
2answers
57 views

Using Apply on a function with multidimensional input

I have a user defined function which takes multidimensional input, e.g a function that takes two algebraic variables a and b as well as a matrix m and computes some rule function as: ...
2
votes
3answers
85 views

How to check keys and values in nested Associations?

Considering we have a an association: ...
6
votes
1answer
90 views

Draw from a given list according to empirical distribution

I have two lists, where each time I have age-income vectors. Given the distribution of age in the first list, I would like to draw a sample with the similar distribution of age from the second list ...
7
votes
1answer
113 views

Automatically grouping words into categories

Say I have a comma-separated list of words. For example sake, let it be things I have seen during my trip to a safari zone. It would look something like that: ...
6
votes
5answers
194 views

How convert list of numbers to list of points on x-axis? [duplicate]

I have a list of real numbers, say: vec = RandomInteger[{1, 20}, 6] (* {2, 4, 7, 10, 13, 6} *) I want to convert each of these numbers to the corresponding ...
3
votes
2answers
151 views

Dot product for lists

Suppose we want to get the dot product for the following lists aa and bb, whose elements (a, ...
0
votes
0answers
55 views

Inverse Superposition

There are 4 tables that, I have written them as bellow: (m, n, s, and r are orthogonal basis. r.r=n.n=m.m=s.s=1, and m.n=n.r=...=0). a's, b's, c's and d's are coefficients and are numeric values. ...
2
votes
3answers
87 views

Combining $n$ lists [closed]

From this question, I know how to combine two lists. In fact, if $X_1,X_2, X_3$ are lists with the same length, then the command Transpose[X_1,X_2,X_3] will work in ...
6
votes
3answers
119 views

Evaluate a expression split in a list

I have a list with this format {integer, sign, integer, sign, integer}, sign being one of these: Plus, Subtract, Times, Divide. For example, let's say: ...
3
votes
0answers
101 views

Why is Thread[{ a, b }] the same as Transpose[{ a, b }]?

I understand the idea of both Thread and Transpose, but do not understand whatever nuance it is that makes Thread[{ a, b }] == Transpose[{ a, b }] Where ...
0
votes
1answer
43 views

Bin a large matrix

I have a large dataset and I'm trying to plot its scatterplot as well as an overlayed set of binned "summary" data points (in a different color of course). My intended effect is similar to this one ...
4
votes
1answer
70 views

Query Dataset to check if row contains any from a set of values

For a given keyless dataset, I can query to return the rows whose columns contain a specific value. For example: ...
2
votes
2answers
80 views

Plotting a 2D mapping of a 2 column ASCII

From my SIMS I can export the image mappings in form of a two column ASCII file. For example if it were a 5x5 pixel mapping, it would give something like this: ...
21
votes
2answers
1k views

Why do Mathematica list indices start at 1? [closed]

In most programming languages, container indices start at 0. This is not random or hardware-related; for example Dijkstra's article explains why zero-based indices make sense. What are the reasons ...
5
votes
4answers
253 views

Deleting multiple elements from a list

I have a list with many elements (189) and I want to delete certain elements from it. I have a list of elements I want deleted from it: ...
1
vote
1answer
63 views

How to specify positions in a matrix by an array?

If I have an array of sets of points such as pts = {{2,4},{1,3},{5,7}} Is there any super short command to use those pairs to output their respective elements in ...
2
votes
4answers
92 views

Reshaping list of 2D points by first coordinate

I have a list of (integer) 2d points, and I want to calculate the mean at each point in the first coordinate. So if my data is: ...
4
votes
3answers
192 views

How to combine Date and Time objects into DateTime object?

Considering a DateObject d and TimeObject t: ...
4
votes
2answers
120 views

How can I use sequence in plotting domain?

I would like to plot a function but have a domain defined elsewhere as follows: xrange = Sequence[0, 2π]; Plot[Sin[x], {x, xrange}] However, this doesn't work ...
3
votes
2answers
124 views

Format google places JSON output

I'm have some trouble formatting the Output of a 'Import' request. I get this as a return of a google places API request: ...