3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/science/math/sage/patches/arb-2.13.0.patch
Timo Kaufmann 398dad270a sage, arb: update sage dependencies arb and pynac
Removes the version pinning for arb and pynac by backporting the
upstream (sage) package upgrades. This necessitates a new patch for arb,
which was however already proposed and accepted upstream.
2018-06-30 17:05:56 +02:00

428 lines
18 KiB
Diff

commit c885927e25b29bd23869e02379c2918da430323e
Author: Timo Kaufmann <timokau@zoho.com>
Date: Sat Jun 30 02:26:15 2018 +0200
diff --git a/build/pkgs/arb/checksums.ini b/build/pkgs/arb/checksums.ini
index 1924ee03c3..9323b97391 100644
--- a/build/pkgs/arb/checksums.ini
+++ b/build/pkgs/arb/checksums.ini
@@ -1,4 +1,4 @@
tarball=arb-VERSION.tar.gz
-sha1=27476d0529e48a07d92da90bd0fb80dd18f443e3
-md5=733285d9705d10b8024e551ffa81952f
-cksum=2391183744
+sha1=44eda7bf8eaa666c45b1fc2c1b5bd08756d94b58
+md5=fa24de9fffe4394fb6a7a6792e2ecc5f
+cksum=3689220688
diff --git a/build/pkgs/arb/package-version.txt b/build/pkgs/arb/package-version.txt
index c8810e9bdb..fb2c0766b7 100644
--- a/build/pkgs/arb/package-version.txt
+++ b/build/pkgs/arb/package-version.txt
@@ -1 +1 @@
-2.12.0.p0
+2.13.0
diff --git a/build/pkgs/arb/patches/arb-pie-hardening-conflict.patch b/build/pkgs/arb/patches/arb-pie-hardening-conflict.patch
deleted file mode 100644
index 3e5c0e708b..0000000000
--- a/build/pkgs/arb/patches/arb-pie-hardening-conflict.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-In newer binutils, ld options -r and -pie conflict.
-Patch due to Jörg-Volker Peetz
-(source : https://groups.google.com/d/msg/sage-devel/TduebNoZuBE/sEULolL0BQAJ),
-packaged by Emmanuel Charpentier
-
-diff -ru arb-2.8.1-orig/Makefile.subdirs arb-2.8.1-new/Makefile.subdirs
---- arb-2.8.1-orig/Makefile.subdirs 2015-12-31 17:30:01.000000000 +0100
-+++ arb-2.8.1-new/Makefile.subdirs 2016-11-07 18:50:34.540051779 +0100
-@@ -52,7 +52,7 @@
- $(QUIET_CC) $(CC) $(CFLAGS) $(INCS) -c $< -o $@ -MMD -MP -MF "$(BUILD_DIR)/$(MOD_DIR)_$*.d" -MT "$(BUILD_DIR)/$(MOD_DIR)_$*.d" -MT "$@"
-
- $(MOD_LOBJ): $(LOBJS)
-- $(QUIET_CC) $(CC) $(ABI_FLAG) -Wl,-r $^ -o $@ -nostdlib
-+ $(QUIET_CC) $(CC) $(ABI_FLAG) -r $^ -o $@ -nostdlib
-
- -include $(LOBJS:.lo=.d)
-
diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx
index 70d51e655a..00e7caea2c 100644
--- a/src/sage/rings/complex_arb.pyx
+++ b/src/sage/rings/complex_arb.pyx
@@ -857,14 +857,14 @@ class ComplexBallField(UniqueRepresentation, Field):
[0.500000000000000 +/- 2.09e-16]
sage: CBF.integral(lambda x, _: x.gamma(), 1 - CBF(i), 1 + CBF(i))
- [+/- 3.95e-15] + [1.5723926694981 +/- 4.53e-14]*I
+ [+/- 4...e-15] + [1.5723926694981 +/- 4...e-14]*I
sage: C = ComplexBallField(100)
sage: C.integral(lambda x, _: x.cos() * x.sin(), 0, 1)
[0.35403670913678559674939205737 +/- 8.89e-30]
sage: CBF.integral(lambda x, _: (x + x.exp()).sin(), 0, 8)
- [0.34740017266 +/- 6.36e-12]
+ [0.34740017266 +/- 6...e-12]
sage: C = ComplexBallField(2000)
sage: C.integral(lambda x, _: (x + x.exp()).sin(), 0, 8) # long time
@@ -879,14 +879,14 @@ class ComplexBallField(UniqueRepresentation, Field):
....: else:
....: return z.sqrt()
sage: CBF.integral(my_sqrt, -1 + CBF(i), -1 - CBF(i))
- [+/- 1.14e-14] + [-0.4752076627926 +/- 5.18e-14]*I
+ [+/- 1.14e-14] + [-0.4752076627926 +/- 5...e-14]*I
Note, though, that proper handling of the ``analytic`` flag is required
even when the path does not touch the branch cut::
sage: correct = CBF.integral(my_sqrt, 1, 2); correct
[1.21895141649746 +/- 3.73e-15]
- sage: RBF(integral(sqrt(x), x, 1, 2))
+ sage: RBF(integral(sqrt(x), x, 1, 2)) # long time
[1.21895141649746 +/- 1.79e-15]
sage: wrong = CBF.integral(lambda z, _: z.sqrt(), 1, 2) # WRONG!
sage: correct - wrong
@@ -915,9 +915,9 @@ class ComplexBallField(UniqueRepresentation, Field):
the integrand is unbounded::
sage: CBF.integral(lambda x, _: 1/x, -1, 1)
- [+/- inf] + [+/- inf]*I
+ nan + nan*I
sage: CBF.integral(lambda x, _: 1/x, 10^-1000, 1)
- [+/- inf] + [+/- inf]*I
+ nan + nan*I
sage: CBF.integral(lambda x, _: 1/x, 10^-1000, 1, abs_tol=1e-10)
[2302.5850930 +/- 1.26e-8]
@@ -928,14 +928,15 @@ class ComplexBallField(UniqueRepresentation, Field):
sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, abs_tol=1e-450)
[2.304377150950e-439 +/- 9.74e-452]
sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, abs_tol=0)
- [2.304377150949e-439 +/- 7.53e-452]
- sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, rel_tol=1e-4, abs_tol=0)
- [2.30438e-439 +/- 3.90e-445]
+ [2.304377150950e-439 +/- 7...e-452]
+ sage: CBF.integral(lambda x, _: x.exp(), -1020, -1010, rel_tol=1e-2, abs_tol=0)
+ [2.30438e-439 +/- 5.94e-445]
- sage: CBF.integral(lambda x, _: x*(1/x).sin(), 0, 1)
- [+/- 0.644]
- sage: CBF.integral(lambda x, _: x*(1/x).sin(), 0, 1, use_heap=True)
- [0.3785300 +/- 4.32e-8]
+ sage: epsi = CBF(1e-10)
+ sage: CBF.integral(lambda x, _: x*(1/x).sin(), epsi, 1)
+ [0.38 +/- 8.54e-3]
+ sage: CBF.integral(lambda x, _: x*(1/x).sin(), epsi, 1, use_heap=True)
+ [0.37853002 +/- 8.73e-9]
ALGORITHM:
@@ -951,12 +952,12 @@ class ComplexBallField(UniqueRepresentation, Field):
sage: i = QuadraticField(-1).gen()
sage: CBF.integral(lambda x, _: (1 + i*x).gamma(), -1, 1)
- [1.5723926694981 +/- 4.53e-14] + [+/- 3.95e-15]*I
+ [1.5723926694981 +/- 4...e-14] + [+/- 4...e-15]*I
- sage: ComplexBallField(10000).integral(lambda x, _: x.sin(), 0, 1, rel_tol=1e-400)
- [0.459... +/- ...e-4...]
+ sage: ComplexBallField(10000).integral(lambda x, _: x.sin(), 0, 1, rel_tol=1e-300)
+ [0.459... +/- ...e-3...]
sage: CBF.integral(lambda x, _: x.sin(), 0, 100, rel_tol=10)
- [+/- 7.61]
+ [0.138 +/- 5.53e-4]
sage: ComplexBallField(10000).integral(lambda x, _: x.sin(), 0, 1, abs_tol=1e-400)
[0.459697... +/- ...e-4...]
@@ -2389,9 +2390,9 @@ cdef class ComplexBall(RingElement):
sage: ~CBF(i/3)
[-3.00000000000000 +/- 9.44e-16]*I
sage: ~CBF(0)
- [+/- inf]
+ nan
sage: ~CBF(RIF(10,11))
- [0.1 +/- 9.53e-3]
+ [0.1 +/- 9.10e-3]
"""
cdef ComplexBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -2512,9 +2513,9 @@ cdef class ComplexBall(RingElement):
sage: CBF(-2, 1)/CBF(1, 1/3)
[-1.500000000000000 +/- 8.83e-16] + [1.500000000000000 +/- 5.64e-16]*I
sage: CBF(2+I)/CBF(0)
- [+/- inf] + [+/- inf]*I
+ nan + nan*I
sage: CBF(1)/CBF(0)
- [+/- inf]
+ nan
sage: CBF(1)/CBF(RBF(0, 1.))
nan
"""
@@ -2543,9 +2544,9 @@ cdef class ComplexBall(RingElement):
sage: CBF(0)^(1/3)
0
sage: CBF(0)^(-1)
- [+/- inf]
+ nan
sage: CBF(0)^(-2)
- [+/- inf] + [+/- inf]*I
+ nan + nan*I
TESTS::
@@ -2656,12 +2657,12 @@ cdef class ComplexBall(RingElement):
sage: CBF(1).rising_factorial(5)
120.0000000000000
sage: CBF(1/3, 1/2).rising_factorial(300)
- [-3.87949484514e+612 +/- 5.23e+600] + [-3.52042209763e+612 +/- 5.55e+600]*I
+ [-3.87949484514e+612 +/- 5...e+600] + [-3.52042209763e+612 +/- 5...e+600]*I
sage: CBF(1).rising_factorial(-1)
nan
sage: CBF(1).rising_factorial(2**64)
- [+/- 2.30e+347382171305201370464]
+ [+/- 2.30e+347382171326740403407]
sage: ComplexBallField(128)(1).rising_factorial(2**64)
[2.343691126796861348e+347382171305201285713 +/- 4.71e+347382171305201285694]
sage: CBF(1/2).rising_factorial(CBF(2,3))
@@ -2700,7 +2701,7 @@ cdef class ComplexBall(RingElement):
[1.000000000000000 +/- 2.83e-16] + [-0.441271200305303 +/- 2.82e-16]*I
sage: CBF('inf').log()
- nan + nan*I
+ [+/- inf]
sage: CBF(2).log(0)
nan + nan*I
"""
@@ -2808,7 +2809,7 @@ cdef class ComplexBall(RingElement):
sage: CBF(pi/2, 1/10).tan()
[+/- 2.87e-14] + [10.0333111322540 +/- 2.36e-14]*I
sage: CBF(pi/2).tan()
- [+/- inf]
+ nan
"""
cdef ComplexBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -2825,7 +2826,7 @@ cdef class ComplexBall(RingElement):
sage: CBF(pi, 1/10).cot()
[+/- 5.74e-14] + [-10.0333111322540 +/- 2.81e-14]*I
sage: CBF(pi).cot()
- [+/- inf]
+ nan
"""
cdef ComplexBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -3211,9 +3212,9 @@ cdef class ComplexBall(RingElement):
1.000000000000000*I
sage: CBF(2+3*I).hypergeometric([1/4,1/3],[1/2])
- [0.7871684267473 +/- 7.34e-14] + [0.2749254173721 +/- 9.23e-14]*I
+ [0.7871684267473 +/- 7...e-14] + [0.2749254173721 +/- 9...e-14]*I
sage: CBF(2+3*I).hypergeometric([1/4,1/3],[1/2],regularized=True)
- [0.4441122268685 +/- 3.96e-14] + [0.1551100567338 +/- 5.75e-14]*I
+ [0.4441122268685 +/- 3...e-14] + [0.1551100567338 +/- 5...e-14]*I
sage: CBF(5).hypergeometric([2,3], [-5])
nan + nan*I
@@ -4041,9 +4042,9 @@ cdef class ComplexBall(RingElement):
sage: phi = CBF(1,1)
sage: (CBF.pi()/2).elliptic_e_inc(phi)
- [1.283840957898 +/- 3.23e-13] + [-0.5317843366915 +/- 7.79e-14]*I
+ [1.283840957898 +/- 3...e-13] + [-0.5317843366915 +/- 7...e-14]*I
sage: phi.elliptic_e()
- [1.2838409578982 +/- 5.90e-14] + [-0.5317843366915 +/- 3.35e-14]*I
+ [1.2838409578982 +/- 5...e-14] + [-0.5317843366915 +/- 3...e-14]*I
sage: phi = CBF(2, 3/7)
sage: (CBF.pi()/2).elliptic_e_inc(phi)
@@ -4312,8 +4313,7 @@ cdef class ComplexBall(RingElement):
sage: CBF(10).laguerre_L(3, 2)
[-6.666666666667 +/- 4.15e-13]
sage: CBF(5,7).laguerre_L(CBF(2,3), CBF(1,-2))
- [5515.315030271 +/- 4.37e-10] + [-12386.942845271 +/- 5.47e-10]*I
-
+ [5515.315030271 +/- 4...e-10] + [-12386.942845271 +/- 5...e-10]*I
"""
cdef ComplexBall my_n = self._parent.coerce(n)
cdef ComplexBall my_m = self._parent.coerce(m)
@@ -4357,9 +4357,9 @@ cdef class ComplexBall(RingElement):
EXAMPLES::
sage: CBF(1/2).legendre_P(5)
- [0.08984375000000000 +/- 4.5...e-18]
+ [0.0898437500000000 +/- 7...e-17]
sage: CBF(1,2).legendre_P(CBF(2,3), CBF(0,1))
- [0.10996180744364 +/- 7.45e-15] + [0.14312767804055 +/- 8.38e-15]*I
+ [0.10996180744364 +/- 7.12e-15] + [0.14312767804055 +/- 8.07e-15]*I
sage: CBF(-10).legendre_P(5, 325/100)
[-22104403.487377 +/- 6.81e-7] + [53364750.687392 +/- 7.25e-7]*I
sage: CBF(-10).legendre_P(5, 325/100, type=3)
@@ -4393,9 +4393,9 @@ cdef class ComplexBall(RingElement):
sage: CBF(1/2).legendre_Q(5)
[0.55508089057168 +/- 2.79e-15]
sage: CBF(1,2).legendre_Q(CBF(2,3), CBF(0,1))
- [0.167678710 +/- 4.60e-10] + [-0.161558598 +/- 7.47e-10]*I
+ [0.167678710 +/- 3.91e-10] + [-0.161558598 +/- 6.77e-10]*I
sage: CBF(-10).legendre_Q(5, 325/100)
- [-83825154.36008 +/- 4.94e-6] + [-34721515.80396 +/- 5.40e-6]*I
+ [-83825154.36008 +/- 5.02e-6] + [-34721515.80396 +/- 5.42e-6]*I
sage: CBF(-10).legendre_Q(5, 325/100, type=3)
[-4.797306921692e-6 +/- 6.82e-19] + [-4.797306921692e-6 +/- 6.57e-19]*I
diff --git a/src/sage/rings/polynomial/polynomial_complex_arb.pyx b/src/sage/rings/polynomial/polynomial_complex_arb.pyx
index c436d4705b..ef611a566b 100644
--- a/src/sage/rings/polynomial/polynomial_complex_arb.pyx
+++ b/src/sage/rings/polynomial/polynomial_complex_arb.pyx
@@ -543,7 +543,7 @@ cdef class Polynomial_complex_arb(Polynomial):
sage: (1 - x/3).inverse_series_trunc(3)
([0.1111111111111111 +/- 5.99e-17])*x^2 + ([0.3333333333333333 +/- 7.04e-17])*x + 1.000000000000000
sage: x.inverse_series_trunc(1)
- [+/- inf]
+ nan
sage: Pol(0).inverse_series_trunc(2)
(nan + nan*I)*x + nan + nan*I
@@ -671,7 +671,7 @@ cdef class Polynomial_complex_arb(Polynomial):
sage: pol._sqrt_series(2)
([+/- 7.51e-3] + [+/- 0.501]*I)*x + [+/- 5.01e-3] + [+/- 1.01]*I
sage: x._sqrt_series(2)
- ([+/- inf] + [+/- inf]*I)*x
+ (nan + nan*I)*x
"""
cdef Polynomial_complex_arb res = self._new()
if n < 0:
diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx
index c9f68e38d7..76e3037a9a 100644
--- a/src/sage/rings/real_arb.pyx
+++ b/src/sage/rings/real_arb.pyx
@@ -161,7 +161,7 @@ values and should be preferred::
sage: RBF(NaN) < RBF(infinity)
False
- sage: 1/RBF(0) <= RBF(infinity)
+ sage: RBF(0).add_error(infinity) <= RBF(infinity)
True
TESTS::
@@ -252,6 +252,8 @@ cdef void mpfi_to_arb(arb_t target, const mpfi_t source, const long precision):
(+infinity, +infinity)
sage: RBF(RIF(-infinity)).endpoints()
(-infinity, -infinity)
+ sage: RBF(RIF(-infinity, infinity)).endpoints()
+ (-infinity, +infinity)
sage: RIF(RBF(infinity)).endpoints()
(+infinity, +infinity)
sage: RIF(RBF(-infinity)).endpoints()
@@ -266,10 +268,11 @@ cdef void mpfi_to_arb(arb_t target, const mpfi_t source, const long precision):
if _do_sig(precision): sig_on()
mpfi_get_left(left, source)
mpfi_get_right(right, source)
- arb_set_interval_mpfr(target, left, right, precision)
- # Work around weakness of arb_set_interval_mpfr(tgt, inf, inf)
- if mpfr_equal_p(left, right):
- mag_zero(arb_radref(target))
+ if mpfr_inf_p(left) and mpfr_inf_p(right) and mpfr_sgn(left) < 0 < mpfr_sgn(right):
+ # Work around a weakness of arb_set_interval_mpfr(tgt, -inf, inf)
+ arb_zero_pm_inf(target)
+ else:
+ arb_set_interval_mpfr(target, left, right, precision)
if _do_sig(precision): sig_off()
mpfr_clear(left)
@@ -649,17 +652,15 @@ class RealBallField(UniqueRepresentation, Field):
EXAMPLES::
sage: RBF.some_elements()
- [1.000000000000000,
- [0.3333333333333333 +/- 7.04e-17],
+ [0, 1.000000000000000, [0.3333333333333333 +/- 7.04e-17],
[-4.733045976388941e+363922934236666733021124 +/- 3.46e+363922934236666733021108],
- [+/- inf],
- [+/- inf],
- nan]
+ [+/- inf], [+/- inf], [+/- inf], nan]
"""
import sage.symbolic.constants
- return [self(1), self(1)/3,
+ inf = self(sage.rings.infinity.Infinity)
+ return [self(0), self(1), self(1)/3,
-self(2)**(Integer(2)**80),
- self(sage.rings.infinity.Infinity), ~self(0),
+ inf, -inf, self.zero().add_error(inf),
self.element_class(self, sage.symbolic.constants.NotANumber())]
def _sum_of_products(self, terms):
@@ -881,7 +882,7 @@ class RealBallField(UniqueRepresentation, Field):
sage: RBF.gamma(5)
24.00000000000000
sage: RBF.gamma(10**20)
- [+/- 5.92e+1956570551809674821757]
+ [+/- 5.50e+1956570552410610660600]
sage: RBF.gamma(1/3)
[2.678938534707747 +/- 8.99e-16]
sage: RBF.gamma(-5)
@@ -2247,7 +2248,7 @@ cdef class RealBall(RingElement):
sage: inf = RBF(+infinity)
sage: other_inf = RBF(+infinity, 42.r)
sage: neg_inf = RBF(-infinity)
- sage: extended_line = 1/RBF(0)
+ sage: extended_line = RBF(0).add_error(infinity)
sage: exact_nan = inf - inf
sage: exact_nan.mid(), exact_nan.rad()
(NaN, 0.00000000)
@@ -2659,7 +2660,7 @@ cdef class RealBall(RingElement):
sage: ~RBF(5)
[0.2000000000000000 +/- 4.45e-17]
sage: ~RBF(0)
- [+/- inf]
+ nan
sage: RBF(RIF(-0.1,0.1))
[+/- 0.101]
@@ -2739,7 +2740,7 @@ cdef class RealBall(RingElement):
sage: RBF(pi)/RBF(e)
[1.155727349790922 +/- 8.43e-16]
sage: RBF(2)/RBF(0)
- [+/- inf]
+ nan
"""
cdef RealBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -2765,7 +2766,7 @@ cdef class RealBall(RingElement):
sage: RBF(-1)^(1/3)
nan
sage: RBF(0)^(-1)
- [+/- inf]
+ nan
sage: RBF(-e)**RBF(pi)
nan
@@ -3129,7 +3130,7 @@ cdef class RealBall(RingElement):
sage: RBF(1).tan()
[1.557407724654902 +/- 3.26e-16]
sage: RBF(pi/2).tan()
- [+/- inf]
+ nan
"""
cdef RealBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -3146,7 +3147,7 @@ cdef class RealBall(RingElement):
sage: RBF(1).cot()
[0.642092615934331 +/- 4.79e-16]
sage: RBF(pi).cot()
- [+/- inf]
+ nan
"""
cdef RealBall res = self._new()
if _do_sig(prec(self)): sig_on()
@@ -3257,7 +3258,7 @@ cdef class RealBall(RingElement):
sage: RBF(1).coth()
[1.313035285499331 +/- 4.97e-16]
sage: RBF(0).coth()
- [+/- inf]
+ nan
"""
cdef RealBall res = self._new()
if _do_sig(prec(self)): sig_on()