1k views

### How to replace the first occurence in an expression instead of replacing all?

Is there a function that replaces the first occurence of the expression instead of replacing all? For example, if I have HoldForm[x + 2 + 4 + x] /. x -> 4, is ...
418 views

### Evaluation of Alternatives

I recently stumbled upon a few examples that suggest patterns containing Alternatives do not evaluate for individual alternatives. For example: ...
461 views

### Pattern does not match with Orderless head

Why does the following pattern matching not succeed? ...
473 views

### Matching (y/x)^u terms wherever the appear in an expression

Mathematica keeps rewriting expressions, so it is hard to figure what pattern to use. I am trying to replace all occurrences of $\frac{y}{x}$ by $t$, but Mathematica re-writes \$\frac{1}{\left(\frac{y}...
519 views

### Using MatchQ (or other means) to parse an expression using sums of COS or SIN correctly

I am writing a function that will take an expression as input. I want to make sure the expression is valid first before processing it. Looking for a correct to use ...
474 views

### Extracting argument sequences from function expressions

Why is it that fun[x, y] /. fun[z__] :> z leads to Sequence[x,y] but ...
274 views

### FullForm of b/c and c/b with different order

I am studying Mathematica myself and doing some exercises for improvement. Question: Try to guess the internal forms of b/c and ...
135 views

### Apply functions to a BlankNullSequence

I'd need to apply all functions in a list to a BlankNullSequence (___) But when I tried ...
122 views

### MatchQ failing in some cases with Hold [duplicate]

Could someone clarify why the first of these MatchQ finds a match whereas the second does not? (I'm using version 10.0, in case that matters.) ...