How do I substitue z^2->x in the following polynomial z^4+z^2+4?
z^4+z^2+4 /. z^2->x
gives
z^4+x+4
|
How do I substitue
gives
|
||||
|
|
|
The reason why the replacement doesn't work is that replacement rules are not mathematical replacements, but pure structural replacements. Therefore the replacement Also note that rules operate on the internal form, which doesn't always match the displayed form. For example, one would expect To do the replacement wanted, one has to use a method which is aware of the mathematics instead of just the structure. One possibility is
which means "Solve the equations given for p while eliminating z". The result then is
Note that the curly braces around |
|||
|
|
|
How about using
Alternatively we can use the third argument of
Note that the braces around |
|||||||||
|
This is similar to the For further detail on this approach, might have a look at some responses to these questions: |
||||
|
|
|
I'd do
In this particular case, at least (which of course may not work in more general situations, for example with odd powers of |
|||||
|
|
|
In the same vein as Daniel's answer (since the functions are definitely related):
|
|||
|
|