3D plot in sage

37 views
Skip to first unread message

wxu...@sohu.com

unread,
Mar 10, 2010, 12:39:31 PM3/10/10
to sage-support
Hi everyone,

I want do this thing as follows in sage, is that OK?

var('x,y,z')
f=cos(x)*cos(y)+cos(y)*cos(z)+cos(z)*cos(x)

and then I want to plot f. how can do it in sage?
Thanks in advance!

regards,
YC



闪电邮全文搜索,只用不到1秒
500强企业年后新招聘,赶紧申请

John H Palmieri

unread,
Mar 10, 2010, 1:04:29 PM3/10/10
to sage-support
On Mar 10, 9:39 am, wxu...@sohu.com wrote:
> Hi everyone,I want do this thing as follows in sage, is that OK?var('x,y,z')f=cos(x)*cos(y)+cos(y)*cos(z)+cos(z)*cos(x)and then I want to plot f. how can do it in sage?Thanks in advance!regards,YC

Isn't this a 4d plot? Or do you want to plot f(x,y,z)=0? In that
case, you could do

sage: implicit_plot3d(f == 0, (x, -2, 2), (y, -2, 2), (z, -2, 2))

--
John

wxu...@sohu.com

unread,
Mar 11, 2010, 3:21:20 AM3/11/10
to sage-support
I don't want to plot f(x,y,z)=0.
Yes, it should a 4d plot as you said.
can that be done in sage?

Thanks!
YC



----- 原文 -----

发件人: John H Palmieri
主 题: [sage-support] Re: 3D plot in sage
时 间: 2010年3月10日 07:04:29

--
To post to this group, send email to sage-s...@googlegroups.com
To unsubscribe from this group, send email to sage-support+unsub...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Marshall Hampton

unread,
Mar 12, 2010, 4:51:53 AM3/12/10
to sage-support
One option is several implicit plots, colored by value, i.e. something
like:

var('x,y,z')
f=cos(x)*cos(y)+cos(y)*cos(z)+cos(z)*cos(x)

imps = []
plot_range = srange(0,3,.75)
color_range = [i/N(len(plot_range)) for i in range(len(plot_range))]

for i,q in enumerate(plot_range):
red = color_range[i]
imps.append(implicit_plot3d(f-q==0, (x, -2, 2), (y, -2, 2), (z,
-2, 2), opacity = .5, rgbcolor = (red,0,1-red)))

show(sum(imps))

-M. Hampton


On Mar 11, 2:21 am, wxu...@sohu.com wrote:
> I don't want to plot f(x,y,z)=0.Yes, it should a 4d plot as you said.can that be done in sage?Thanks!YC ----- 原文 ----- 发件人: John H Palmieri 主 题: [sage-support] Re: 3D plot in sage时 间: 2010年3月10日  07:04:29On Mar 10, 9:39 am, wxu...@sohu.com wrote:> Hi everyone,I want do this thing as follows in sage, is that OK?var('x,y,z')f=cos(x)*cos(y)+cos(y)*cos(z)+cos(z)*cos(x)and then I want to plot f. how can do it in sage?Thanks in advance!regards,YCIsn't this a 4d plot?  Or do you want to plot f(x,y,z)=0?   In thatcase, you could dosage: implicit_plot3d(f == 0, (x, -2, 2), (y, -2, 2), (z, -2, 2))--John-- To post to this group, send email to sage-supp...@googlegroups.comTo unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.comFor more options, visit this group athttp://groups.google.com/group/sage-supportURL:http://www.sagemath.org

Jason Grout

unread,
Mar 12, 2010, 7:26:30 AM3/12/10
to sage-s...@googlegroups.com
On 03/12/2010 03:51 AM, Marshall Hampton wrote:
> One option is several implicit plots, colored by value, i.e. something
> like:
>
> var('x,y,z')
> f=cos(x)*cos(y)+cos(y)*cos(z)+cos(z)*cos(x)
>
> imps = []
> plot_range = srange(0,3,.75)
> color_range = [i/N(len(plot_range)) for i in range(len(plot_range))]
>
> for i,q in enumerate(plot_range):
> red = color_range[i]
> imps.append(implicit_plot3d(f-q==0, (x, -2, 2), (y, -2, 2), (z,
> -2, 2), opacity = .5, rgbcolor = (red,0,1-red)))
>
> show(sum(imps))
>

If you didn't need them to be plotted by color, then you could use the
contour option, like in the doc examples:
sage: implicit_plot3d((x^2 + y^2 + z^2), (x, -2, 2), (y, -2, 2), (z, -2,
2), plot_points=60, contour=[1,3,5])

