Hi all,
I would like to ask if there’s a way to replace a few terms within a polynomial function into another term.
For example of my work, I have a term of
1 - 6 \[Lambda]^2 + 10 \[Lambda]^4
and I would like to replace the term
-\[Lambda]^2
within the the polynomial into X^2,
so that the final answer should be =
1 + 6 X + 10 X^2
Thank you,
Regards,
Syed
mhelmle
(Michael Helmle)
2
In[1]:= eq1 = 1 - 6 [Lambda]^2 + 10 [Lambda]^4
Out[1]= 1 - 6 \[Lambda]^2 + 10 \[Lambda]^4
In[2]:= eq1 /. Power[\[Lambda], n_] -> (-x)^(n /2)
Out[2]= 1 + 6 x + 10 x^2
In order to find out what expression Mathematica is using and which you have to replace you can use
FullForm[eq1]
sghuisman
(Sander Huisman)
3
In general, one can use the function Eliminate:
Eliminate[{f == 1 - 6 \[Lambda]^2 + 10 \[Lambda]^4, -\[Lambda]^2 == x}, \[Lambda]]
Solve[%, f]
to eliminate a variable (lambda in your case) from multiple equations (2 in your case)…