#7872: Adding coordinate transformations to plot3d
---------------------------+------------------------------------------------
Reporter: olazo | Owner: olazo
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: graphics | Keywords:
Work_issues: | Author: olazo
Upstream: N/A | Reviewer:
Merged: |
---------------------------+------------------------------------------------
While developing a command called transform_plot3d, that generalized
ploting in diferent coordinate systems, Jason Grout suggested to me that
such a command would be better implemented within plot3d.
I agreed to that, so I propose an adition to plot3d's syntax:
"plot3d(function,var1range,var2range,transformation=None,**kwds)" where
transformation is a 4-tuple containing 3 functions of arity 3, and a
variable which is to be interpreted as the function to be ploted. Like
this (r*cos(fi),r*sin(fi),z,r), so the function will be ploted as r.
It's inclution within plot3d would be something on the likes of
{{{
def plot3d_new(f,v1ran,v2ran,transformation=None,**kwds):
if transformation==None:
return plot3d(f,v1ran,v2ran,**kwds)
else:
v1=v1ran[0]
v2=v2ran[0]
if transformation=='spherical':
r=var('r')
transformation=(r*cos(v1)*sin(v2),r*sin(v1)*sin(v2),r*cos(v2),r)
elif transformation=='cylindrical':
r=var('r')
transformation=(r*cos(v1),r*sin(v1),v2,r)
elif str(type(transformation))=="<type 'str'>":
print 'Warning: the transformation given is not amongst the
options, it will be ignored'
return plot3d(f,v1ran,v2ran,**kwds)
fvar=transformation[3]
transformation=(transformation[0],transformation[1],transformation[2])
try:
R=[t.subs({fvar:f}) for t in transformation]
except:
def subs_func(t):
return lambda x,y: t.subs({fvar:f(x,y), v1:x, v2:y})
R=map(subs_func,transformation)
return parametric_plot(R,v1ran,v2ran,**kwds)
}}}
Examples can be found in [http://www.sagenb.org/home/omologos/9/].
Spherical and cylindrical plots are now meant to be purely derived from
plot3d. So tickets [http://trac.sagemath.org/sage_trac/ticket/7850] and
[http://trac.sagemath.org/sage_trac/ticket/7869] should be updated
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7872>
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.