Slightly fancier; my four-year-old daughter talked me into it:

colorlist =
['red','green','blue','brown','black','white','orange','grey','purple']
var('s,t')
g(s) = ((0.57496*(121 - 16.0*s^2)^(.5))/(10.+ s)^(.5))
def P(color, rng):
   return parametric_plot3d((cos(t)*g(s), sin(t)*g(s), s),
              (s,rng[0],rng[1]), (t,0,2*pi), plot_points = [120,120],
color=color, frame = False, opacity = .7)
a=sum([P(clr, r) for clr, r in [(colorlist[x],(-2.75+5.5*x/
len(colorlist),-2.75+5.5*(x+1)/len(colorlist))) for x in
srange(0,len(colorlist))]])
show(a)

-M. Hampton

On Mar 9, 10:45 am, mhampton <[EMAIL PROTECTED]> wrote:
> The mathematica one has a nice egg shape, which I think is
> surprisingly hard to get right.  It uses the implicit surface
>
> x^2/4*(1 + 0.1 z) + y^2/4*(1 + 0.1 z) + z^2/2.75^2 = 1
>
> so I can tweak your code for an improvement in shape:
>
> var('s,t')
> g(s) = abs(sin(1-s)+0.01*sin(2*(1-s)))
> g(s) = ((0.57496*(121 - 16.0*s^2)^(.5))/(10.+ s)^(.5))
> def P(color, rng):
>    return parametric_plot3d( (cos(t)*g(s), sin(t)*g(s), s),
>               (s,rng[0],rng[1]), (t,0,2*pi), color=color)
> sum([P(clr, r) for clr, r in [('red',(-2.75,.1)), ('blue',(.1,.3)),
> ('purple',(.3,2.75))]])
>
> -Marshall Hampton
>
> On Mar 9, 2:19 am, "William Stein" <[EMAIL PROTECTED]> wrote:
>
> > Hi Sage-Devel,
>
> > If you don't sites like "digg" delete this message.
>
> > Some of you who read Digg (http://digg.com) might find the front page
> > right now interesting, since the top article is on Mathematica easter eggs.
> > The comments are here:
>
> >http://digg.com/design/Using_Mathematica_to_decorate_Easter_Eggs
>
> > The linked to article is:
> >  http://www.boingboing.net/2008/03/08/using-mathematica-to.html
>
> > Half the comments are of the form "[Mathematica|Wolfram] Sucks", and
> > none have any content.
>
> > Anyway, I tried to make an easter egg for a few seconds in Sage
> > and didn't get far:
>
> > var('s,t')
> > g(s) = abs(sin(1-s)+0.01*sin(2*(1-s)))
> > def P(color, rng):
> >    return parametric_plot3d( (cos(t)*g(s), sin(t)*g(s), s),
> >               (s,rng[0],rng[1]), (t,0,2*pi), color=color)
>
> > sum([P(clr, r) for clr, r in [('red',(-2.1,-1.8)), ('purple',(-1.8,1))]])
>
> > ---------- Forwarded message ----------
> > From: Alfredo Portes <[EMAIL PROTECTED]>
> > Date: Sat, Mar 8, 2008 at 10:51 PM
> > Subject: Digg
> > To: William Stein <[EMAIL PROTECTED]>
>
> > This just hit the first page of Digg.
>
> >  http://www.boingboing.net/2008/03/08/using-mathematica-to.html
>
> >  Interesting that the first comment in the page is from a "new user" to
> >  Sage (Tom) :)
>
> >  Regards,
>
> >  Alfredo
>
> > --
> > William Stein
> > Associate Professor of Mathematics
> > University of Washingtonhttp://wstein.org
--~--~---------~--~----~------------~-------~--~----~
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-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to