Problem with wedge of unnamed diff forms on non-parall. mfds

63 views
Skip to first unread message

Michi

unread,
Mar 30, 2019, 10:21:11 AM3/30/19
to sage-devel
Hey folks,
I'm pretty new to this, so please be patient.

During my developement of an implementation of characteristic classes of the tangent bdl of manifolds, I've encountered a problem when wedging unnamed differential forms on non-parallelizable manifolds. Let's have an example:

sage: S2 = Manifold(2, name='S2', latex_name=r'S^2', start_index=1)
sage
: U = S2.open_subset(name='U', latex_name=r'S^2 \setminus \{\text{South pole}\}')
sage
: V = S2.open_subset(name='V', latex_name=r'S^2 \setminus \{\text{North pole}\}')
sage
: S2.declare_union(U,V)
sage
: c_xy.<t,z> = U.chart()
sage
: c_uv.<u,v> = V.chart()
sage
: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
                               intersection_name
='W', restrictions1= x^2+y^2!=0,
                               restrictions2
= u^2+v^2!=0)
sage
: uv_to_xy = xy_to_uv.inverse()
sage
: e_tz = c_tz.frame()
sage
: e_uv = c_uv.frame(); print(e_uv)

sage
: omega = S2.diff_form(1, name='omega', latex_name=r'\omega')
sage
: unnamed = S2.diff_form(1)

sage
: omega[e_xy,:] = -x^2, y^2; show(omega.disp(e_tz))
sage
: omega.add_comp_by_continuation(e_uv, V.intersection(U), c_uv)

sage
: unnamed[e_xy,:] = -x^2, y^2; show(omega.disp(e_tz))
sage
: unnamed.add_comp_by_continuation(e_uv, V.intersection(U), c_uv)

sage
: unnamed.wedge(omega)

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-40-a6a98dadea76> in <module>()
----> 1 unnamed.wedge(omega)

/opt/sagemath-8.6/local/lib/python2.7/site-packages/sage/manifolds/differentiable/diff_form.pyc in wedge(self, other)
    520         vmodule = dom_resu.vector_field_module(dest_map=dest_map_resu)
    521         resu_degree = self._tensor_rank + other._tensor_rank
--> 522         resu = vmodule.alternating_form(resu_degree, name=resu_name,
    523                                         latex_name=resu_latex_name)
    524         for dom in self_r._restrictions:

UnboundLocalError: local variable 'resu_name' referenced before assignment

Unfortunately, I'm not a professional in python, but I guess the problem could be solved by declaring resu_name and resu_latex_name in the wedge method of the manifolds/differentiable/tensorfield.py file as "None" in the very beginning. In fact, solving this is crucial for calculations with mixed differential forms and its matrices in order to compute the characteristic classes.

What is the next step? Create a ticket?

Also, I like to discuss my developement so far. But that might be better for another thread.

Michi

unread,
Mar 30, 2019, 10:39:51 AM3/30/19
to sage-devel
Or, maybe, a better approach would be a direct manipulation via resu._name and resu._latex_name.

However, I'm not familiar with the procedure. Furthermore, is this mailing list right the place to discuss my written code?

Nils Bruin

unread,
Mar 30, 2019, 3:09:21 PM3/30/19
to sage-devel
On Saturday, March 30, 2019 at 7:39:51 AM UTC-7, YoungMath wrote:
Or, maybe, a better approach would be a direct manipulation via resu._name and resu._latex_name.

However, I'm not familiar with the procedure. Furthermore, is this mailing list right the place to discuss my written code?

The code you give doesn't reproduce the error you list (I get "y is not defined").

I suspect the problem is that the "wedge" code fails to deal with differential forms that don't have their names set. A workaround would be to set (dummy) names on "unnamed". A fix would consist of letting "wedge" deal with differentials that don't have names set. That's ticket-worthy. Probably the author of the file can fix this pretty quickly (and bang his head on the desk a couple of times in the process).

The doctest example that comes with the function (which you have adapted into your example by the looks of it) shows that "wedge" does work for (at least some) differentials that do have a name.

Michael Jung

unread,
Mar 30, 2019, 3:23:35 PM3/30/19
to sage-...@googlegroups.com

Oh yes, the chart is wrongly defined. It should be:

sage: c_xy.<x,y> = U.chart()

obviously. I copied it once, changed the variables, and copied it back changing the variables again. Sorry.

What are appropriate settings for a ticket regarding this issue? I'm a ticket virgin.

--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/EfLYpAxl_jU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To post to this group, send email to sage-...@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Virenfrei. www.avast.com

Nils Bruin

unread,
Mar 30, 2019, 3:35:19 PM3/30/19
to sage-devel
Type: defect
(you can leave it major, unless you really feel it's minor)
Component: Manifolds, but that doesn't exist, so Geometry I guess
cc likely authors to speed things up (Copyright in the file suggests
Gourgoulhon and/or Scrimshaw )

post a link to the ticket here when you've filed. That makes it easier for the authors to find the ticket.

Make sure that your example exhibits the desired behaviour in a clean sage session (i.e., test it by pasting it in, just as a potential dev would do). If your code is buggy, people probably decide their time is better spent on another ticket: strictly speaking, your ticket is invalid in such a case, because you're not illustrating the behaviour you claim.

MJ

unread,
Mar 30, 2019, 3:49:37 PM3/30/19
to sage-devel
Yes, of course. I'm just too impatient for tasks like this. Here's the ticket:

Eric Gourgoulhon

unread,
Mar 30, 2019, 7:43:16 PM3/30/19
to sage-devel
Hi,

Thanks MJ for reporting the bug and opening the ticket.
It is fixed in the ticket branch now.

Nils: yes I banged my head on the desk a couple of times  :-)

Best wishes,

Eric.

Eric Gourgoulhon

unread,
Mar 31, 2019, 5:36:32 AM3/31/19
to sage-devel
PS: if you have SageMath 8.7 installed and want to use the fix introduced in https://trac.sagemath.org/ticket/27576, it is quite easy: simply open a console at the SageMath root directory and type:

git remote add trac git://trac.sagemath.org/sage.git
git checkout -b wedge_fixed
git pull trac public/manifolds/bug_wedge_unnamed_trac27576
./sage -b

NB: this is fast and easy only if you have SageMath *8.7* installed
Reply all
Reply to author
Forward
0 new messages