2d hyperbolic geometry, homogeneous spaces, plot

160 views
Skip to first unread message

Vincent D

unread,
May 27, 2010, 11:35:39 PM5/27/10
to sage-devel
Hello,

It seems that Sage doesn't yet have tools to render nice pictures of
hyperbolic geometry. I would like to be able to plot fundamental
domains and tessellations for some Fuchsian groups (in the three
standard conformal models: half-plane, disc and hyperboloid). Has
anybody started some work in this direction? Does anybody have
interesting pointers on tools or algorithmic references in that
domain?

More generally, the way sage.plot is built seems to be dedicated
mostly to function graphs. Is it possible to attach geometric objects
to an underlying space? meaning that if I have a Square attached to
the euclidean plane, I would like to be able to act on it with a
matrix like in the following
{{{
sage: p = Polygon([(0,0),(0,1),(1,1)])
sage: m = matrix([[1,1],[0,1]])
sage: m*p # the polygon made of the points (0,0), (1,1), (2,1)
}}}
e.g. to see a Polygon more as a subset of an homogeneous space with a
complete metric than a plot object.


There is a patch in sage-combinat that is needed to plot the arc of
circles (which is called arc-vd.patch) but which is also available
here:
http://iml.univ-mrs.fr/~delecroi/arc-vd.patch

The file that contains a draft of hyperbolic geometry:
http://iml.univ-mrs.fr/~delecroi/hyperbolic_half_plane.py

A sage worksheet that explains how the thing works:
http://iml.univ-mrs.fr/~delecroi/polygon_in_hyperbolic_plane.sws


Thank you,
Vincent

Jason Grout

unread,
May 28, 2010, 12:12:13 AM5/28/10
to sage-...@googlegroups.com
On 5/27/10 10:35 PM, Vincent D wrote:

> More generally, the way sage.plot is built seems to be dedicated
> mostly to function graphs. Is it possible to attach geometric objects
> to an underlying space? meaning that if I have a Square attached to
> the euclidean plane, I would like to be able to act on it with a
> matrix like in the following
> {{{
> sage: p = Polygon([(0,0),(0,1),(1,1)])
> sage: m = matrix([[1,1],[0,1]])
> sage: m*p # the polygon made of the points (0,0), (1,1), (2,1)
> }}}
> e.g. to see a Polygon more as a subset of an homogeneous space with a
> complete metric than a plot object.
>

I think that would be cool, even just from the standpoint of teaching
linear algebra or calc 3 and playing with linear transformations. And I
don't see why you'd need to limit it to things like Polygons. It would
be cool if you could do:

p=plot(whatever)
m*p # transform each coordinate

I think it would be very straightforward to do this using the underlying
2d matplotlib library, which has a very nice transformation framework
builtin [1] (in other words, we could probably easily just save up the
transformations, like we currently do with 3d plots, and then apply the
transformations on output, which should just be a matter of one or two
matplotlib calls at the very end right before drawing). On the 3d side,
Sage has a transformation framework, so it should be straightfoward to
make m*p do something cool there too.

I wonder if it would help if the graphics were inside the coercion system.


Jason

[1] http://matplotlib.sourceforge.net/devel/transformations.html

Jason Grout

unread,
May 28, 2010, 12:32:49 AM5/28/10
to sage-...@googlegroups.com
On 5/27/10 11:12 PM, Jason Grout wrote:
> On 5/27/10 10:35 PM, Vincent D wrote:
>
>> More generally, the way sage.plot is built seems to be dedicated
>> mostly to function graphs. Is it possible to attach geometric objects
>> to an underlying space? meaning that if I have a Square attached to
>> the euclidean plane, I would like to be able to act on it with a
>> matrix like in the following
>> {{{
>> sage: p = Polygon([(0,0),(0,1),(1,1)])
>> sage: m = matrix([[1,1],[0,1]])
>> sage: m*p # the polygon made of the points (0,0), (1,1), (2,1)
>> }}}
>> e.g. to see a Polygon more as a subset of an homogeneous space with a
>> complete metric than a plot object.
>>
>
> I think that would be cool, even just from the standpoint of teaching
> linear algebra or calc 3 and playing with linear transformations. And I
> don't see why you'd need to limit it to things like Polygons. It would
> be cool if you could do:
>
> p=plot(whatever)
> m*p # transform each coordinate


In fact, it would be cool if you could do nonlinear transformations as
well. Suppose you defined (for example) the polar coordinate transform
T(r,theta)=(r*cos(theta), r*sin(theta)). Then T(some plot) or T*plot or
plot.transform(T) or something could do the same sort of thing as above
(for example, if the plot was the horizontal line r=1, then T(plot) or
T*plot or whatever would be a plot of a circle of radius 1).

