#7850: spherical plot
---------------------------+------------------------------------------------
Reporter: olazo | Owner: was
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: graphics | Keywords: spherical,plot
Work_issues: | Author: olazo
Upstream: N/A | Reviewer:
Merged: |
---------------------------+------------------------------------------------
Comment(by jason):
Here is a rough cut of a generic function:
http://sagenb.org/home/pub/1322/
{{{
# TODO: figure out a way to determine if f is an expression or callable
symbolic function for the if statement.
def make_coordinate_plot3d(transformation,
function_variable,parameter_variables):
def new_plot(f, var1_range, var2_range,**kwds):
f_is_expression=True
if f_is_expression:
# if f is an expression, then we can use .subs. This is
faster, because parametric_plot3d
# can then use fast_float
if len(var1_range)==3:
vars=[var1_range[0], var2_range[0]]
else:
vars=sage.symbolic.ring.var('v1,v2')
plot_func=[t.subs({function_variable:f,
parameter_variables[0]:vars[0], parameter_variables[1]:vars[1]})
for t in transformation]
else:
# if f is not a symbolic expression or function, use the
following
# We could make this faster by using fast_float on the
components of transformation
# We need to do the function and map instead of just a list
comprehension because
# of python scoping; see
http://lackingrhoticity.blogspot.com/2009/04/python-variable-binding-
semantics-part.html
def subs_func(t):
return lambda x,y: t.subs({function_variable:f(x,y),
parameter_variables[0]:x, parameter_variables[1]:y})
plot_func=map(subs_func,transformation)
return parametric_plot3d(plot_func, var1_range, var2_range,**kwds)
return new_plot
var('r,t,p')
jason_spherical_plot3d=make_coordinate_plot3d([r*cos(t)*sin(p),
r*sin(t)*sin(p), r*cos(p)], function_variable=r,
parameter_variables=[t,p])
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7850#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.