
    
g                     N    d dl mZmZ d dlmZ d dlmZ ddlmZ  G d de      Z	y)	    )array_namespace	np_compat)cached_property)roots_legendre   )	FixedRulec                   (    e Zd ZdZddZed        Zy)GaussLegendreQuadratureaw  
    Gauss-Legendre quadrature.

    Parameters
    ----------
    npoints : int
        Number of nodes for the higher-order rule.

    xp : array_namespace, optional
        The namespace for the node and weight arrays. Default is None, where NumPy is
        used.

    Examples
    --------
    Evaluate a 1D integral. Note in this example that ``f`` returns an array, so the
    estimates will also be arrays.

    >>> import numpy as np
    >>> from scipy.integrate import cubature
    >>> from scipy.integrate._rules import GaussLegendreQuadrature
    >>> def f(x):
    ...     return np.cos(x)
    >>> rule = GaussLegendreQuadrature(21) # Use 21-point GaussLegendre
    >>> a, b = np.array([0]), np.array([1])
    >>> rule.estimate(f, a, b) # True value sin(1), approximately 0.84147
     array([0.84147098])
    >>> rule.estimate_error(f, a, b)
     array([1.11022302e-16])
    Nc                     |dk  rt        d      || _        |t        }t        |j	                  d            | _        y )N   z5At least 2 nodes required for Gauss-Legendre cubaturer   )
ValueErrornpointsr   r   emptyxp)selfr   r   s      c/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/scipy/integrate/_rules/_gauss_legendre.py__init__z GaussLegendreQuadrature.__init__)   s@    Q;G  :B!"((1+.    c                     t        | j                        \  }}| j                  j                  || j                  j                        | j                  j                  || j                  j                        fS )N)dtype)r   r   r   asarrayfloat64)r   nodesweightss      r   nodes_and_weightsz)GaussLegendreQuadrature.nodes_and_weights6   sZ     (5w GGOOEO9GGOOG477??O;
 	
r   )N)__name__
__module____qualname____doc__r   r   r    r   r   r
   r
   
   s     </ 
 
r   r
   N)
scipy._lib._array_apir   r   	functoolsr   scipy.specialr   _baser   r
   r    r   r   <module>r%      s    < % ( 4
i 4
r   