code: def gauss_legendre(n, n_digits):
      r"""
      Computes the Gauss-Legendre quadrature [1]_ points and weights.
  
      Explanation
      ===========
  
      The Gauss-Legendre quadrature approximates the integral:
  
      .. math::
          \int_{-1}^1 f(x)\,dx \approx \sum_{i=1}^n w_i f(x_i)
  
      The nodes `x_i` of an order `n` quadrature rule are the roots of `P_n`
      and the weights `w_i` are given by:
  
      .. math::
          w_i = \frac{2}{\left(1-x_i^2\right) \left(P'_n(x_i)\right)^2}
  
      Parameters
      ==========
  
      n :
          The order of quadrature.
      n_digits :
          Number of significant digits of the points and weights to return.
  
      Returns
      =======
  
      (x, w) : the ``x`` and ``w`` are lists of points and weights as Floats.
               The points `x_i` and weights `w_i` are returned as ``(x, w)``
               tuple of lists.
  
      Examples
      ========
  
      >>> from sympy.integrals.quadrature import gauss_legendre
      >>> x, w = gauss_legendre(3, 5)
      >>> x
      [-0.7746, 0, 0.7746]
      >>> w
      [0.55556, 0.88889, 0.55556]
      >>> x, w = gauss_legendre(4, 5)
      >>> x
      [-0.86114, -0.33998, 0.33998, 0.86114]
      >>> w
      [0.34785, 0.65215, 0.65215, 0.34785]
  
      See Also
      ========
  
      gauss_laguerre, gauss_gen_laguerre, gauss_hermite, gauss_chebyshev_t, gauss_chebyshev_u, gauss_jacobi, gauss_lobatto
  
      References
      ==========
  
      .. [1] https://en.wikipedia.org/wiki/Gaussian_quadrature
      .. [2] https://people.sc.fsu.edu/~jburkardt/cpp_src/legendre_rule/legendre_rule.html
      """
      x = Dummy("x")
      p = legendre_poly(n, x, polys=True)
      pd = p.diff(x)
      xi = []
      w = []
      for r in p.real_roots():
          if isinstance(r, RootOf):
              r = r.eval_rational(S.One / 10 ** (n_digits + 2))
          xi.append(r.n(n_digits))
          w.append(
              (2 / ((1 - r**2) * pd.subs(x, r) ** 2)).n(n_digits)
          )
      return xi, w
  
file_path: sympy/sympy/integrals/quadrature.py
imports: from sympy.core import S, Dummy, pi
  from sympy.functions.combinatorial.factorials import factorial
  from sympy.functions.elementary.trigonometric import sin, cos
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.special.gamma_functions import gamma
  from sympy.polys.orthopolys import legendre_poly, laguerre_poly, hermite_poly, jacobi_poly
  from sympy.polys.rootoftools import RootOf
label_desc: Use image node_id 1 for calling a global function with example usage: gauss_legendre(n, n_digits) and returns: xi,  w