Maple

A simple tutorial task on optimization from one of the forums. We need to find the minimum of the function
g1 = (x1-x2)*(x2-x3)*(x3-x4)*(x4-x1) with the following constraint g2 = x1^2+x2^2+x3^2+x4^2-1
It reduces to solving polynomial equations.
Minimum = - 0.25. It's  solution:
[x1 = .683012702, x2 = .183012702, x3 = -.183012702, x4 = -.683012702],
[x1 = .183012702, x2 = .683012702, x3 = -.683012702, x4 = -.183012702],
[x1 = -.183012702, x2 = .183012702, x3 = .683012702, x4 = -.683012702],
[x1 = -.683012702, x2 = .683012702, x3 = .183012702, x4 = -.183012702],
[[x1 = .683012702, x2 = -.683012702, x3 = -.183012702, x4 = .183012702],
[x1 = .183012702, x2 = -.183012702, x3 = -.683012702, x4 = .683012702],
[x1 = -.183012702, x2 = -.683012702, x3 = .683012702, x4 = .183012702],
[x1 = -.683012702, x2 = -.183012702, x3 = .183012702, x4 = .683012702]
when x5 =0 .25

But so far I have not found an easy way to solve it using Maple. First we need to be able to successfully use fsolve, and only then "polynomial" functions.

```restart; with(RootFinding):
g1 := (x1-x2)*(x2-x3)*(x3-x4)*(x4-x1);
g2 := x1^2+x2^2+x3^2+x4^2-1;
g :=g1+x5*g2;
f1 := diff(g, x1);
f2 := diff(g, x2);
f3 := diff(g, x3);
f4 := diff(g, x4);
f5 := diff(g, x5);
#solve([f1, f2, f3, f4, f5], [x1, x2, x3, x4, x5]);
Isolate([f1, f2, f3, f4, f5], [x1, x2, x3, x4, x5]);
S := fsolve([f1, f2, f3, f4, f5], {x1, x2, x3, x4, x5}, maxsols = 8);
x5 := rhs(op(5, S));
Isolate([f1, f2, f3, f4], [x1, x2, x3, x4]);
solve([f1, f2, f3, f4], [x1, x2, x3, x4])```

The optimization package doesn't help much either.
The task itself is of no interest, it is interesting to look at its simplest solution in Maple.
(By the way, Draghilev's method works well, but, of course, this is not the easiest way).

﻿