Jason


John Cremona

unread,
May 28, 2010, 4:24:37 AM5/28/10
to sage-...@googlegroups.com
I'm sure that the army of people implementing modular forms and
related stuff in Sage will welcome such graphical capabilities for
drawing fundamental domains.

I wonder if Helena Verrill, who wrote a very nice package for drawing
fundamental domains in Magma, would be interested? I will ask her.

I also have a student (Maite Aranes) doing related things with 3D
hyperbolic geometry, using Sage notebooks to draw projections of
fundamental regions (but not 3D regions yet). She will be at SD23 in
Leiden.

John

> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

kcrisman

unread,
May 28, 2010, 9:20:54 AM5/28/10
to sage-devel


On May 27, 11:35 pm, Vincent D <20100.delecr...@gmail.com> wrote:
> Hello,
>
> It seems that Sage doesn't yet have tools to render nice pictures of
> hyperbolic geometry. I would like to be able to plot fundamental
> domains and tessellations for some Fuchsian groups (in the three
> standard conformal models: half-plane, disc and hyperboloid). Has
> anybody started some work in this direction? Does anybody have
> interesting pointers on tools or algorithmic references in that
> domain?
>
> More generally, the way sage.plot is built seems to be dedicated
> mostly to function graphs. Is it possible to attach geometric objects
> to an underlying space? meaning that if I have a Square attached to
> the euclidean plane, I would like to be able to act on it with a
> matrix like in the following
> {{{
> sage: p = Polygon([(0,0),(0,1),(1,1)])
> sage: m = matrix([[1,1],[0,1]])
> sage: m*p  # the polygon made of the points (0,0), (1,1), (2,1)}}}
>
> e.g. to see a Polygon more as a subset of an homogeneous space with a
> complete metric than a plot object.
>
> There is a patch in sage-combinat that is needed to plot the arc of
> circles (which is called arc-vd.patch) but which is also available
> here:http://iml.univ-mrs.fr/~delecroi/arc-vd.patch
>

At first I thought this already existed, but sure enough, disk((2,3),
1,angle=(pi/2,pi),fill=False) only gives an empty sector, not an arc.
I highly recommend that you open a regular Trac ticket for this
functionality and post this patch - as you saw, creating the class is
a VERY straightforward combination of the Circle and Disk classes. If
possible, the syntax should be similar to that for Disk, and maybe the
ticket should include a request for making ellipses as a primitive,
since that seems to be what sort of arcs you are making (if I
understand the major/minor axis bit correctly). I would be very happy
to help make this get into Sage proper fairly quickly.

> The file that contains a draft of hyperbolic geometry:http://iml.univ-mrs.fr/~delecroi/hyperbolic_half_plane.py
>
> A sage worksheet that explains how the thing works:http://iml.univ-mrs.fr/~delecroi/polygon_in_hyperbolic_plane.sws

This is very nice looking so far, and definitely needed. Thanks for
the work thus far!

For reference, there are several Geogebra resources on 2D hyperbolic
geometry (though I am not aware that any of them yet are standard
commands), and a very fun Java applet called NonEuclid that might give
some ideas as to what functionality of the education variety might be
good to put in the TODO.

- kcrisman

Vincent D

unread,
May 28, 2010, 4:28:15 PM5/28/10
to sage-devel
The main actual problem I see for plotting is that transformation must
be relative to the ambient space. I would like to be able to see the
plane as a stereographic projection of the 2-dimensional sphere (and
then act with SL(2,C) as homography) but then the straight lines do
not correspond any more to segment in the plane we must allow circle
arcs as well. I thought about something like

{{{
sage: Polygon([(2, 1), (1.34, 2), (4, 3.2)]) # a polygon in the
euclidean space
sage: HH = HyperbolicPlane()
sage: x0 = HH(1+I); x1 = HH(2+3*I); x3 = HH(2+I)
sage: Polygon([x0, x1, x2]) # a polygon in the hyperbolic plane
sage: DD = HyperbolicDisc()
sage: x0 = DD(0.34 + 0.1*I); x1 = DD(0.5); x2 = DD(0.34-.5*I)
sage: Polygon([x0, x1, x2]) # a polygon in the hyperbolic disc
}}}

> At first I thought this already existed, but sure enough, disk((2,3),
> 1,angle=(pi/2,pi),fill=False) only gives an empty sector, not an arc.
> I highly recommend that you open a regular Trac ticket for this
> functionality and post this patch - as you saw, creating the class is
> a VERY straightforward combination of the Circle and Disk classes.

I opened the ticket 9076 for arc plotting

Thank you for your answers, I'm looking carefully at what Helena
Verrill did,
Vincent

Greg Laun

unread,
Jun 17, 2010, 11:23:48 AM6/17/10
to sage-devel
Our geometry lab has a good deal of existing code for hyperbolic
geometry, and one of my goals this summer is to port it to Sage. I
spoke with Bill Goldman, who heads the lab, and he's on board with
GPLing the code and releasing it into the Sage code base if that's
something people want.

Right now the code does:

1. Drawing geodesics, segments, and polygons in the Poincare disk and
upper half-plane models, etc (e.g. what might be considered hyperbolic
graphics primitives)
2. visualization of the action of Mobius transformations on CP^1,
also visualizing stereographic projection
3. Some routines for spherical geometry
4. Visualizing Schottky systems, and several other interactive
educational demonstrations
5. Some basic tessellation code
6. Basic routines for working in (2,1) Minkowsi space (which can
easily be generalized to other dimensions)
7. We're currently working on visualizing some Fricke and
Teichmueller spaces.

Most of the code exists in the form of Mathematica notebooks.

Alternately, if somebody else prefers to port the code to sage, I can
provide the Mathematica notebooks, some of which can be found online
here:
http://egl.math.umd.edu/software.html

I'd personally love to see much of this functionality built into
sage. We home-grow this software for research purposes, but I'm sure
there are many other people who have similar needs.

Best,
Greg

Jason Grout

unread,
Jun 18, 2010, 10:39:43 AM6/18/10
to sage-...@googlegroups.com
On 6/17/10 10:23 AM, Greg Laun wrote:
> Our geometry lab has a good deal of existing code for hyperbolic
> geometry, and one of my goals this summer is to port it to Sage. I
> spoke with Bill Goldman, who heads the lab, and he's on board with
> GPLing the code and releasing it into the Sage code base if that's
> something people want.

I think it would be great to have those things in Sage!

Thanks,

Jason

Greg Laun

unread,
Jun 21, 2010, 2:19:24 PM6/21/10
to sage-devel
Okay, I'll get to work on that

Greg

On Jun 18, 10:39 am, Jason Grout <jason-s...@creativetrax.com> wrote:
> On 6/17/10 10:23 AM, Greg Laun wrote:
>
> > Ourgeometrylab has a good deal of existing code for hyperbolic

Vincent D

unread,
Jul 6, 2010, 12:31:47 PM7/6/10
to sage-devel
I opened a ticket [1] for hyperbolic geometry. I implemented a general
framework for the hyperbolic half plane (with point, geodesic,
polygons) and the action of SL(2,R).

Any help or comment welcome.

Vincent

[1] http://trac.sagemath.org/sage_trac/ticket/9439

PS: I do not (want to) know any Java. I was able to use H. Verrill
work because she wrote things in english. But the Maryland team
softares seem to be very interesting.

William Stein

unread,
Jul 6, 2010, 12:34:12 PM7/6/10
to sage-...@googlegroups.com
On Tue, Jul 6, 2010 at 6:31 PM, Vincent D <20100.d...@gmail.com> wrote:
> I opened a ticket [1] for hyperbolic geometry. I implemented a general
> framework for the hyperbolic half plane (with point, geodesic,
> polygons) and the action of SL(2,R).
>
> Any help or comment welcome.
>
> Vincent
>
>  [1] http://trac.sagemath.org/sage_trac/ticket/9439

Could you give a lightening talk about the math behind this tomorrow
at Sage Days?


> PS: I do not (want to) know any Java. I was able to use H. Verrill
> work because she wrote things in english. But the Maryland team
> softares seem to be very interesting.
>

> --
> To post to this group, send an email to sage-...@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

Vincent D

unread,
Jul 7, 2010, 2:20:47 AM7/7/10
to sage-devel
> > I opened a ticket [1] for hyperbolic geometry. I implemented a general
> > framework for the hyperbolic half plane (with point, geodesic,
> > polygons) and the action of SL(2,R).
>
> > Any help or comment welcome.
>
> > Vincent
>
> >  [1]http://trac.sagemath.org/sage_trac/ticket/9439
>
> Could you give a lightening talk about the math behind this tomorrow
> at Sage Days?
>

It will be impossible, I'm leaving in few hours. But you can ask Maite
how worked with me on Verrill port...
Reply all
Reply to author
Forward
0 new messages