Skip to content

Commit c9aa34b

Browse files
author
Release Manager
committed
Trac #33957: Manifold.options.omit_function_arguments ineffective for arguments not in alphabetic order
In Sage 9.7.beta1, we have {{{ sage: S.<theta, phi> = manifolds.Sphere(2, coordinates='spherical') sage: F = S.scalar_field(function('f')(theta, phi) + function('g')(theta)) sage: F.display() S^2 → ℝ on A: (theta, phi) ↦ f(theta, phi) + g(theta) }}} So far, so good, but {{{ sage: S.options.omit_function_arguments = True sage: F.display() S^2 → ℝ on A: (theta, phi) ↦ f(theta, phi) + g }}} The r.h.s. should be `f + g`. This bug is actually triggered by the following feature/bug of symbolic expressions: {{{ sage: function('f')(theta, phi).arguments() (phi, theta) }}} i.e. `arguments()` returns the arguments sorted according to the alphabetical order, as reported in https://groups.google.com/g/sage- devel/c/Gt6GWZU-cI4/. See also #32227. URL: https://trac.sagemath.org/33957 Reported by: egourgoulhon Ticket author(s): Utkarsh Sharma Reviewer(s): Eric Gourgoulhon
2 parents 0b2741d + 6dc5953 commit c9aa34b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/sage/manifolds/utilities.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -999,13 +999,14 @@ def _repr_(self):
999999

10001000
d = d.replace(o, res)
10011001

1002+
import re
10021003
from sage.manifolds.manifold import TopologicalManifold
10031004
if TopologicalManifold.options.omit_function_arguments:
10041005
list_f = []
10051006
_list_functions(self, list_f)
10061007

10071008
for m in list_f:
1008-
d = d.replace(m[1] + m[2], m[1])
1009+
d = re.sub(m[1] + r'\([^)]+\)', m[1], d)
10091010

10101011
return d
10111012

0 commit comments

Comments
 (0)