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

learn more… | top users | synonyms (5)

10
votes
3answers
420 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
377 views
3
votes
0answers
84 views

speed up evaluating a listable function [duplicate]

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
53 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
410 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 ...
7
votes
4answers
225 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
67 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: ...
3
votes
3answers
147 views

How to check keys and values in nested Associations?

Considering we have a an association: ...
6
votes
1answer
139 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
203 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
271 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 ...
4
votes
2answers
172 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
79 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. <...
3
votes
3answers
103 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
142 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
127 views

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

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 ...
1
vote
1answer
126 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
144 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
103 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: ...
26
votes
2answers
2k 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
662 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
74 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
105 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: ...
6
votes
4answers
314 views

How to combine Date and Time objects into DateTime object?

Considering a DateObject d and TimeObject t: ...
4
votes
2answers
142 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
174 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: ...
2
votes
5answers
253 views

Add values from a list, at positions from a list, to a matrix

I'm investigating matrix assembly and one of the things I'm trying to do is add specific values to a larger matrix based on a list which is essentially defining connectivity of nodes. For example: ...
1
vote
1answer
130 views

Factor terms by kets

I have an expression that contains several kets with numerical factors. I would like to retrieve the individual kets and store each individually as a list element. The expression is as follows: <...
0
votes
0answers
55 views
11
votes
2answers
2k views

Estimating the full width half maximum of a peak

I have a dataset of which I'm attempting to determine the full width at half maximum. A picture of the data is given below, and the dataset itself can be found here (pastebin). Now, this set has a ...
0
votes
1answer
64 views

Mining for matching elements of sets with equal divisors

This problem is extrapolated from a problem that was solved on how to manipulate lists of set outputs as a union ( Equation Autogeneration ), where the concern now is how to mine for (or attain from ...
1
vote
1answer
169 views

Absolute uncertainty and error propagation with lists [closed]

I am trying to do some error propagation using mathematica. This is my second day using the program. I am trying to take the derivative of a numerical function that is made up of the following lists. ...
1
vote
1answer
70 views

How to perform multi-columns selection and/or !MemberQ on large lists with speed?

This question (2 subquestions) is connected to How to speed up Select with MemberQ for large lists? Q1: I would like to have an alternate version of the form below to do a multi-columns selection on ...
12
votes
4answers
648 views

What's the function that takes X[Y[z___]] to Y[X[z___]]? (“swap heads”)

I've seen the operation described in the title before (basically, swap the heads of the first two levels of an expression), but I can't find it... Does anyone know the function (or idiom/incantation) ...
3
votes
1answer
99 views

Partitioning Table

I have a long vector array in the following format: ...
0
votes
0answers
76 views

Equation Autogeneration

The following is resubmitted as edit here to reflect suggested formatting corrections so indentations separate the lines neatly. I also fixed the unknown D variable which I actually meant to state as ...
1
vote
2answers
55 views

Insert several rows and problem with Return

I wanted to write myself a function that makes it possible to Insert several rows into one list. ...
1
vote
1answer
81 views

I want the length 3 words on alphabet {0,1,2} with no two consecutive 1's [closed]

I tried this code but it doesn't work. DeleteCases[Tuples[{0, 1, 2}, 3], {_ 1, 1, _}].
1
vote
0answers
69 views

Learning mathematica, ListPlot [closed]

I am trying to teach my self Mathematica. I am working with the following example: ...
0
votes
1answer
59 views
10
votes
1answer
337 views

Lexicographic ordering of lists-of-lists?

I was surprised to discover that Mathematica does not sort lists-of-lists (LLs) lexicographically by default. For example, applying Sort to ...
0
votes
1answer
64 views

Transforming a vector in a loop without modifying the original vector

How can we apply a duty on elements of vectors but they remain unchanged for the next processes: For instance we have a process governed by these lines. However, in one loop process some elements of <...
0
votes
0answers
49 views

vector product defined on kronecker delta [duplicate]

I have some vectors such as : a={{0}, {0}, {0}}; b={{1}, {1}, {1}}; c={{1}, {1}, {0}}; I wanted to product a by ...
1
vote
1answer
52 views

2D plot using Manipulate command [closed]

Can anyone tell me what the problem is with the following code: y[x_ a_] := Sin[x (1 + a x)] Manipulate[Plot[y[x a], {x, 0, 6}], {a, 0, 2}] However, the ...
0
votes
2answers
96 views

vectors constructed with $0,1$ permutation

Our desire is to construct $2^N$ vectors with indices $i=1,..,2^N$ with elements by permutation of $0$ and $1$. For example ($N=3$): We write below code ...
2
votes
1answer
150 views

Sum over multiple indices that take specific values

Pretty simple question: how do I sum over multiple indices that can only take specific values all together? To clarify: let's say I have the following sum: $\sum p_{a,b,c} f(a,b,c)$ where $f$ is a ...
0
votes
0answers
78 views

How to efficiently find period orbits in a series defined by recurrence relation?

I have a series defined as $z_{n+1} = z_n^2 + c$, which is the series for the Mandelbrot set. I have defined it, in order to plot the set, as ...
1
vote
1answer
142 views

Manipulate of Region Plot

I try to illustrate a generation of an amoeba to a tropical curve, namely. ...
1
vote
1answer
178 views

Matching entries then finding positions of two lists

I'm trying to analyse data with Mathematica. I have a big array with various columns representing timestamps and then lots of data. I have some code that will produce a list of timestamps when the ...
13
votes
3answers
881 views

Subtracting two plots from each other after shifting one

I have the following lists representing energy spectra that need to be subtracted from each other to produce a difference spectrum. ...