Skip to content

Commit 8c472bd

Browse files
authored
Romberg is deprecated... (#1131)
and will be removed by SciPyi 1.15
1 parent 712337b commit 8c472bd

4 files changed

Lines changed: 6 additions & 17 deletions

File tree

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ API incompatibility
3333
-------------------
3434

3535
* ``Matcher`` now requires an additional ``evaluation`` parameter
36+
* ``Romberg`` removed as an ``NIntegrate[]`` method. It is depcrecated in SciPy and is to be removed by SciPy 1.15.
3637

3738

3839
Bugs

mathics/builtin/scipy_utils/integrators.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
if not check_requires_list(["scipy", "numpy"]):
66
raise ImportError
77

8-
import numpy as np
9-
108

119
def _scipy_interface(integrator, options_map, mandatory=None, adapt_func=None):
1210
"""
@@ -24,7 +22,8 @@ def _scipy_proxy_func_filter(fun, a, b, **opts):
2422
if native_opt[1]:
2523
val = native_opt[1](val)
2624
native_opts[native_opt[0]] = val
27-
return adapt_func(integrator(fun, a, b, **native_opts))
25+
if adapt_func is not None:
26+
return adapt_func(integrator(fun, a, b, **native_opts))
2827

2928
def _scipy_proxy_func(fun, a, b, **opts):
3029
native_opts = {}
@@ -42,7 +41,7 @@ def _scipy_proxy_func(fun, a, b, **opts):
4241

4342

4443
try:
45-
from scipy.integrate import nquad, quad, romberg
44+
from scipy.integrate import nquad, quad
4645
except Exception:
4746
scipy_nintegrate_methods = {}
4847
else:
@@ -69,17 +68,6 @@ def _scipy_proxy_func(fun, a, b, **opts):
6968
False,
7069
)
7170
),
72-
"Romberg": tuple(
73-
(
74-
_scipy_interface(
75-
romberg,
76-
{"tol": ("tol", None), "maxrec": ("divmax", None)},
77-
None,
78-
lambda x: (x, np.nan),
79-
),
80-
False,
81-
)
82-
),
8371
}
8472

8573
scipy_nintegrate_methods["Automatic"] = scipy_nintegrate_methods["Quadrature"]

test/builtin/numbers/test_nintegrate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from mathics.core.builtin import check_requires_list
1414

1515
if check_requires_list(["scipy", "scipy.integrate"]):
16-
methods = ["Automatic", "Romberg", "Internal", "NQuadrature"]
16+
methods = ["Automatic", "Internal", "NQuadrature"]
1717

1818
generic_tests_for_nintegrate = [
1919
(r"NIntegrate[x^2, {x,0,1}, {method} ]", r"1/3.", ""),
@@ -46,7 +46,7 @@
4646
"1.",
4747
None,
4848
[
49-
r"The Method option should be a built-in method name in {`Automatic`, `Internal`, `Simpson`, `NQuadrature`, `Quadrature`, `Romberg`}. Using `Automatic`"
49+
r"The Method option should be a built-in method name in {`Automatic`, `Internal`, `Simpson`, `NQuadrature`, `Quadrature`}. Using `Automatic`"
5050
],
5151
),
5252
],

test/core/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)