Unable to create a contour_plot of a system of inequalities
I am trying to plot a system of inequalities, dependent on a matrix H. Here is my function I am planning to contour_plot:
def reg(x, y):
f1 = H[0,0] * H[0,0] * x + H[1,0] * H[1,0] * y
f2 = H[0,0] * H[0,1] * x + H[1,0] * H[1,1] * y
f3 = H[0,1] * H[0,1] * x + H[1,1] * H[1,1] * y
if f1 < 0 or f2 < 0 or f3 < 0:
return 0
else:
return 1
I then have H be
> H
> [2.220446049250313e-16 -0.9999999999999998]
> [ -0.9999999999999998 2.220446049250313e-16]
However
contour_plot(reg, (x,-Integer(5),Integer(5)), (y,-Integer(5),Integer(5)))
yields an error. It says
zero-size array to reduction operation minimum which has no identity
The strange part is that when
> H
> [-1 0]
> [ 0 1]
the same contour_plot yields exactly what I want without any errors
Help would be much appreciated, I have just picked up SAGE this week and have much to learn
Thanks for reporting !