On 11/16/13 1:34 AM, Chris Seberino wrote:
I've been searching the Internet and can't find examples of plots of
functions of THREE
variables like f(x, y, z).

I'd like to use a different color at each point in space to denote the
function value.

Is that possible in Sage?  Are there examples somewhere?

(All the examples I saw were for 2 variable functions like g(x, y). )

We don't have volumetric visualization built in, but you can sort of do it yourself: http://sagecell.sagemath.org/?q=pduwfm

f(x,y,z)=x^2+y^2+z^2
opacity=0.5
pointsize=30
domain=srange(-2,2,.3)
jitter=0.1 # set to 0 to have a truly uniform grid
min=0
max=f(2,2,2)

frange = float(max-min)
from itertools import product
ff=fast_callable(f, domain=RDF)

# this could be much faster if we were evaluating it using vector arithmetic on a numpy grid, for example.
g=[]
for i,j,k in product(domain,repeat=3):

g.append(point3d((i+random()*jitter,j+random()*jitter,k+random()*jitter), size=pointsize, opacity=opacity, color=hue((ff(i,j,k)-min)/frange)))
G = sum(g)

show(G)



--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to