First time here? Check out the FAQ!

Ask Your Question
0

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

asked 12 years ago

updated 12 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 12 years ago

benjaminfjones gravatar image

updated 12 years ago

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

Preview: (hide)
link

Comments

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

elcojon gravatar imageelcojon ( 12 years ago )

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

benjaminfjones gravatar imagebenjaminfjones ( 12 years ago )

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: 12 years ago

Seen: 445 times

Last updated: Nov 03 '12