(self, expr, var, evaluate=True, **kwargs)
Expectation of expression over distribution
Expectation of expression over distribution
Expectation of expression over distribution
def expectation(self, expr, var, evaluate=True, **kwargs):
        """ Expectation of expression over distribution """
        # return summation(expr * self.pdf(var), (var, self.set), **kwargs)
        # TODO: support discrete sets with non integer stepsizes
        if evaluate:
            return summation(expr * self.pdf(var),
                         (var, self.set.inf, self.set.sup), **kwargs)
        else:
            return Sum(expr * self.pdf(var),
                         (var, self.set.inf, self.set.sup), **kwargs)
def expectation ( self , expr , var , evaluate = True , * * kwargs ) : # return summation(expr * self.pdf(var), (var, self.set), **kwargs) # TODO: support discrete sets with non integer stepsizes if evaluate : return summation ( expr * self . pdf ( var ) , ( var , self . set . inf , self . set . sup ) , * * kwargs ) else : return Sum ( expr * self . pdf ( var ) , ( var , self . set . inf , self . set . sup ) , * * kwargs )