Ask Your Question
0

How can i generate a 3D plot with more details?

asked 2012-11-02 11:34:26 +0100

updated 2012-11-02 11:37:05 +0100

How can i generate a 3D plot of the function f(x,y)=x^2+y^2 with the view of all integer values of x,y,z in the graph? For example like this

![x^2+y^2] (http://img845.imageshack.us/img845/91...)

...but with more details.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-11-02 22:35:14 +0100

benjaminfjones gravatar image

updated 2012-11-03 16:48:15 +0100

You can use plot3d to plot your surface and then add to that Graphics object the collection of points you want to visualize:

sage: N = 3
sage: f(x,y)=x^2+y^2
sage: G = plot3d(f, (x,-N,N), (y,-N,N))
sage: points_list = [ (a,b,f(a,b)) for a in [-N..N] for b in [-N..N] ]
sage: G += point(points_list, color='red')
sage: show(G)

Here's a working demo:

http://aleph.sagemath.org/?q=784f1e88...

edit flag offensive delete link more

Comments

it does not work! I tested it. It stops running with a TypeError. TypeError: 'Graphics3dGroup' object is not iterable

elcojon gravatar imageelcojon ( 2012-11-03 11:35:05 +0100 )edit

yeah, that's a typo on my part. It's fixed now

benjaminfjones gravatar imagebenjaminfjones ( 2012-11-03 16:46:32 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-11-02 11:34:26 +0100

Seen: 423 times

Last updated: Nov 03 '12