4
$\begingroup$

I have two problems which I'd like to solve with Mathematica.

If I have a system of two equations with three unknowns, how can I get to list all possible solutions for the unknowns?

Here is what I have tried:

Solve[{ a + b + c == 5, 1/a + 1/b + 1/c == 1/5}, { a, b, c}]
Solve::svars: Equations may not give solutions for all "solve" variables. >> 

{{a -> 5, c -> -b}, {b -> 5, c -> -a}, {b -> -a, c -> 5}}

What would I change in this specific instance?

Here are the problems:

I

Suppose that $a, b, c$ are real numbers satisfying $a+b+c=5$ and $\frac{1}{a}+\frac{1}{b}+\frac{1}{c}=+\frac{1}{5}$.
Find the greatest possible value of $a^3+b^3+c^3$

If I list all solutions I'll be able to choose all solutions maximizing $a^3+b^3+c^3$.

II

Finding integers $x, y$ and $z$ that satisfy this system:
$$\quad x^2 y + y^2 z + z^2 x = 2186 $$
$$\quad x y^2 + y z^2 + z x^2 = 2188$$.
evaluate $x^2+y^2+z^2$

The both problems can be found here (see exercises $27$ and $30$ ).

$\endgroup$
9
  • $\begingroup$ I have asked a specific question. Please let me know if you can help. @Artes $\endgroup$
    – user140900
    Commented Apr 7, 2014 at 0:33
  • $\begingroup$ @Artes Is there a way to get a list of exact values instead of conditions? Also, Reduce does not seem to work. $\endgroup$
    – user140900
    Commented Apr 7, 2014 at 0:40
  • 2
    $\begingroup$ Reduce works well, in any case you should study this post How do I make Reduce yield all solutions explicitly?. $\endgroup$
    – Artes
    Commented Apr 7, 2014 at 0:48
  • $\begingroup$ @Artes How would I find the number of unknowns that satisfy certain conditions? $\endgroup$
    – user140900
    Commented Apr 7, 2014 at 1:44
  • $\begingroup$ @Artes: Very nice post you did in the link, +1 there. $\endgroup$
    – ciao
    Commented Apr 7, 2014 at 2:19

1 Answer 1

6
$\begingroup$

I

Let's write down an appropriate system we would like to solve,
i.e. we are to maximize a^3 + b^3 + c^3 knowing that a + b + c == 5 and 1/a + 1/b + 1/c == 1/5, thus the most direct approach uses Maximize with adequate conditions:

Maximize[{a^3 + b^3 + c^3, a + b + c == 5, 1/a + 1/b + 1/c == 1/5}, {a, b, c}]
{125, {a -> 1, b -> 5, c -> -1}}

With Maximize we can get only a specific solution, an example can be found here : How do I determine the maximum value for a polynomial, given a range of x values?, nevertheless we can remedy this problem using Lagrange multipliers, see e.g. How can I implement the method of Lagrange multipliers to find constrained extrema?.
However since there is a symmetry between a, b and c we can conclude that any permutation of this triple {a -> 1, b -> 5, c -> -1} is also a solution.

There are another ways to solve the problem which can be examined with the answers to these questions: Am I missing anything? Solving Equations
Efficient code for solve this equation

Let's provide the simplest:

Simplify[ a^3 + b^3 + c^3, {{a + b + c == 5, 1/a + 1/b + 1/c == 1/5}}]
125

II

Another question provides a nice example where a simple usage of Solve and Reduce with an appropriate domain specification will not be sufficient.

E.g. this yields a complicated system returning the solution but it doesn't clarify if another solutions really exist.

Reduce[ x^2 y + y^2 z + z^2 x == 2186 && x y^2 + y z^2 + z x^2 == 2188 && 
        (x | y | z) ∈ Integers, {x, y, z}]

Thus we should approach the problem in a different way.
Let's notice that:

Simplify[ x y^2 + y z^2 + z x^2 - (x^2 y + y^2 z + z^2 x)]
-(x - y) (x - z) (y - z)

Now we can conclude that using slightly different system we can find an appropriate solution:

 x^2 + y^2 + z^2 /. Normal @ 
 Solve[ x - y == a && x - z == b && y - z == c && 
        x^2 y + y^2 z + z^2 x == 2186 && -a b c == 2, {x, y, z}, Integers]//Union//First
245    
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.