def covariance(X, Y, condition=None, **kwargs):
 return expectation(((X - expectation(X, condition, **kwargs)) * (Y - expectation(Y, condition, **kwargs))), condition, **kwargs)

def covariance ( X , Y , condition = None , ** kwargs ) : return expectation ( ( ( X - expectation ( X , condition , ** kwargs ) ) * ( Y - expectation ( Y , condition , ** kwargs ) ) ) , condition , ** kwargs )
covariance of two random expressions the expectation that the two variables will rise and fall together covariance = e( (x-e(x)) * (y-e(y)) ) examples .