Repository: sympy/sympy

Issue:
Bug on lambdify(): unable to plot Si(x)
Code:
```python
from sympy import *
import numpy as np
import matplotlib.pyplot as pyplot

x = symbols('x')
y = sin(x) / x

Y = integrate(y, x)
Y_func = lambdify(x, Y)

x_dots = np.linspace(0, 10, 100)
Y_dots = Y_func(x_dots)
pyplot.plot(x_dots, Y_dots)
pyplot.show()
```

Also not able to calculate a single value from the lambdified function:
```python
Y_func(1)
```


Issue: both local and live.sympy.org will give this error:
```python
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In [54], line 12
      9 Y_func = lambdify(x, Y)
     11 x_dots = np.linspace(0, 10, 100)
---> 12 Y_dots = Y_func(x_dots)
     13 pyplot.plot(x_dots, Y_dots)
     14 pyplot.show()

File <lambdifygenerated-30>:2, in _lambdifygenerated(x)
      1 def _lambdifygenerated(x):
----> 2     return Si(x)

NameError: name 'Si' is not defined
```

Discussion:

Patch:
diff --git a/.mailmap b/.mailmap
index b700d47b4d..1a91f723a8 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1201,6 +1201,7 @@ Satya Prakash Dwibedi <akash581050@gmail.com>
 Saurabh Agarwal <shourabh.agarwal@gmail.com>
 Saurabh Jha <saurabh.jhaa@gmail.com>
 Sayan Goswami <Sayan98@users.noreply.github.com>
+Sayan Mitra <ee18b156@smail.iitm.ac.in>
 Sayandip Halder <sayandiph4@gmail.com> Sayandip <sayandiph4@gmail.com>
 Sean Ge <seange727@gmail.com>
 Sean P. Cornelius <spcornelius@gmail.com>
diff --git a/sympy/printing/numpy.py b/sympy/printing/numpy.py
index 2489854329..710c32c937 100644
--- a/sympy/printing/numpy.py
+++ b/sympy/printing/numpy.py
@@ -427,6 +427,15 @@ def _print_Integral(self, e):
                 self._print(e.args[0]),
                 limit_str)
 
+    def _print_Si(self, expr):
+        return "{}({})[0]".format(
+                self._module_format("scipy.special.sici"),
+                self._print(expr.args[0]))
+
+    def _print_Ci(self, expr):
+        return "{}({})[1]".format(
+                self._module_format("scipy.special.sici"),
+                self._print(expr.args[0]))
 
 for func in _scipy_known_functions:
     setattr(SciPyPrinter, f'_print_{func}', _print_known_func)
diff --git a/sympy/utilities/lambdify.py b/sympy/utilities/lambdify.py
index 677c55ad73..3020052f6d 100644
--- a/sympy/utilities/lambdify.py
+++ b/sympy/utilities/lambdify.py
@@ -173,7 +173,6 @@ def _import(module, reload=False):
     if 'Abs' not in namespace:
         namespace['Abs'] = abs
 
-
 # Used for dynamically generated filenames that are inserted into the
 # linecache.
 _lambdify_generated_counter = 1


Test patch:
diff --git a/sympy/printing/tests/test_numpy.py b/sympy/printing/tests/test_numpy.py
index 08c6d81fea..ae2a866765 100644
--- a/sympy/printing/tests/test_numpy.py
+++ b/sympy/printing/tests/test_numpy.py
@@ -5,6 +5,7 @@
 from sympy.functions.elementary.miscellaneous import sqrt
 from sympy.functions.elementary.piecewise import Piecewise
 from sympy.functions.special.gamma_functions import polygamma
+from sympy.functions.special.error_functions import (Si, Ci)
 from sympy.matrices.expressions.blockmatrix import BlockMatrix
 from sympy.matrices.expressions.matexpr import MatrixSymbol
 from sympy.matrices.expressions.special import Identity
@@ -346,3 +347,5 @@ def test_scipy_print_methods():
     k = Symbol('k', integer=True, nonnegative=True)
     x = Symbol('x', real=True)
     assert prntr.doprint(polygamma(k, x)) == "scipy.special.polygamma(k, x)"
+    assert prntr.doprint(Si(x)) == "scipy.special.sici(x)[0]"
+    assert prntr.doprint(Ci(x)) == "scipy.special.sici(x)[1]"
diff --git a/sympy/utilities/tests/test_lambdify.py b/sympy/utilities/tests/test_lambdify.py
index 624033b6d7..bf5772f88c 100644
--- a/sympy/utilities/tests/test_lambdify.py
+++ b/sympy/utilities/tests/test_lambdify.py
@@ -23,7 +23,7 @@
 from sympy.functions.special.bessel import (besseli, besselj, besselk, bessely)
 from sympy.functions.special.beta_functions import (beta, betainc, betainc_regularized)
 from sympy.functions.special.delta_functions import (Heaviside)
-from sympy.functions.special.error_functions import (Ei, erf, erfc, fresnelc, fresnels)
+from sympy.functions.special.error_functions import (Ei, erf, erfc, fresnelc, fresnels, Si, Ci)
 from sympy.functions.special.gamma_functions import (digamma, gamma, loggamma, polygamma)
 from sympy.integrals.integrals import Integral
 from sympy.logic.boolalg import (And, false, ITE, Not, Or, true)
@@ -1094,10 +1094,10 @@ def test_scipy_fns():
     if not scipy:
         skip("scipy not installed")
 
-    single_arg_sympy_fns = [Ei, erf, erfc, factorial, gamma, loggamma, digamma]
+    single_arg_sympy_fns = [Ei, erf, erfc, factorial, gamma, loggamma, digamma, Si, Ci]
     single_arg_scipy_fns = [scipy.special.expi, scipy.special.erf, scipy.special.erfc,
         scipy.special.factorial, scipy.special.gamma, scipy.special.gammaln,
-                            scipy.special.psi]
+                            scipy.special.psi, scipy.special.sici, scipy.special.sici]
     numpy.random.seed(0)
     for (sympy_fn, scipy_fn) in zip(single_arg_sympy_fns, single_arg_scipy_fns):
         f = lambdify(x, sympy_fn(x), modules="scipy")
@@ -1117,8 +1117,15 @@ def test_scipy_fns():
             if sympy_fn == digamma:
                 tv = numpy.real(tv)
             sympy_result = sympy_fn(tv).evalf()
+            scipy_result = scipy_fn(tv)
+            # SciPy's sici returns a tuple with both Si and Ci present in it
+            # which needs to be unpacked
+            if sympy_fn == Si:
+                scipy_result = scipy_fn(tv)[0]
+            if sympy_fn == Ci:
+                scipy_result = scipy_fn(tv)[1]
             assert abs(f(tv) - sympy_result) < 1e-13*(1 + abs(sympy_result))
-            assert abs(f(tv) - scipy_fn(tv)) < 1e-13*(1 + abs(sympy_result))
+            assert abs(f(tv) - scipy_result) < 1e-13*(1 + abs(sympy_result))
 
     double_arg_sympy_fns = [RisingFactorial, besselj, bessely, besseli,
                             besselk, polygamma]