Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

# Questions tagged [replacement]

Questions about Mathematica's rule-based replacement functionality, including functions such as Rule (->), Replace, ReplaceAll (/.) and ReplaceRepeated (//.).

1,054 questions
Filter by
Sorted by
Tagged with
54 views

### Simplifying polynomial in one variable by substitution

I want to simplify a polynomial in variable $x$ with integer coefficients by substitution $x\to{x}/d$ so that the coefficients become smallest possible integers. Input: ...
28 views

### ReplaceRepeated multi-part pattern

This workaround does what I'd like to have happen: ...
32 views

### Delayed Rule right-hand-side mis-evaluation

Outline I am trying to create a rule that will give me a minus sign if the number of times A is applied on X is odd where A is some οperator and X a random quantity. Some of the configurations of ...
38 views

### Filter out terms that include any combination of F[X] and G[-X]

I have the following problem which is closely linked to a previous question I asked some time ago (Replacement rule for terms that are separated by operators?). In this specific instance, suppose I ...
30 views

### Rule Replacement Fails with Embedded Conditional

I was using a rule replacement that creates a matrix. At one rule, I added a conditional to return one vector and then added that (after the conditional and within the same replacement) to another. ...
32 views

### Replace expressions

Let's consider the following example ...
34 views

### The replacement function is an integral and the double integral yields a different answer than the normal double integral

I am fairly new to Mathematica. I have a quick inquiry. The code is simple and just 3 lines. Trying to do a replacement rule as follows ...
84 views

### ReplaceList Except Alternatives bug

Bug introduced in 11.3 or earlier and persisting through 12.0 or later [CASE:4352435] and [CASE:4354378] In Mathematica 11.3 and 12.0, ...
29 views

### Suppress arguments in output for pretty print [closed]

I would like to define a rule that suppress any arguments of a function for visibility. I tried: rule = f_[x__] -> f While this works well with individual ...
55 views

### Handling a list of variable assignments to be used with With [duplicate]

Is there a way to use With as follows? variables := {a = 2, b = 3}; With[variables, a^b] Desired output ...
35 views

### making replacements when patterns don't match exactly

I want to simplified some mathematical expressions, and they are similar to ...
46 views

### TagSetDelayed for spotting zero derivatives

I am trying to implement my own differential operator, d[arg_, var_], that computes the derivative of arg w.r.t. ...
31 views

### Tracing & Modifying a Function (Replace All) [duplicate]

For the function: f[x_Plus] := Apply[Times, x] f[a + b + c] Out[]= abc This is clear, as the Times is applied to the list with Plus head in f. However, when ...
35 views

### Manipulation replacements rules from Solve [closed]

Assume the call to the routine Solve[eqn==0,{x1,x2}] returns: {{x1->a1,x2->a2},{x1->b1,x2->b2}} I would like to ...
31 views

### Replacing in FeynCalc

I started to take the trace of some terms in FeynCalc package. I encountered a problem in replacing. Here is my problem: ...
59 views

### Assign Values from Array to Array [duplicate]

I am trying to simply do the following cVec = {a,b,c,d} From another expression, I obtain another vector, say, ...
25 views

### Variable subscript substitution - easy way?

I have a Mathematica expression with about 900 terms, that looks roughly like this: $X_{1,1} + Y_{1,2} + Z_{1,3} + XX_{1,4} + XY_{1,5} + ...$ Is it possible to perform a fast method to copy this ...
35 views

53 views

### How to use replace for only one term in a long expression in Mathematica?

I am doing some Cauchy integration and in some intermediate steps I have something that looks like that: (..many_terms...+I*\epsilon(k1-p1))/k1 where ...