Here are a few examples which I think are interesting.
If anyone can figure out a way to plot a cardioid,
http://mathworld.wolfram.com/HeartSurface.html,
in SAGE, I'd be very interested.
- David Joyner
#M\"obius strip:
sage: u,v = var("u,v")
sage: p = parametric_plot3d([cos(u)*(1+v*cos(u/2)),
sin(u)*(1+v*cos(u/2)), 0.2*v*sin(u/2)], (u,0, 4*pi), (v,0,
0.3),plot_points=[50,50])
#twisted ribbon
sage: p = parametric_plot3d([3*sin(u)*cos(v), 3*sin(u)*sin(v),
cos(v)], (u,0, 2*pi), (v, 0, pi),plot_points=[50,50])
#ellipsoid (automatically rescaled axes make it look spherical)
sage: p = parametric_plot3d([3*sin(u)*cos(v), 2*sin(u)*sin(v),
cos(u)], (u,0, 2*pi), (v, 0, 2*pi),plot_points=[50,50])
#cone
sage: p = parametric_plot3d([u*cos(v), u*sin(v), u], (u, -1, 1), (v,
0, 2*pi), plot_points=[50,50])
#paraboloid
sage: p = parametric_plot3d([u*cos(v), u*sin(v), u^2], (u, 0, 1), (v,
0, 2*pi), plot_points=[50,50])
#hyperboloid
sage: p = plot3d(u^2-v^2, (u, -1, 1), (v, -1, 1), plot_points=[50,50])
#weird looking surface - like a M\"obius band but also an O
sage: p = parametric_plot3d([sin(u)*cos(u)*log(u^2)*sin(v),
(u^2)^(1/6)*(cos(u)^2)^(1/4)*cos(v), sin(v)], (u, -1, 1), (v, -pi,
pi), plot_points=[50,50])
#a heart, but not a cardioid (for my wife)
sage: p1 = parametric_plot3d([sin(u)*cos(u)*log(u^2)*v*(1-v)/2,
((u^6)^(1/20)*(cos(u)^2)^(1/4)-1/2)*v*(1-v), v^(0.5)], (u, 0.001, 1),
(v, 0, 1), plot_points=[90,90])
sage: p2 = parametric_plot3d([-sin(u)*cos(u)*log(u^2)*v*(1-v)/2,
((u^6)^(1/20)*(cos(u)^2)^(1/4)-1/2)*v*(1-v), v^(0.5)], (u, 0.001, 1),
(v, 0, 1), plot_points=[90,90])
sage: show(p1+p2, frame=False)
Use the aspect_ratio option:
sage: var('u,v')
sage: parametric_plot3d([3*sin(u)*cos(v), 2*sin(u)*sin(v), cos(u)],
(u,0, 2*pi), (v, 0, 2*pi),plot_points=[50,50], aspect_ratio=[1,1,1])
I've attached a Sage worksheet that has all the plots in this email rendered,
but with a few tweeks to make some of them work right or actually work.
Thanks!
I'll be adding this to the examples section of parametric_plot3d.
-- William
>
> #cone
> sage: p = parametric_plot3d([u*cos(v), u*sin(v), u], (u, -1, 1), (v,
> 0, 2*pi), plot_points=[50,50])
>
> #paraboloid
> sage: p = parametric_plot3d([u*cos(v), u*sin(v), u^2], (u, 0, 1), (v,
> 0, 2*pi), plot_points=[50,50])
>
> #hyperboloid
> sage: p = plot3d(u^2-v^2, (u, -1, 1), (v, -1, 1), plot_points=[50,50])
>
> #weird looking surface - like a M\"obius band but also an O
> sage: p = parametric_plot3d([sin(u)*cos(u)*log(u^2)*sin(v),
> (u^2)^(1/6)*(cos(u)^2)^(1/4)*cos(v), sin(v)], (u, -1, 1), (v, -pi,
> pi), plot_points=[50,50])
>
>
> #a heart, but not a cardioid (for my wife)
> sage: p1 = parametric_plot3d([sin(u)*cos(u)*log(u^2)*v*(1-v)/2,
> ((u^6)^(1/20)*(cos(u)^2)^(1/4)-1/2)*v*(1-v), v^(0.5)], (u, 0.001, 1),
> (v, 0, 1), plot_points=[90,90])
> sage: p2 = parametric_plot3d([-sin(u)*cos(u)*log(u^2)*v*(1-v)/2,
> ((u^6)^(1/20)*(cos(u)^2)^(1/4)-1/2)*v*(1-v), v^(0.5)], (u, 0.001, 1),
> (v, 0, 1), plot_points=[90,90])
> sage: show(p1+p2, frame=False)
>
> >
>
--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org
var('t')
a = 1
fx = a*cos(t)*(1-cos(t))
fy = a*sin(t)*(1-cos(t))*exp(-0.5*t)
f1 = (fx, fy)
parametric_plot(f1, 0, pi)
which then extended to this:
var('t v')
a = 1
fx = a*cos(t)*(1-cos(t))
fy = a*sin(t)*(1-cos(t))*exp(-0.5*t)*cos(v)
fz = a*sin(t)*(1-cos(t))*exp(-0.5*t)*sin(v)
f = (fx, fy, fz)
parametric_plot3d(f, (t,0,pi), (v,0,2*pi), rgbcolor='red')
Will your wife settle for an apple instead? :)
--
Hector
I mean, sage examples can borrow formulas :)
--
Jurgis Pralgauskis
omni: 8-616 77613; teledema: 8-657 65656;
jabber: jur...@akl.lt; skype: dz0rdzas;
Don't worry, be happy :) and make things better ;)
Thanks, looks nice.
Very strangely, after running the commands that Jaap
posted in a separate email (smaller mayavi package), jmol now works
on my trusty/crusty/rusty old 64bit feisty fawn machine!!
Where? I can't find the docs and I'm having a hard time installing the
program....
Another really nice source of 3d plot examples in the OS X program "Grapher"
that comes with every copy of OS X (in the Applications directory). It's quite
nice.
-- William
On Jan 18, 2008 9:41 AM, Jurgis Pralgauskis
> Another really nice source of 3d plot examples in the OS X program
> "Grapher"
> that comes with every copy of OS X (in the Applications
> directory). It's quite
> nice.
It's actually in /Applications/Utilities (not completely obvious, at
least to me). It is a very nice program, descended from something
called Curvus Pro (which was an open-source program until someone
bought it :-}).
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Director
Institute for the Enhancement of the Director's Income
--------
Here lies Lester Moore
Two bullets from a .44
No less, no more
--------
That is too old for the 3d graphics. Try "sage -upgrade" to
get the latest.
Upgrading with "sage -upgrade" can take arbitrarily long, since it
builds all upgraded components from source. That particular upgrade,
in particular, involved changing the font encoding in Python (from
UCS2 to UCS4, for better support of system-wide Python libraries),
which entailed rebuilding a lot of Sage packages.
> Besides, my sage directory contains a file "sage.
> 2.9.1.txt"
It was a mistake that we didn't remove that.
> and also "history.txt" which mentions sage 2.10...???
Yes, becuse you upgraded to 2.10.
Try typing version() at the sage prompt.
> is there anything wrong with brutally deleting my sage folder and
> downloading the latest ubuntu binaries ?
No.
> (apart from the need to
> download my favorite packages again -- there are only two i think).
> Surely this beats having to wait 2 hours to recompile.
Yep.
-- William