code: def interpolating_spline(d, x, X, Y):
      """
      Return spline of degree *d*, passing through the given *X*
      and *Y* values.
  
      Explanation
      ===========
  
      This function returns a piecewise function such that each part is
      a polynomial of degree not greater than *d*. The value of *d*
      must be 1 or greater and the values of *X* must be strictly
      increasing.
  
      Examples
      ========
  
      >>> from sympy import interpolating_spline
      >>> from sympy.abc import x
      >>> interpolating_spline(1, x, [1, 2, 4, 7], [3, 6, 5, 7])
      Piecewise((3*x, (x >= 1) & (x <= 2)),
              (7 - x/2, (x >= 2) & (x <= 4)),
              (2*x/3 + 7/3, (x >= 4) & (x <= 7)))
      >>> interpolating_spline(3, x, [-2, 0, 1, 3, 4], [4, 2, 1, 1, 3])
      Piecewise((7*x**3/117 + 7*x**2/117 - 131*x/117 + 2, (x >= -2) & (x <= 1)),
              (10*x**3/117 - 2*x**2/117 - 122*x/117 + 77/39, (x >= 1) & (x <= 4)))
  
      Parameters
      ==========
  
      d : integer
          Degree of Bspline strictly greater than equal to one
  
      x : symbol
  
      X : list of strictly increasing real values
          list of X coordinates through which the spline passes
  
      Y : list of real values
          list of corresponding Y coordinates through which the spline passes
  
      See Also
      ========
  
      bspline_basis_set, interpolating_poly
  
      """
      from sympy.solvers.solveset import linsolve
      from sympy.matrices.dense import Matrix
  
      # Input sanitization
      d = sympify(d)
      if not (d.is_Integer and d.is_positive):
          raise ValueError(
              "Spline degree must be a positive integer, not %s." % d
          )
      if len(X) != len(Y):
          raise ValueError(
              "Number of X and Y coordinates must be the same."
          )
      if len(X) < d + 1:
          raise ValueError(
              "Degree must be less than the number of control points."
          )
      if not all(a < b for a, b in zip(X, X[1:])):
          raise ValueError(
              "The x-coordinates must be strictly increasing."
          )
      X = [sympify(i) for i in X]
  
      # Evaluating knots value
      if d.is_odd:
          j = (d + 1) // 2
          interior_knots = X[j:-j]
      else:
          j = d // 2
          interior_knots = [
              (a + b) / 2 for a, b in zip(X[j : -j - 1], X[j + 1 : -j])
          ]
  
      knots = (
          [X[0]] * (d + 1) + list(interior_knots) + [X[-1]] * (d + 1)
      )
  
      basis = bspline_basis_set(d, knots, x)
  
      A = [[b.subs(x, v) for b in basis] for v in X]
  
      coeff = linsolve(
          (Matrix(A), Matrix(Y)),
          symbols("c0:{}".format(len(X)), cls=Dummy),
      )
      coeff = list(coeff)[0]
      intervals = {c for b in basis for (e, c) in b.args if c != True}
  
      # Sorting the intervals
      #  ival contains the end-points of each interval
      ival = [_ivl(c, x) for c in intervals]
      com = zip(ival, intervals)
      com = sorted(com, key=lambda x: x[0])
      intervals = [y for x, y in com]
  
      basis_dicts = [{c: e for (e, c) in b.args} for b in basis]
      spline = []
      for i in intervals:
          piece = sum(
              [
                  c * d.get(i, S.Zero)
                  for (c, d) in zip(coeff, basis_dicts)
              ],
              S.Zero,
          )
          spline.append((piece, i))
      return Piecewise(*spline)
  
file_path: sympy/sympy/functions/special/bsplines.py
imports: from sympy.core import S, sympify
  from sympy.core.symbol import Dummy, symbols
  from sympy.functions import Piecewise, piecewise_fold
  from sympy.logic.boolalg import And
  from sympy.sets.sets import Interval
  from functools import lru_cache
label_desc: Use image node_id 5 for calling a global function with example usage: interpolating_spline(d, x, X, Y) and returns: Piecewise