1 | initial version |

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...).

2 | No.2 Revision |

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...).

3 | No.3 Revision |

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...).

4 | No.4 Revision |

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...).

5 | No.5 Revision |

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...).

6 | No.6 Revision |

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)

**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...).

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.