Ask Your Question
0

minimize_constrained, wrong answer?

asked 2024-08-18 22:53:10 +0200

Sotto gravatar image

updated 2024-08-19 05:20:43 +0200

Max Alekseyev gravatar image

Dear all, I'm trying to find the maximum of a polynomial function G numerically over [0,1]x[0,1]. I used the simple code below and I got 0, which is clearly wrong as one can easily check plotting the surface z=G(x,y). Any help? Thanks, Nicola

var('x,y')
c1(x,y)=x
c2(x,y)=y
c3(x,y)=1-x
c4(x,y)=1-y

G(x,y) = -(56*x^2*y^2 - 4*x^2*y - 4*x*y^2 - 4*x^2 - x*y - 4*y^2 - x - y - 1)*(x - 1)*(y - 1)

M = minimize_constrained(-G(x,y), [c1(x,y),c2(x,y),c3(x,y),c4(x,y)],[0.5,0.5])

print(G(M[0],M[1]))
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2024-08-19 08:53:23 +0200

Emmanuel Charpentier gravatar image

updated 2024-08-19 17:07:56 +0200

This is probably a bug in constraints handling of minimize_constrained :

sage: minimize_constrained(-G, [c1,c2,c3,c4],[1/2, 1/2])
(1.0, 0.5)

but

sage: minimize_constrained(-G, [[0, 1], [0, 1]],[1/2, 1/2])
(0.22201537463122323, 0.22201537463122367)

Could you report it to [sage-support)(https://groups.google.com/g/sage-support), and possibly file a ticket on Github ?

EDIT : Never mind : I filed a new issue related to this problem, where you can find an analytical solution to your problem.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-08-18 22:53:10 +0200

Seen: 134 times

Last updated: Aug 19