26
votes
Accepted
How to extract parts from atomic expressions like DelaunayMesh and Graph?
I'm going to take this as a general question, referring to all atomic objects, not just DelaunayMesh.
By design, atomic objects like ...
24
votes
Accepted
Shorthand for map at level 2
Corrected to use SubscriptBox as Rojo showed and Kvothe commented, fixing binding.
Rojo shows a way in Is it possible to define custom compound assignment ...
24
votes
Can we intelligently control evaluation in Thread?
Analysis of the problem
All functions in Mathematica either hold one or more of their arguments, or per The Standard Evaluation Procedure the arguments are evaluated before the function is applied. <...
24
votes
Cleanest way to take a[b[c]] to a[b][c]
test = a[b[c[d]]];
Fold[
Construct, (* or Compose, see [1] *)
Level[test, {-1}, Heads -> True]
]
a[b][c][d]
[1] - ...

Kuba♦
- 136k
22
votes
How to extract parts from atomic expressions like DelaunayMesh and Graph?
Motivation
Recently, I wanted to extract parts of an atomic expression, and my first thought was to use a ToExpression/ToString ...
21
votes
How to extract parts from atomic expressions like DelaunayMesh and Graph?
I think this is the simplest fast way to convert an atomic expression to an equivalent compound form, to be able to inspect and manipulate its "apparent" full form:
...
21
votes
Accepted
Custom atomic expressions - modern tutorial
I have a new package for speeding up the construction of things like these which I discuss at the end
Atomic vs Valid
These are two related but distinct concepts. The former indicates that we can't ...
20
votes
19
votes
Accepted
How can I obtain a complete list of the kinds of atomic expressions in the Wolfram Language using only the language itself?
You can use EntityValue to find out what symbols can be atomic:
...
18
votes
Accepted
When is the righthand side of a RuleDelayed evaluated?
There seems to be a subtlety in the way delayed rules are used. Have a look at the following:
...
18
votes
Can we intelligently control evaluation in Thread?
First, let me tell you that my answer here is by no means a replacement for the trickier, but more capable implementation of Mr. Wizard. What I want to show is that the examples I point out at the end ...
17
votes
Accepted
List of atomic expressions
You can executive the code in mma 10 or above version
EntityClass["WolframLanguageSymbol", "Atomic"]//EntityList
But is not all atomic function,as I know.
17
votes
Accepted
16
votes
How to replace the first Head of a currying expression like "a" in a[b,c][d]?
y = a[b, c][d];
y[[0, 0]] = w;
y
(* w[b, c][d] *)
16
votes
Accepted
Evaluated vs. unevaluated Association
Summary
The confusion we observe here is largely due to ambiguous use of the symbol Association as an expression head. On the one hand, ...
15
votes
Accepted
First order approximation
You can use Series to specify the order of approximation. When an expression involving the output of Series, which is a ...
15
votes
Accepted
Joining two lists with relational operators
Thread[liste - listv <= 0] // Reduce
2 <= y <= 3 && z >= 4 && x <= 1
...

Kuba♦
- 136k
15
votes
Is there a way to to substitute for symbols, simplify, and back-substitute?
This comes up often. Here are links to related MSE threads.
Rename terms of polynomials
Collecting factors of polynomials
Can I simplify an expression into form which uses my own definitions?
...
14
votes
Accepted
14
votes
Shorthand for map at level 2
I'm not aware of a simple one, but perhaps you could make your own? The following is not great because it requires you to enter CenterDot as Esc+.+Esc, and you can'...
14
votes
Is there a way to to substitute for symbols, simplify, and back-substitute?
You could use Simplify or FullSimplify with your transformation rules as assumptions, expressed as equations:
...
14
votes
Accepted
How to replace $x$ and $x^2$ with different value?
Give the replacement rules in a list:
expr /. {x^2 -> k p + k (k - 1) p^2, x -> k p}
2 k p + (-1 + k) k p^2
14
votes
Accepted
Conflict with hidden names
First, you should never give Plus a downvalue. Always give your symbol upvalues instead by using TagSetDelayed. Giving such a ...
13
votes
Accepted
Factoring out a common term
Defining a function like
Clear[FactorByVariable]
FactorByVariable[p_,c_]:=c Expand[p/c]
will be one of the simpler options. The argument ...
13
votes
Which operation combines {f,g,h,...} and y[u,v,w,...] to get y[f[u],g[v],h[w],...]?
Using Mapthread
innerMap[funcs_, expr_] := Head[expr] @@ MapThread[#1[#2] &, {funcs, List @@ expr}]
innerMap[myFuncs, expr]
...
12
votes
Accepted
How to replace the first Head of a currying expression like "a" in a[b,c][d]?
For arbitrarily nested heads I would use recursion and pattern matching, like this:
...
12
votes
Can we intelligently control evaluation in Thread?
Specific solutions
Since my goal is for not only this Question to become canonical but also my solution my function must be applicable to most cases that come up.
Threading behavior of SameQ vs ...
12
votes
Accepted
Separate or order the positive and negative terms of an expression
Perhaps something like:
Values @ GroupBy[
List @@ (b+c^2-c^2+a^4-c^5),
Internal`SyntacticNegativeQ,
Total
]
{a^4 + b, -c^5}
Addendum
OP requested ...
12
votes
Split expression into list of terms
ClearAll[terms]
SetAttributes[terms, HoldAll]
terms[Plus[a__]] := {a}
terms[a_?AtomQ] := {a}
terms[a_] := a
Examples:
...
11
votes
Accepted
Evaluation of Alternatives
The two examples in this question relate to two different aspects of pattern matching. I will start with the simpler to understand and intentional aspect, which is the second example.
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
expression-manipulation × 764simplifying-expressions × 141
replacement × 73
symbolic × 58
pattern-matching × 54
list-manipulation × 51
algebraic-manipulation × 51
function-construction × 44
functions × 41
evaluation × 33
equation-solving × 30
calculus-and-analysis × 25
output-formatting × 23
polynomials × 23
hold × 20
string-manipulation × 19
syntax × 16
expression-construction × 16
plotting × 15
matrix × 15
performance-tuning × 15
rule × 15
special-functions × 14
complex × 13
series-expansion × 13