
    Ui                     V    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	dS )	    )array_namespace	np_compat)cached_property)roots_legendre   )	FixedRulec                   0    e Zd ZdZddZed             ZdS )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          |                    d                    | _        d S )N   z5At least 2 nodes required for Gauss-Legendre cubaturer   )
ValueErrornpointsr   r   emptyxp)selfr   r   s      ~/var/www/development/aibuddy-work/election-extract/venv/lib/python3.11/site-packages/scipy/integrate/_rules/_gauss_legendre.py__init__z GaussLegendreQuadrature.__init__)   sP    Q;;G   :B!"((1++..    c                     t          | 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   sU     (55w GOOEO99GOOG47?O;;
 	
r   )N)__name__
__module____qualname____doc__r   r   r    r   r   r
   r
   
   sM         </ / / / 
 
 _
 
 
r   r
   N)
scipy._lib._array_apir   r   	functoolsr   scipy.specialr   _baser   r
   r    r   r   <module>r%      s    < < < < < < < < % % % % % % ( ( ( ( ( (      4
 4
 4
 4
 4
i 4
 4
 4
 4
 4
r   