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

learn more… | top users | synonyms (4)

8
votes
2answers
610 views

Mathematica rule substitution memory

First I present the specific programming question, and then I provide further background details. Given an expression in Mathematica, say f=3x+7y, there are two ...
3
votes
3answers
682 views

Changing variables algebraically

Suppose one has two functions, $y(x)$ and $z(x)$, and one seeks to obtain $y(z)$ by substituting $x(z)$ into $y(x)$. Can this be done in a single step? Or must $z(x)$ first be inverted independently? ...
6
votes
3answers
572 views

Arithmetic operation on the value returned by Solve

I want to modify the value that is returned by Solve. Example: SolC1 = Solve[Sin[ π x / L] == 1, x] {{x -> L/2}} I need to add n to x so that x becomes ...
15
votes
3answers
561 views

Using results of Reduce

Suppose I have function f: f[x_, y_] := 50000 + x 30000 + y 35000; Now I want to find the x and y when f[]<=200000. I use Reduce: ...
6
votes
3answers
288 views

Replacement rule only matches part of expression

I have the result of a calculation (which is too long to mention here) and it gives ...
4
votes
1answer
152 views

Replace rule does not match

I have the following expression -3 I Ez Re[Ex] + 3 I Ex Re[Ez] And I wish to write this in the form ...
4
votes
1answer
255 views

Replace rule also matching complex numbers

I'm having the replace rule: rule = {-g_ x_^4 - 2 g_ x_^2 y_^2 - g_ y_^4 -> -g (x^2 + y^2)^2}; Now, ...
9
votes
3answers
804 views

Replace expressions with symbols

First of all: I'm new to mathematica, so I would appreciate it if the answers are quite complete. I have the result of calculation that is expressed in $\sin$ and $\cos$. Now, all of these can be ...
10
votes
7answers
2k views

How do I replace a variable in a polynomial?

How do I substitue z^2->x in the following polynomial z^4+z^2+4? z^4+z^2+4 /. z^2->x ...
32
votes
3answers
440 views

Replace inside Held expression

I wish to make functional replacement inside Held expression like this: ...