expectation function