The one-day loss of a trading book is normally distributed with mean mu and standard deviation sigma (positive values are losses). The regulator fixes an exceedance probability of 10^-k: the confidence level is alpha = 1 - 10^-k.
The Value at Risk VaR is the alpha-quantile of the loss. The Expected Shortfall ES is the expected loss conditional on the loss being at least VaR. Compute both.
Three numbers mu, sigma and k: the first two are reals with at most 6 digits after the decimal point, k is an integer.
Two real numbers: VaR and ES, each with relative error at most 1e-9.
0 <= mu <= 10^6
0.01 <= sigma <= 10^6
2 <= k <= 5000
This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.
Numeric answers are accepted if they are within a relative tolerance of 1e-09 of the expected value.
0 1 2
2.326347874040841 2.665214220345805
120.5 35.25 4
251.59533111231275 260.03640828287706