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

learn more… | top users | synonyms (4)

1
vote
0answers
48 views

Apply ListPlot to various data sets [duplicate]

Assume that I have data in the form: list = {{{1, 2, 3}, {10, 10, 10}}, {{4, 5, 6}, {20, 20, 20}}} I want to plot ...
3
votes
1answer
49 views

Remove cases where region specified incorrrectly

I am using MeshPrimitives to get a list of 3D components of a Mesh Region. Within that list, I normally get some incorrectly specified regions, such as ...
1
vote
2answers
58 views

Combining data sets by adding y values [duplicate]

Suppose I have the following list of data {{1,2},{1,5},{6,1},{1,3},{2,1},{2,2},{2,3},{5,4},{5,2}} This is similar to my actual data in that each x value has ...
2
votes
3answers
112 views

Positions of elements in a list [duplicate]

I have two lists: list = {1, 2, 3, 4, 5} slist = {3, 5} I want to find the positions of the elements in slist in list. I tried it like this and I dont understand ...
-1
votes
0answers
46 views

Mixing tensorial calculation

I would like to know if there is solution of this problem: Let \begin{align*} a & := \left(1,x(t),\int_0^t\int_0^{s_1}dx(s_2)\cdot dx(s_1)\right)\\ b &:= ...
4
votes
3answers
262 views

Efficiently test membership for a list of values

I have two lists: excluded and values. I would like to efficiently determine whether ...
5
votes
2answers
208 views

What is the idiomatic way to shift and extend a list by a number of elements?

I have a lists, list, and want shift it right by a given number of elements, m, extending the list by repeating the last ...
4
votes
2answers
66 views

How to delete blank valued keys from nested association?

Considering we have: acs = <|"A" -> <|"a" -> " ", "aa" -> "asd"|>, "B" -> <|"bb" -> " "|>|> How can we come to have a result ...
3
votes
2answers
68 views

Retaining relative sizes of local maxima using MaxDetect[List]

I would like to be able to find the position of the two greatest local maxima in a list. For the example: list={1,2,3,4,2,1,2,6,5,4,3,2,} I would like to return ...
4
votes
3answers
69 views

Replace values in a list based on conditions

I have a list with negative and positive numbers list = {-1, -2, 1, 2} and I want to replace all negative values with 0 and all positive values with 1 ...
2
votes
1answer
63 views

How do I define a random variable involving Part?

I need to define a random variable that involves Part, but when I try, for example ...
0
votes
1answer
72 views
16
votes
10answers
681 views

Count the sequences in an array

Is there a short and easier way to count number of sequences 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
38 views

Join data imported in different variables [closed]

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
83 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
27 views

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

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
54 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
130 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? [closed]

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
113 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
161 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
72 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): ...
2
votes
2answers
97 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
196 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
29 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
49 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
56 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
138 views

Union of two or more lists

I have a number of lists (only 3 shown here) ...
1
vote
0answers
37 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
50 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
101 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
197 views

Merging lists of pairs [duplicate]

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

Query in Lists Mathematica - Pivot table

Recently, I finished a simulation, and I got the following data: ...
3
votes
5answers
128 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
72 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
357 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
196 views
3
votes
0answers
77 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
0answers
45 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
346 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
159 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
58 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
89 views

How to check keys and values in nested Associations?

Considering we have a an association: ...
6
votes
1answer
94 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
125 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
203 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
155 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
60 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. ...