Opened 3 years ago

Closed 3 years ago

# Problem with wedge of unnamed diff forms

Reported by: Owned by: gh-DeRhamSource major sage-8.8 geometry wedge, diff_form.py, manifolds egourgoulhon, tscrim, nbruin Eric Gourgoulhon Travis Scrimshaw N/A 309f594 309f594f5ee9de9168d9dc9a81f97c72949f07e6

### Description

This example code:

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.<x,y> = 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_xy = c_xy.frame()
sage: e_uv = c_uv.frame()

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

sage: unnamed[e_xy,:] = -x^2, y^2

sage: unnamed.wedge(omega)


leads to the following error message:

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-4-9f0a1ab49c79> in <module>()
22
---> 23 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


I suspect the issue is hidden in the wedge method in manifolds/differentiable/diff_form.py and guess it can be easily fixed by manipulating names directly via the attributes resu._name and resu._latex_name instead.

### comment:2 Changed 3 years ago by egourgoulhon

• Authors changed from Gourgoulhon, Scrimshaw to Eric Gourgoulhon
• Branch set to public/manifolds/bug_wedge_unnamed_trac27576
• Cc egourgoulhon tscrim added; Gourgoulhon Scrimshaw removed
• Commit set to e300b91d819967fed0e2d05dac9a4c93bfe292fb
• Status changed from new to needs_review

Thanks for reporting this bug! It is fixed in the attached branch.

New commits:

 ​e300b91 Fix bug with wedge of unnamed diff forms (trac #27576)

### comment:3 Changed 3 years ago by git

• Commit changed from e300b91d819967fed0e2d05dac9a4c93bfe292fb to 309f594f5ee9de9168d9dc9a81f97c72949f07e6

Branch pushed to git repo; I updated commit sha1. New commits:

 ​309f594 Add doctest to check that the the bug #27576 is fixed

### comment:5 follow-up: ↓ 6 Changed 3 years ago by tscrim

• Reviewers set to Travis Scrimshaw
• Status changed from needs_review to positive_review

LGTM.

### comment:6 in reply to: ↑ 5 Changed 3 years ago by egourgoulhon

Thanks for the review!

### comment:7 Changed 3 years ago by vbraun

• Branch changed from public/manifolds/bug_wedge_unnamed_trac27576 to 309f594f5ee9de9168d9dc9a81f97c72949f07e6
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.