# Tagged Questions

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

34 views

### Replace variable with other variable containing a constant in differential expression [duplicate]

I have the following differential expression: ...
91 views

### Check an Option without Evaluation

Consider the following: ...
46 views

### ReleaseHold NIntegrate after Replace variable

I would like to calculate the sum of square of two integral(Ex and Ey). I first hold this two integral because two variables(tx, ty) are not specified.Then, I replace tx,ty and releasehold $Ex^2+Ey^2$....
59 views

### How do I use Replace All? [duplicate]

I have an expression: a + b 2^(1/2) + (c + d 2^(1/2))*I I want to replace each occurrence of 2^(1/2) with ...
72 views

### Replacement producing unexpected result

If I use a replacement rule like ...
34 views

### TensorContract with KroneckerProduct instead of ordinary Times

Is it possible somehow to contract two tensors, say A={{a1,a2,a3},{a4,a5,a6}} and B={b1,b2,b3}, where the elements ...
176 views

### What kind of patterns in a list of rules would benefit from being Dispatched?

I have a long list of rules for manipulating expressions. They are of the form: ...
121 views

### Function not returning number [closed]

I am quite new to Mathematica and I guess this question is really basic, but I can't figure it out myself. I'm making a simple notebook that plots a Hamiltonian function, a plane of constant energy, ...
60 views

### Can't operate on vector within a list of rules

I'm trying to set up a list of rules which includes the following: ...
45 views

### Unevaluated derivatives of known functions after replacement

I want to make the following replacement work correctly: Array[(2 D[xM[[#1]][t], t] * D[xM[[#2]][t], t]) &, {3, 3}] /. {xM -> {Sin[ω t], Cos[ω t], 0}} ...
528 views

### Replace rule with function? Derivatives don't evaluate

Say I have an expression (call it expr) involving a function, f[x]. I'd like to be able to evaluate that for a particular choice of ...
37 views

### Replace function and its derivatives [duplicate]

When I have a complicated expression that depends on some variable, say, $f$, the following usually works ok: Expression ./ { f-> x^2 } But if $f$ is a ...
935 views

### Replacing Tan[x] with Sin[x]/Cos[x]

Why doesn't this work? (1 - Tan[x])/(Sin[x] - Cos[x]) /. Tan[x] -> Sin[x]/Cos[x] I get back: ...
95 views

### How to make this particular replacement involving exp

I apologize if similar questions have already been asked, but I have some difficulties with replacements in Mathematica and I would like to make a substitution like ...
47 views

### Solving a trigonometric equation for all $x$ using constant coefficients

I want to find the coefficients $a$, $b$, $c$, etc. that make an equation like $a+bx=x$ true for all $x$, but for trigonometric functions of $x$. For example ...
63 views

### Composition of rules: a->b + b->c = a->c

I am trying to compose two rules to form a new one: {a -> b, b -> d} and {b -> c} should become ...
69 views

### Convert an expression to use a specific analytic form

I have an expression that evaluates to an expression containing multiple ExpIntegralEi expressions. However, I would prefer that Mathematica use ...
132 views

28 views

### Why variable in SparseArray can't be replaced? [duplicate]

SparseArray[{1, 1} -> t] /. t -> 1 Still contains t. Why t is not replaced by 1?
83 views

### how to change Symbol to other symbol?

I have Input =a**b**c I want to have output such as {a,b,c} So I want to change **->, but replace code does not work. How ...
172 views

### Using NDSolve initial conditions as parameters for a function and then a replacement rule

I am trying to make a function based on two initial conditions of a set of differential equations: ...
80 views

### How to replace $-x^{}\,y^*-y^{}\,x^*$ by $-(x^{}\,y^*+y^{}\,x^*)$?

Up to now, I have tried some codes like the following: ...
112 views

### why doesn't the replacement rule work?

I have the following code: ...
94 views

### Simplifying an expression with complex variables

The other day I was trying to simplify the following expression of $w \in \mathbb{C}$ and $|w| < 1$: f(w) = \left|\frac{2}{(\frac{w+1}{1-w}+1)^2}\right|^{-\Delta} \cdot \frac{1}{\left|{\rm Re}(\...