Jason

wxu...@sohu.com

unread,
Mar 12, 2010, 7:43:39 AM3/12/10
to sage-support
Actually I do need them to be plotted by color.
it seems that sage is not designed for this way.
could anyone give some information about
what open source software can do this?

Thanks a lot!

YC



----- 原文 -----

发件人: Jason Grout
主 题: Re: 回复: [sage-support] Re: 3D plot in sage
时 间: 2010年3月12日 01:26:30

--

To post to this group, send email to sage-s...@googlegroups.com
To unsubscribe from this group, send email to sage-support+unsub...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-support
URL: http://www.sagemath.org




闪电邮全文搜索,只用不到1秒
我只是想找个好工作!

Jason Grout

unread,
Mar 16, 2010, 12:19:05 AM3/16/10
to sage-s...@googlegroups.com
On 03/12/2010 05:43 AM, wxu...@sohu.com wrote:
> Actually I do need them to be plotted by color.
> it seems that sage is not designed for this way.
> could anyone give some information about
> what open source software can do this?
>

I really don't understand what sort of plot you want. Can you post some
pictures giving examples of what sort of plot you want, or be extremely
precise in describing *exactly* how you want to visually represent this
function? There are lots of ways to represent a 4d function like this.

Thanks,

Jason

--
Jason Grout

wxu...@sohu.com

unread,
Mar 16, 2010, 4:24:41 AM3/16/10
to sage-support
Hi Jason and everyone,

Thank you very much for your reply.

Now I have a function or a set of data depending all the three coordinates x, y, z.
In other words, there is a corresponding value at every point in 3 dimensional space, which maybe
varies from -1 to 1. I want use color to represent the values in every point in 3D space.

For example in a room there is a temperature value at every point in 3D space of the room, I
want describe the temperature value by color for every point in the room.

I really haven't find a proper example figure from internet.

thanks,

YC



----- 原文 -----

发件人: Jason Grout
主 题: Re: 回复: [sage-support] Re: 3D plot in sage
时 间: 2010年3月16日 05:19:05

--
To post to this group, send email to sage-s...@googlegroups.com
To unsubscribe from this group, send email to sage-support+unsub...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-support
URL: http://www.sagemath.org




闪电邮全文搜索,只用不到1秒
我只是想找个好工作!

Jason Grout

unread,
Mar 16, 2010, 10:36:36 AM3/16/10
to sage-s...@googlegroups.com
On 03/16/2010 02:24 AM, wxu...@sohu.com wrote:
> Hi Jason and everyone,
>
> Thank you very much for your reply.
>
> Now I have a function or a set of data depending all the three
> coordinates x, y, z.
> In other words, there is a corresponding value at every point in 3
> dimensional space, which maybe
> varies from -1 to 1. I want use color to represent the values in every
> point in 3D space.
>
> For example in a room there is a temperature value at every point in 3D
> space of the room, I
> want describe the temperature value by color for every point in the room.
>
> I really haven't find a proper example figure from internet.


Mayavi2 might be the best tool for this job. See
http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab.html#visualizing-volumetric-scalar-data
for some examples.

wxu...@sohu.com

unread,
Mar 16, 2010, 12:11:19 PM3/16/10
to sage-support
Thank you very much!

I will try this.

regards,
YC



----- 原文 -----

发件人: Jason Grout
主 题: Re: 回复: [sage-support] Re: 3D plot in sage
时 间: 2010年3月16日 03:36:36

--
To post to this group, send email to sage-s...@googlegroups.com
To unsubscribe from this group, send email to sage-support+unsub...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-support
URL: http://www.sagemath.org




闪电邮全文搜索,只用不到1秒
我只是想找个好工作!

Jaap Spies

unread,
Mar 16, 2010, 12:43:18 PM3/16/10
to sage-s...@googlegroups.com
wxu...@sohu.com wrote:
> Thank you very much!
>
> I will try this.
>

You could try the experimental version found here:

http://sage.math.washington.edu/home/jsp/SPKGS/ETS/

Jaap

wxu...@sohu.com

unread,
Mar 17, 2010, 4:29:48 AM3/17/10
to sage-support
Thank you!



----- 原文 -----

发件人: Jaap Spies
主 题: Re: 回复: [sage-support] Re: 3D plot in sage
时 间: 2010年3月16日 05:43:18

--
To post to this group, send email to sage-s...@googlegroups.com
To unsubscribe from this group, send email to sage-support+unsub...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-support
URL: http://www.sagemath.org




闪电邮全文搜索,只用不到1秒
我只是想找个好工作!
Reply all
Reply to author
Forward
0 new messages