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

learn more… | top users | synonyms (3)

3
votes
0answers
98 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 ...
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: ...
5
votes
4answers
252 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: ...
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 ...
3
votes
2answers
122 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: ...
4
votes
1answer
159 views

Sow only if different from zero

I am trying to collect elements with Reap and Sow, where I am interested only in non-zero elements, that is I am trying something like that ...
9
votes
2answers
298 views

Complement on pre-sorted lists

Is there any way to instruct Complement to skip the sorting part? If the answer is no (likely), the next question would be: how can I remove from a sorted list ...
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 ...
0
votes
1answer
187 views

Making table and plotting results of NDSolve problem

I am trying to solve two equation to find /[Phi][x] and plot h vs. /[Phi][x] for different values of L.I tried by writing as: ...
4
votes
3answers
192 views
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 ...
6
votes
5answers
291 views
2
votes
5answers
183 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
56 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: ...
10
votes
2answers
180 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 ...
9
votes
2answers
184 views

Checking if one partition is a subpartition of another

Say I've got two partitions of a list (not necessarily containing numbers, and not necessarily distinct), and I want to check that one is a subpartition of the other. Let's look at some examples: ...
11
votes
5answers
410 views

Most efficient way of making pair list from a list

I have a bunch of datasets which looks like: 3 7 1 6 5 8 2 4 1 2 8 1 5 2 5 ... and I need to make a list of pairs such that the first element makes a pair with ...
0
votes
1answer
56 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
76 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. ...
12
votes
4answers
626 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) ...
1
vote
4answers
420 views

Summation over 3 lists

I have three lists. As an example, a = {10, 5, 6, 8, 7}; b = {4, 8, 9, 7, 9}; c = {7, 5, 12, 4, 1}; I want to get: $$ x(i)=\sum ...
0
votes
0answers
63 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
1answer
56 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 ...
1
vote
0answers
85 views
3
votes
0answers
65 views

Partitioning Table

I have a long vector array in the following format: ...
9
votes
2answers
341 views

Intersection for lists of numeric data

I know that Intersection is a pattern matching function and will not evaluate list elements to determine if two or more list have equal elements. So my question is, ...
1
vote
2answers
46 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
73 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, _}].
0
votes
0answers
39 views

FinancialData, comparing returns accounting for different holidays

At the moment I am trying out the FinancialData feature of mathematica. I am a bit struck with the problem of dropping returns for dates of a list of different stocks not being equal for all stocks ...
0
votes
0answers
44 views

Output of List formatted strangely

I'm running a monte carlo simulation which uses random input data and performs calculations on it, and then outputs a 100 by 100 sized array with my data. The code works without a problem but for some ...
0
votes
0answers
57 views

Adding error bars in bar chart using a list

I know this must be a very basic question, but I don't know much of Mathematica and was not able to find any answers online. I have imported an Excel file with two sets of values. ...
1
vote
0answers
47 views

Learning mathematica, ListPlot [closed]

I am trying to teach my self Mathematica. I am working with the following example: ...
7
votes
5answers
503 views

Calculating weird numbers

A weird number is a number such that the sum of the proper divisors (divisors including 1 but not itself) of the number is greater than the number, but no subset of these divisors sums to to ...
9
votes
1answer
153 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
56 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
59 views

Data manipulatation with MapAt and Join

I would like to make data like: {{a1, a2}, {b1, b2, b3}, {c1, c2}, {d1, d2, d3}} -> {{a1, a2, b1, b2, b3}, {c1, c2, d1, d2, d3}} by using ...
0
votes
2answers
85 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 ...
0
votes
0answers
44 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
47 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 ...
1
vote
1answer
50 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 ...
1
vote
1answer
66 views

Manipulate of Region Plot

I try to illustrate a generation of an amoeba to a tropical curve, namely. ...
0
votes
0answers
49 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 ...
4
votes
1answer
121 views

Applying function to cartesian product of two lists

I have two lists X = {1, 2, 3}; Y = {5, 6, 7, 8}; I want to apply function g[x,y_,z_] to all pairs from X*Y, so I need to ...
0
votes
1answer
83 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 ...
11
votes
3answers
455 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. ...
0
votes
1answer
74 views

How to remove the list bracket in some expression?

I have two problems with the List bracket {}. First, I want to get a specific component of LeviCivitaTensor, so I should use ...
0
votes
2answers
46 views

Troubleshooting Program Meant to Swap Elements

I wrote a program that is supposed to take a list (of arbitrary length) of pairs of the digits of binary numbers (e.g. ...