Linked Questions
18 questions linked to/from What do brackets around a levelspec option do?
0 votes
0 answers
174 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} ...
62 votes
9 answers
5k views
Levels: how do they work?
I cannot understand how Mathematica manages levels, and so it's always a painful try-and-fail to use Flatten. Can someone please give me a very clear definition? ...
65 votes
12 answers
112k views
Assign the results from a Solve to variable(s)
I understand Mathematica can't assign the results of a Solve to the unknowns because there may be more than 1 solution. How can I assign the 4 values of following result to variables? ...
52 votes
2 answers
8k views
Scan vs. Map vs. Apply
I cannot understand the difference between Apply, Scan, and Map. I have tried to play with ...
17 votes
2 answers
738 views
ReplaceRepeated seemingly omits some rules
Is there a simple way in Mathematica to prevent rule reordering? Let me give an example: ...
5 votes
3 answers
2k views
Determine if a variable appears in an expression or not?
Consider an arbitrary expression expr. This expression may contain arbitrary data, like integers, variables, implicit functions etc. Now, I would like to determine ...
9 votes
5 answers
367 views
Prevent testing Head with ReplaceAll
I have a list of strings list. I am trying to get rid of some elements that match string pattern patt: ...
9 votes
3 answers
721 views
Accumulate second elements in sublist
I want to accumulate the second elements in each sublist identified by its first element. ...
3 votes
3 answers
2k views
Use map on a different level
I have just started to get used to Mathematica's Map, Apply, and related functions, and I can't figure out how to do maps that require working "one level down". For example, I am currently trying to ...
3 votes
3 answers
277 views
Replace For with If in Mathematica way
I have this code: ...
1 vote
2 answers
474 views
How to apply function f for each time value t, to each pixel from image, resulting in t images
I have a 2D array of complex values and I want to apply a function to every entry of the array, for every timepoint t in a list. I know how to apply my function to one entry for every time t in a list,...
4 votes
3 answers
376 views
Variable partitioning of the data in the form of "list of lists"
I am looking for a way for variable partitioning of the data in the form of a "list of lists" for interpolating the imported data from excel. The data looks like: ...
1 vote
1 answer
2k views
Collect and simplify both the coefficents and the matched patterns
(This is a far tighter version of a previous question I asked) The problem with Collect is that while Collect[exp, pattern, Simplify] will simplify the coefficients,...
4 votes
1 answer
640 views
How to efficiently Flatten nested lists while preserving select levels? [duplicate]
I have lists of sets of variables, some in nested sub-lists: t = {{1, 2}, {3, 4}, {{5, 6}, {7, 8, 9}}} I need to flatten this list in place but preserve the sets....
5 votes
1 answer
281 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 ...