Quant Memo
Coding/●●●●●

Monte Carlo integration of a smooth function

Estimate 01exdx\int_0^1 e^x\,dx (whose true value is e11.71828e - 1 \approx 1.71828) by simulation. Sample U1,,UnU_1, \dots, U_n uniformly on [0,1][0,1] and average the function values, since 01exdx=E[eU]\int_0^1 e^x\,dx = E[e^U] for UU(0,1)U \sim U(0,1).

Write the estimator, then say how many samples you need for roughly 3 correct decimals.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions