Пример #1
0
    def orthonormal_polynomials(self, *max_degree):
        '''
        Return the max_degree-1 first orthonormal polynomials associated with
        the LebesgueMeasure on [a,b].

        Parameters
        ----------
        max_degree : int, optional
            The maximum degree of the returned polynomials. The default is
            None, choosing the default maximum degree associated with the
            constructor of the polynomials.

        Returns
        -------
        poly : tensap.OrthonormalPolynomials
            The generated orthonormal polynomials.

        '''
        poly = tensap.LegendrePolynomials(*max_degree)
        poly._orthogonal_polynomials_norms = poly._orthogonal_polynomials_norms * np.sqrt(
            self.mass())

        if self != LebesgueMeasure(-1, 1):
            poly = tensap.ShiftedOrthonormalPolynomials(
                poly, (self.a + self.b) / 2, (self.b - self.a) / 2)
        return poly
Пример #2
0
    def orthonormal_polynomials(self, *max_degree):
        '''
        Return the max_degree-1 first orthonormal polynomials associated with
        the UniformRandomVariable.

        Parameters
        ----------
        max_degree : int, optional
            The maximum degree of the returned polynomials. The default is
            None, choosing the default maximum degree associated with the
            constructor of the polynomials.

        Returns
        -------
        poly : tensap.OrthonormalPolynomials
            The generated orthonormal polynomials.

        '''
        poly = tensap.LegendrePolynomials(*max_degree)
        if self != UniformRandomVariable(-1, 1):
            # print('ShiftedOrthonormalPolynomials are created.')
            poly = tensap.ShiftedOrthonormalPolynomials(poly,
                                                        (self.inf+self.sup)/2,
                                                        (self.sup-self.inf)/2)
        return poly
Пример #3
0
 def orthonormal_polynomials(self, *args):
     p = tensap.EmpiricalPolynomials(self, *args)
     m = np.mean(self.sample)
     s = np.std(self.sample)
     if np.abs(m) > np.finfo(float).eps or \
             np.abs(s-1) > np.finfo(float).eps:
         p = tensap.ShiftedOrthonormalPolynomials(p, m, s)
     return p
Пример #4
0
    def orthonormal_polynomials(self, *max_degree):
        '''
        Return the max_degree-1 first orthonormal polynomials associated with
        the NormalRandomVariable.

        Parameters
        ----------
        max_degree : int, optional
            The maximum degree of the returned polynomials. The default is
            None, choosing the default maximum degree associated with the
            constructor of the polynomials.

        Returns
        -------
        poly : tensap.OrthonormalPolynomials
            The generated orthonormal polynomials.

        '''
        poly = tensap.HermitePolynomials(*max_degree)
        if self != NormalRandomVariable(0, 1):
            # print('ShiftedOrthonormalPolynomials are created.')
            poly = tensap.ShiftedOrthonormalPolynomials(poly, self.mu,
                                                        self.sigma)
        return poly