24 questions linked to/from Levels: how do they work?
353 views

### Position with test for list of lists [duplicate]

Why do I get this error message? It seems to me that the level specification should have done the job. ...
• 1,610
242 views

### Levelspec range with negative levelspec

Documentation states A negative level -n consists of all parts of expr with depth n. However, it is not clear what do level ...
• 1,540
155 views

### What exactly do single brackets represent syntactically?

I'm trying to deepen my understanding of the mathematica language after having messed around with it for a long time. I'm reading the book "mathematica programming Intro". Unfortunately, I don't ...
• 545
1 vote
381 views

### Extract all elements from a list that belong to a set or have a set element as an argument

EDIT: Added that I want to extract not only the variables from a specific set, but also functions involving variables from a specific set. Given the set ...
• 21
354 views

### Mapping on leaves

Say I have some nested structure, such as {a,{{b,c},d,{e,{f,g}}}}, and I want to apply a function $q$ to each of the leaves; that is, I want the output to be ...
• 4,209
242 views

### Why Cases and Select treat the List differently?

Look at these two examples: In[1]:=Select[f[i], MatchQ[_f]] Out[1]:=f[] In[2]:=Cases[f[i],_f] Out[2]:={} It seems that the Select take $f[i]$ as List, but Cases ...
• 397
1k views

### What do brackets around a levelspec option do?

The following code returns the first three integer elements of Sqrt[Range[100]]: ...
• 1,471
279 views

### Levels and slots

I am struggling with levels and #, if I understand this I think I will be able to grasp the entire concept. ...
• 1,219
214 views

### why Level does not sort output according to their levels

Consider this example: Level[a + f[x, y^n], {0, Infinity}] (*{a, x, y, n, y^n, f[x, y^n], a + f[x, y^n]}*) Why the output is sorted in this way. why not ...
• 19.9k
82 views

### Higher functional programming partial substitution

This h[g_, x_] := g[x] h[Sqrt, x^2] works obviously as well as : f[x_]:= x^2 h[f,x] but if ...
• 4,592
1 vote
68 views

### How to use syntax instead of double for loop

I would like to find the distance between a point list (i.e dalist) and list of centers (i.e framecenters). I used the following ...
• 501
1 vote
60 views

I am not sure to really understand how the function Apply works at level 2 for example. I have read this question and few others and it doesn't help me :Levels: how do they work? Take the following ...
• 2,164
145 views

### Indicate level with Replace [duplicate]

Replace[{{x^2, Sqrt[x]}, {x + 1, x - 3}}, f_[x__] -> f, 1] Level 1 of Replace works here as expected with output {List,List} ...
• 2,311
45 views

### Understand the notion of level with apply [duplicate]

There is something I don't understand with the notion of levels with apply. I take this example : Apply[f, {{a, b, c}, {d, e}}, {2}] Mathematica answers me : <...
• 2,164