Ask Your Question

Revision history [back]

Unless I'm misunderstanding you, what's wrong with :

def dom(x,y): return 1 if x>0 and y>0 and x+y<4 else 0
region_plot(dom, (-4,4), (-4, 4))


(See Sagecell)

(Note that, since you are working on two variables, you should plot in 2D : There's nothing to specify a third dimensin...).

Unless I'm misunderstanding you, what's wrong with :

def dom(x,y): return 1 if x>0 and y>0 and x+y<4 else 0
region_plot(dom, (-4,4), (-4, 4))


(See Sagecell)

(Note that, since you are working on two variables, you should plot in 2D : There's nothing to specify a third dimensin...).dimension...).

Unless I'm misunderstanding you, what's wrong with :

def dom(x,y): return 1 if x>0 and y>0 and x+y<4 else 0
region_plot(dom, (-4,4), (-4, 4))


(See Sagecell)

(Note that, since you are working on two variables, you should plot in 2D : There's nothing to specify a third dimension...).

EDIT : Rececyphering your code, I guessed you may mean : "plot z(x, y)=(x*y*(x+y-4))^2+(floor(x/4))^2 subject to x>0, y>0, x+y<4", inwhich case, what you are looking for is :

plot3d(lambda x,y:(x*y*(x+y-4))^2+(floor(x/4))^2, (0, 4), (0, 4)).add_condition(lambda x, y, z:x+y<4)


(see Sagecell).

(Note that the "condition" function is a three-argument one...).

Unless I'm misunderstanding you, what's wrong with :

def dom(x,y): return 1 if x>0 and y>0 and x+y<4 else 0
region_plot(dom, (-4,4), (-4, 4))


(See Sagecell)

(Note that, since you are working on two variables, you should plot in 2D : There's nothing to specify a third dimension...).

EDIT : Rececyphering Redecyphering your code, I guessed you may mean : "plot z(x, y)=(x*y*(x+y-4))^2+(floor(x/4))^2 subject to x>0, y>0, x+y<4", inwhich case, what you are looking for is :

plot3d(lambda x,y:(x*y*(x+y-4))^2+(floor(x/4))^2, (0, 4), (0, 4)).add_condition(lambda x, y, z:x+y<4)


(see Sagecell).

(Note that the "condition" function is a three-argument one...).

(Note also that I'm not an haruspix : I'm a dentist...).

Unless I'm misunderstanding you, what's wrong with :

def dom(x,y): return 1 if x>0 and y>0 and x+y<4 else 0
region_plot(dom, (-4,4), (-4, 4))


(See Sagecell)

(Note that, since you are working on two variables, you should plot in 2D : There's nothing to specify a third dimension...).

EDIT : Redecyphering your code, I guessed you may mean : "plot z(x, y)=(x*y*(x+y-4))^2+(floor(x/4))^2 subject to x>0, y>0, x+y<4", inwhich case, what you are looking for is :

plot3d(lambda x,y:(x*y*(x+y-4))^2+(floor(x/4))^2, (0, 4), (0, 4)).add_condition(lambda x, y, z:x+y<4)


(see Sagecell).

(Note that the "condition" function is a three-argument one...).

(Note also that I'm not an haruspix haruspex : I'm a dentist...).

Unless I'm misunderstanding you, what's wrong with :

def dom(x,y): return 1 if x>0 and y>0 and x+y<4 else 0
region_plot(dom, (-4,4), (-4, 4))


(See Sagecell)

(Note that, since you are working on two variables, you should plot in 2D : There's nothing to specify a third dimension...).

EDIT : Redecyphering your code, I guessed you may mean : "plot z(x, y)=(x*y*(x+y-4))^2+(floor(x/4))^2 subject to x>0, y>0, x+y<4", inwhich in which case, what you are looking for is :

plot3d(lambda x,y:(x*y*(x+y-4))^2+(floor(x/4))^2, (0, 4), (0, 4)).add_condition(lambda x, y, z:x+y<4)


(see Sagecell).

(Note that the "condition" function is a three-argument one...).

(Note also that I'm not an haruspex : I'm a dentist...).