def expect(self, func=None, args=(), loc=<NUM_LIT:0>, scale=<NUM_LIT:1>, lb=None, ub=None,<EOL>conditional=False, **kwds):
lockwds = {'<STR_LIT>': loc,<EOL>'<STR_LIT>': scale}<EOL>self._argcheck(*args)<EOL>if func is None:<EOL><INDENT>def fun(x, *args):<EOL><INDENT>return x * self.pdf(x, *args, **lockwds)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>def fun(x, *args):<EOL><INDENT>return func(x) * self.pdf(x, *args, **lockwds)<EOL><DEDENT><DEDENT>if lb is None:<EOL><INDENT>lb = loc + self.a * scale<EOL><DEDENT>if ub is None:<EOL><INDENT>ub = loc + self.b * scale<EOL><DEDENT>if conditional:<EOL><INDENT>invfac = (self.sf(lb, *args, **lockwds)<EOL>- self.sf(ub, *args, **lockwds))<EOL><DEDENT>else:<EOL><INDENT>invfac = <NUM_LIT:1.0><EOL><DEDENT>kwds['<STR_LIT:args>'] = args<EOL>olderr = np.seterr(all='<STR_LIT:ignore>')<EOL>vals = integrate.quad(fun, lb, ub, **kwds)[<NUM_LIT:0>] / invfac<EOL>np.seterr(**olderr)<EOL>return vals<EOL>
Calculate expected value of a function with respect to the
        distribution.

        The expected value of a function ``f(x)`` with respect to a
        distribution ``dist`` is defined as::

                    ubound
            E[x] = Integral(f(x) * dist.pdf(x))
                    lbound

        Parameters
        ----------
        func : callable, optional
            Function for which integral is calculated. Takes only one argument.
            The default is the identity mapping f(x) = x.
        args : tuple, optional
            Argument (parameters) of the distribution.
        lb, ub : scalar, optional
            Lower and upper bound for integration. default is set to the
            support of the distribution.
        conditional : bool, optional
            If True, the integral is corrected by the conditional probability
            of the integration interval.  The return value is the expectation
            of the function, conditional on being in the given interval.
            Default is False.

        Additional keyword arguments are passed to the integration routine.

        Returns
        -------
        expect : float
            The calculated expected value.

        Notes
        -----
        The integration behavior of this function is inherited from
        `integrate.quad`.