PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: mpmath/mpmath (python)

Issue:
Negative integer order of the BesselI function
mpmath version: 1.3.0

I am using mpmath to generate values for verification of my own complex Bessel function calculation routine.
https://github.com/tk-yoshimura/ComplexBessel

I have discovered that mpmath cannot compute for large negative integers in Bessel I functions, even though it can use the inversion formula.
https://dlmf.nist.gov/10.27

Example:

```py
import mpmath as mpf

mpf.mp.dps = 64

x = 2

nus = [31, 32, 63, 64, 127, 128,
      -31, -31.25, -32, -32.25, 
      -63, -63.25, -64, -64.25, 
      -127, -127.25, -128, -128.25
]

for nu in nus:
    print(f"nu = {nu}, x = {x}")
    
    try:
        y = mpf.besseli(nu, x)
        print(f"{mpf.nstr(y, 40, strip_zeros=False, min_fixed=2, max_fixed=1)}")
    except ValueError as e:
        print(e)

    print("\n")
```

Error Message: 
```
nu = -127, x = 2

hypercomb() failed to converge to the requested 216 bits of accuracy
using a working precision of 4814 bits. The function value may be zero or
infinite; try passing zeroprec=N or infprec=M to bound finite values between
2^(-N) and 2^M. Otherwise try a higher maxprec or maxterms.
```

Pull request:
Use parity formula for besseli
See
https://functions.wolfram.com/Bessel-TypeFunctions/BesselI/04/02/01/0002/

Closes #877

Patch:
diff --git a/mpmath/functions/bessel.py b/mpmath/functions/bessel.py
index 4bda960..6b7dbb7 100644
--- a/mpmath/functions/bessel.py
+++ b/mpmath/functions/bessel.py
@@ -82,6 +82,8 @@ def h(n):
 def besseli(ctx, n, z, derivative=0, **kwargs):
     n = ctx.convert(n)
     z = ctx.convert(z)
+    if ctx.nint(n) and n < 0:
+        return ctx.besseli(-n, z, derivative, **kwargs)
     if not z:
         if derivative:
             raise ValueError


Test patch:
diff --git a/mpmath/tests/test_functions2.py b/mpmath/tests/test_functions2.py
index d971e24..c57ec95 100644
--- a/mpmath/tests/test_functions2.py
+++ b/mpmath/tests/test_functions2.py
@@ -91,6 +91,12 @@ def test_bessel():
         mp.dps = n
         assert besseli(91.5,24.7708).ae("4.00830632138673963619656140653537080438462342928377020695738635559218797348548092636896796324190271316137982810144874264e-41")
 
+def test_issue_877():
+    mp.dps = 64
+    r = besseli(-127, 2)
+    assert besseli(127, 2) == r
+    assert r.ae("3.345358761443415013354345973251886375421555647081543375756063117036e-214")
+
 def test_bessel_zeros():
     assert besseljzero(0,1).ae(2.40482555769577276869)
     assert besseljzero(2,1).ae(5.1356223018406825563)