Skip to content

Commit 311fd34

Browse files
author
Release Manager
committed
Trac #32869: fix improper names of several special functions for CBF
CBF, i.e. sage/rings/complex_arb.pyx, names functions such as `Ei` impoperly, as `ei`. This in particular makes it impossible to do e.g. `CBF(Ei(I))` (one gets infinite recursion error). The fix is just to rename them. One can first set aliases `Ei = ei`, etc., and deprecate `ei`, and then, after the deprecation period, do the renaming. URL: https://trac.sagemath.org/32869 Reported by: dimpase Ticket author(s): Marc Mezzarobba Reviewer(s): Dima Pasechnik
2 parents ec03b51 + d9ee935 commit 311fd34

File tree

1 file changed

+89
-16
lines changed

1 file changed

+89
-16
lines changed

src/sage/rings/complex_arb.pyx

+89-16
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ from sage.structure.parent cimport Parent
188188
from sage.structure.unique_representation import UniqueRepresentation
189189
from sage.arith.long cimport is_small_python_int
190190

191+
from sage.misc.superseded import deprecated_function_alias
191192
from sage.rings.complex_mpfr import ComplexField
192193
from sage.rings.complex_interval_field import ComplexIntervalField, ComplexIntervalField_class
193194
from sage.rings.integer_ring import ZZ
@@ -4175,92 +4176,134 @@ cdef class ComplexBall(RingElement):
41754176
if _do_sig(prec(self)): sig_off()
41764177
return res
41774178

4178-
def ei(self):
4179+
def Ei(self):
41794180
"""
41804181
Return the exponential integral with argument ``self``.
41814182
41824183
EXAMPLES::
41834184
4184-
sage: CBF(1, 1).ei()
4185+
sage: CBF(1, 1).Ei()
41854186
[1.76462598556385 +/- ...e-15] + [2.38776985151052 +/- ...e-15]*I
4186-
sage: CBF(0).ei()
4187+
sage: CBF(0).Ei()
41874188
nan
4189+
4190+
TESTS:
4191+
4192+
sage: CBF(Ei(I))
4193+
[0.337403922900968 +/- 3.76e-16] + [2.51687939716208 +/- 2.01e-15]*I
41884194
"""
41894195
cdef ComplexBall result = self._new()
41904196
if _do_sig(prec(self)): sig_on()
41914197
acb_hypgeom_ei(result.value, self.value, prec(self))
41924198
if _do_sig(prec(self)): sig_off()
41934199
return result
41944200

4195-
def si(self):
4201+
ei = deprecated_function_alias(32869, Ei)
4202+
4203+
def Si(self):
41964204
"""
41974205
Return the sine integral with argument ``self``.
41984206
41994207
EXAMPLES::
42004208
4201-
sage: CBF(1, 1).si()
4209+
sage: CBF(1, 1).Si()
42024210
[1.10422265823558 +/- ...e-15] + [0.88245380500792 +/- ...e-15]*I
4203-
sage: CBF(0).si()
4211+
sage: CBF(0).Si()
42044212
0
4213+
4214+
TESTS:
4215+
4216+
sage: CBF(Si(I))
4217+
[1.05725087537573 +/- 2.77e-15]*I
42054218
"""
42064219
cdef ComplexBall result = self._new()
42074220
if _do_sig(prec(self)): sig_on()
42084221
acb_hypgeom_si(result.value, self.value, prec(self))
42094222
if _do_sig(prec(self)): sig_off()
42104223
return result
42114224

4212-
def ci(self):
4225+
sin_integral = Si # as for the symbolic function
4226+
4227+
si = deprecated_function_alias(32869, Si)
4228+
4229+
def Ci(self):
42134230
"""
42144231
Return the cosine integral with argument ``self``.
42154232
42164233
EXAMPLES::
42174234
4218-
sage: CBF(1, 1).ci()
4235+
sage: CBF(1, 1).Ci()
42194236
[0.882172180555936 +/- ...e-16] + [0.287249133519956 +/- ...e-16]*I
4220-
sage: CBF(0).ci()
4237+
sage: CBF(0).Ci()
42214238
nan + nan*I
4239+
4240+
TESTS:
4241+
4242+
sage: CBF(Ci(I))
4243+
[0.837866940980208 +/- 4.72e-16] + [1.570796326794897 +/- 5.54e-16]*I
42224244
"""
42234245
cdef ComplexBall result = self._new()
42244246
if _do_sig(prec(self)): sig_on()
42254247
acb_hypgeom_ci(result.value, self.value, prec(self))
42264248
if _do_sig(prec(self)): sig_off()
42274249
return result
42284250

