I want to eliminate variables from an equation using MATLAB. For example, lets consider the following equations:
p = (m + n)
q = (m - n)
r = (m^3 - n^3)
Now, r
could be expressed in terms of p
and q
by entirely eliminating m
and n
like this: r = (3*p^2*q + q^3)/4
.
This can be achieved in Mathematica using the following method:
Eliminate[{p == (m + n), q == (m - n), r == (m^3 - n^3)}, {m, n}]
How can I get the same result in MATLAB if it is possible at all. Switching between different applications just for this is very inconvenient.