Skip to main content

symbolic - Efficient code for solve this equation


We have $a*b*c=-1$, $\frac{a^2}{c}+\frac{b}{c^2}=1$, $a^2 b+a c^2+b^2 c=t$


What's the value of $a^5 c+a b^5+b c^5$?


I tried


Eliminate[{a b c == -1, a^2/c + b/c^2 == 1, a^2 b + b^2 c + c^2 a == t, 
a b^5 + b c^5 + c a^5 == res}, {a, b, c}]


It's much slower than Maple's eliminate. How do I solve this efficiently?



Answer



If you use the third argument in Solve, i.e. a list of variables to be eliminated (take a look at the Eliminating Variables tutorial in Mathematica) then you'll get the result immediately :


Solve[{a b c == -1, a^2/c + b/c^2 == 1, 
a^2 b + b^2 c + c^2 a == t,
a b^5 + b c^5 + c a^5 == res},
{res}, {a, b, c, t}]



{{res -> 3}}

Edit


It should be underlined that Solve appears to be smarter than Eliminate due to its improvement in Mathematica 8, look at its options, e.g. MaxExtraConditions, Method ( Method -> Reduce). However most of the update of Solve is hidden, but in general it shares its methods with Reduce. Defining


system = { a b c == -1,
a^2/c + b/c^2 == 1,
a^2 b + b^2 c + c^2 a == t,
a b^5 + b c^5 + c a^5 == res };

then it works too



Solve[ system, {res}, {a, b, c}]


{{res -> 3}}

while it doesn't in Mathematica 7 yielding



No more memory available.
Mathematica kernel has shut down.
Try quitting other applications and then retry.


and your original problem should be evaluated this way (you've lost t):


Eliminate[ system, {a, b, c, t}]


res == 3

and it works in Mathematica 7 as well.


Comments