ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 02 May 2016 13:35:17 +0200Plotting an inequality in 3D regionhttps://ask.sagemath.org/question/33277/plotting-an-inequality-in-3d-region/
Ideally I would like to plot a region in 3D space which is defined by a bunch of inequalities. For example let us consider the region $R$ defined by $$ \{ (x,y, z): x \le 0 \text{ and } y \le 0 \text{ and } x+y \le z \} $$.
I am wondering what would be an easier way to do it.
With my limited knowledge I came up with these two approaches.
*Approach 1 :* Generate points in this region and plot them in 3D. Is there a way to extend the function in <code> region_plot () </code> that generates plot points for my needs?
*Approach 2 :* Concatenate implicit -3D plots of functions of the form $ x + y - (z+t) $, where $t$ is a small positive parameter, for different values of $t$. Then plot all these simultaneously.
I would appreciate any alternate way to do this or any improvements on these approaches.
Thank you for your time in advance.
Sun, 01 May 2016 18:36:45 +0200https://ask.sagemath.org/question/33277/plotting-an-inequality-in-3d-region/Answer by calc314 for <p>Ideally I would like to plot a region in 3D space which is defined by a bunch of inequalities. For example let us consider the region $R$ defined by $$ { (x,y, z): x \le 0 \text{ and } y \le 0 \text{ and } x+y \le z } $$. </p>
<p>I am wondering what would be an easier way to do it. </p>
<p>With my limited knowledge I came up with these two approaches. </p>
<p><em>Approach 1 :</em> Generate points in this region and plot them in 3D. Is there a way to extend the function in <code> region_plot () </code> that generates plot points for my needs? </p>
<p><em>Approach 2 :</em> Concatenate implicit -3D plots of functions of the form $ x + y - (z+t) $, where $t$ is a small positive parameter, for different values of $t$. Then plot all these simultaneously. </p>
<p>I would appreciate any alternate way to do this or any improvements on these approaches. <br/>
Thank you for your time in advance. </p>
https://ask.sagemath.org/question/33277/plotting-an-inequality-in-3d-region/?answer=33289#post-id-33289I'm not aware of an easy way to do this. But, here is one idea:
var('x y z')
p=implicit_plot3d(x+y==z,(x,-4,0),(y,-4,0),(z,-10,0))
p+=polygon3d([(-4,0,-4),(0,0,0),(-4,0,0) ])
p+=polygon3d([(0,-4,-4),(0,0,0),(0,-4,0) ])
p+=polygon3d([(-4,0,-4),(-4,-4,-8),(-4,0,0),(-4,-4,0) ])
p+=polygon3d([(0,-4,-4),(-4,-4,-8),(0,-4,0) ,(-4,-4,0) ])
p
Mon, 02 May 2016 13:35:17 +0200https://ask.sagemath.org/question/33277/plotting-an-inequality-in-3d-region/?answer=33289#post-id-33289