Modular fibration animated with Sage

384 views
Skip to first unread message

Niles Johnson

unread,
Sep 13, 2012, 3:45:10 PM9/13/12
to sage-...@googlegroups.com
Hello Sage developers!

Some time ago I made an animation of the Hopf fibration using Sage.  Recently, a graduate of the African Institute for Mathematical Sciences has finished animating a different map from S^3 to S^2.  Ihechukwu Chinyere worked with Bruce Bartlett there and made an animation visualizing what he calls the modular fibration.  This is a map related to the j-invariant of elliptic curves and to the SO(2) action on SL_2(R) / SL_2(Z).  The generic fibers are trefoils, and there are two singular fibers which are unknotted circles.

I'll leave the rest of the explanation to people who understand it better than me -- here are links to Ihechukwu's essay and a relevant question / answer on Mathoverflow:




And here's a link to the video:



Lastly, there's a heartwarming example of the benefits of open development here:  I made all of the Sage code for my animation public, and I deliberately tried to use open-source software for the entire project so that someone else could easily use the code I wrote.  I had never met Ihechukwu or Bruce when they started working on this, nor did I know anything about this modular fibration.  But I'm thrilled with their work!  I certainly couldn't predict this, and this outcome makes me even happier that I decided to make the source public :)

enjoy,
Niles

Jason Grout

unread,
Sep 13, 2012, 4:09:54 PM9/13/12
to sage-...@googlegroups.com
On 9/13/12 2:45 PM, Niles Johnson wrote:
> Lastly, there's a heartwarming example of the benefits of open
> development here: I made all of the Sage code for my animation public,
> and I deliberately tried to use open-source software for the entire
> project so that someone else could easily use the code I wrote. I had
> never met Ihechukwu or Bruce when they started working on this, nor did
> I know anything about this modular fibration. But I'm thrilled with
> their work! I certainly couldn't predict this, and this outcome makes
> me even happier that I decided to make the source public :)

That's really cool!

I was just playing around with the code a bit, which is really easy
using Sage's load command, for example:

http://aleph.sagemath.org/?q=72ded3ac-afc8-48ec-b991-3f95f27e1323

Some demos of this would make some awesome additions to
interact.sagemath.org!

Thanks,

Jason




Jason Grout

unread,
Sep 13, 2012, 6:06:59 PM9/13/12
to sage-...@googlegroups.com
On 9/13/12 3:09 PM, Jason Grout wrote:
> On 9/13/12 2:45 PM, Niles Johnson wrote:
>> Lastly, there's a heartwarming example of the benefits of open
>> development here: I made all of the Sage code for my animation public,
>> and I deliberately tried to use open-source software for the entire
>> project so that someone else could easily use the code I wrote. I had
>> never met Ihechukwu or Bruce when they started working on this, nor did
>> I know anything about this modular fibration. But I'm thrilled with
>> their work! I certainly couldn't predict this, and this outcome makes
>> me even happier that I decided to make the source public :)

I looked at the code some more, and it looked like there was *lots* of
potential for speeding it up. I first added some imports from the
python math library, which sped it up by a factor of 5-10 on one case
[1]. Then I converted the fib2_param function to use fast_callable (in
a really simple way...) [2]. That sped it up by another factor of 2-4
or so.

You can see the results here:

http://aleph.sagemath.org/?q=530d5d16-a57d-4cef-9eab-7b5dad6445c1

Comment or uncomment the load statements at the top to see the difference.

I put my changes up here: https://github.com/jasongrout/hopf_fibrations

I think there is still a lot of room for speeding this up more, if
someone wanted a fun project.

Thanks,

Jason

[1]
https://github.com/jasongrout/hopf_fibrations/commit/a8bcb7df4455389fc815a4832041028d6ee920bb

[2]
https://github.com/jasongrout/hopf_fibrations/commit/0bd6ccf381764cf3126c3c93e8de82c58141a0bf


Jason Grout

unread,
Sep 13, 2012, 7:11:45 PM9/13/12
to sage-...@googlegroups.com
On 9/13/12 5:06 PM, Jason Grout wrote:

> I think there is still a lot of room for speeding this up more, if
> someone wanted a fun project.

And I got another factor of 2 by making the inner function a Cython
"class" [1]:

http://aleph.sagemath.org/?q=8b878cda-030d-4433-9d11-a10153d9d9a3

Okay, that's it for now. But I still think there is room for
improvement. On my computer, the initial version took 20 seconds to do
the above benchmark, and the Cython version takes .37s, so a speedup of
about 50x or so. I don't see that same speedup on aleph, and I'm not
sure why. Anyways, now it sort of works as an interact:
http://aleph.sagemath.org/?q=3d4f343c-323e-43f6-a8a8-149cfd7217dc

Jason

[1]
https://github.com/jasongrout/hopf_fibrations/commit/9c88cc0e3242ef3e50e311f65ba4300a5a4e5446


Niles Johnson

unread,
Sep 14, 2012, 8:13:06 AM9/14/12
to sage-...@googlegroups.com
Thanks Jason!  I'm not surprised that there's lots of room for speed up -- and I agree it could be a lot of fun for the right kind of person :)

I've been out of the loop for a little while, and I guess I missed interact.sagemath.org . . . I have a few things I'd like to add!

Andrea Lazzarotto

unread,
Sep 16, 2012, 9:23:11 AM9/16/12
to sage-...@googlegroups.com


2012/9/13 Niles Johnson <nil...@gmail.com>

And here's a link to the video:


That's amazing!!! :D

--
Andrea Lazzarotto - http://andrealazzarotto.com

Reply all
Reply to author
Forward
0 new messages