Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

minimize_constrained, wrong answer?

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) = -(56x^2y^2 - 4x^2y - 4xy^2 - 4x^2 - xy - 4y^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]))

minimize_constrained, wrong answer?

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

c4(x,y)=1-y

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

1)

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

[c1(x,y),c2(x,y),c3(x,y),c4(x,y)],[0.5,0.5])

print(G(M[0],M[1]))

print(G(M[0],M[1]))