4229-
def shi(self):
4251+
cos_integral = Ci # as for the symbolic function
4252+
4253+
ci = deprecated_function_alias(32869, Ci)
4254+
4255+
def Shi(self):
42304256
"""
42314257
Return the hyperbolic sine integral with argument ``self``.
42324258
42334259
EXAMPLES::
42344260
4235-
sage: CBF(1, 1).shi()
4261+
sage: CBF(1, 1).Shi()
42364262
[0.88245380500792 +/- ...e-15] + [1.10422265823558 +/- ...e-15]*I
4237-
sage: CBF(0).shi()
4263+
sage: CBF(0).Shi()
42384264
0
4239-
"""
42404265
4266+
TESTS:
4267+
4268+
sage: CBF(Shi(I))
4269+
[0.946083070367183 +/- 9.22e-16]*I
4270+
"""
42414271
cdef ComplexBall result = self._new()
42424272
if _do_sig(prec(self)): sig_on()
42434273
acb_hypgeom_shi(result.value, self.value, prec(self))
42444274
if _do_sig(prec(self)): sig_off()
42454275
return result
42464276

4247-
def chi(self):
4277+
sinh_integral = Shi
4278+
4279+
shi = deprecated_function_alias(32869, Shi)
4280+
4281+
def Chi(self):
42484282
"""
42494283
Return the hyperbolic cosine integral with argument ``self``.
42504284
42514285
EXAMPLES::
42524286
4253-
sage: CBF(1, 1).chi()
4287+
sage: CBF(1, 1).Chi()
42544288
[0.882172180555936 +/- ...e-16] + [1.28354719327494 +/- ...e-15]*I
4255-
sage: CBF(0).chi()
4289+
sage: CBF(0).Chi()
42564290
nan + nan*I
4291+
4292+
TESTS:
4293+
4294+
sage: CBF(Chi(I))
4295+
[0.337403922900968 +/- 3.25e-16] + [1.570796326794897 +/- 5.54e-16]*I
42574296
"""
42584297
cdef ComplexBall result = self._new()
42594298
if _do_sig(prec(self)): sig_on()
42604299
acb_hypgeom_chi(result.value, self.value, prec(self))
42614300
if _do_sig(prec(self)): sig_off()
42624301
return result
42634302

4303+
cosh_integral = Chi
4304+
4305+
chi = deprecated_function_alias(32869, Chi)
4306+
42644307
def li(self, bint offset=False):
42654308
"""
42664309
Return the logarithmic integral with argument ``self``.
@@ -4279,13 +4322,43 @@ cdef class ComplexBall(RingElement):
42794322
0.000000000000000
42804323
sage: Li(0).n()
42814324
-1.04516378011749
4325+
4326+
TESTS::
4327+
4328+
sage: CBF(li(0))
4329+
0
4330+
sage: CBF(Li(0))
4331+
[-1.04516378011749...]
42824332
"""
42834333
cdef ComplexBall result = self._new()
42844334
if _do_sig(prec(self)): sig_on()
42854335
acb_hypgeom_li(result.value, self.value, offset, prec(self))
42864336
if _do_sig(prec(self)): sig_off()
42874337
return result
42884338

4339+
log_integral = li
4340+
4341+
def Li(self):
4342+
"""
4343+
Offset logarithmic integral.
4344+
4345+
EXAMPLES::
4346+
4347+
sage: CBF(0).Li()
4348+
[-1.045163780117493 +/- ...e-16]
4349+
sage: li(0).n()
4350+
0.000000000000000
4351+
sage: Li(0).n()
4352+
-1.04516378011749
4353+
"""
4354+
cdef ComplexBall result = self._new()
4355+
if _do_sig(prec(self)): sig_on()
4356+
acb_hypgeom_li(result.value, self.value, True, prec(self))
4357+
if _do_sig(prec(self)): sig_off()
4358+
return result
4359+
4360+
log_integral_offset = Li
4361+
42894362
def jacobi_theta(self, tau):
42904363
r"""
42914364
Return the four Jacobi theta functions evaluated at the argument

0 commit comments

Comments
 (0)