程序代写代做代考 matlab Solutions to exercises for Lecture 11

Solutions to exercises for Lecture 11
March 24, 2015
Exercise 1
The question is answered by the functions testComputeExpectedUtility and computeExpectedUtility. An accurate computation can be done using Mat- lab’s integrate function. Remember that we’re only demonstrating in this ques- tion how Monte Carlo can be improved in principle using the toy example of a 1-d problem. Of course, you wouldn’t use Monte Carlo in practice for a 1-d problem you would use integrate.
The testComputeExpectedUtility function checks the answers computed by computeExpectedUtility against the analytical formula for the case when all investment is in stock (this is a very easy calculation) and against the nu- merical solution computed by computeExpectedUtilityByIntegration.
We then produce various plots of the convergence. The conclusions are that:
• Sobol sequences and halton sequences give the same answer in this (1-d) case.
• Antithetic sampling and the control variate method are both similarly beneficial. Combining the two does not improve things, however.
• Sobol sequences and Halton sequences initially perform worse than the control variate and antithetic sampling methods. In the long run, however, they have a superior rate of convergence and so they outperform the pure Monte Carlo methods in the end. This
• The rectangle rule is, as we expect, the clear winner in 1-d. Of course it is easily outperformed by better integration rules.
Exercise 2
The argument that suggests antithetic sampling will give better estimates as- sumes that the expectation associated with a random sample X is negatively correlated with the expectation associated with a random sample -X.
If the expectation is an expected final option payoff and the random sample is a sample of stock prices this often be a reasonable assumption because the payoff is extremely asymmetrical.
1

However, it won’t always be true. For example for symmetrical trading strategies like straddles we might expect the payoff for sample X to be strongly positively correlated with sample -X. In this case antithetic sampling will be much worse.
The exercise illustrates this point rather dramatically by considering com- puting the area of a circle using antithetic sampling. In this case because a circle is perfectly symmetrical, the area computed using a Monte Carlo sample X will be perfectly correlated with the area computed using Monte Carlo sam- ple Y. In this situation antithetic sampling is worse than useless as tested by ”testComputeCircleAreaAntithetic”.
That antithetic sampling won’t work in this case should be quite obvious. The antithetic sample -X provides no information about the area of a circle that wasn’t already provided by using sample X.
Exercise 3
By Taylor’s theorem, for sufficiently smooth functions f we have: ′ ε2′′
f(x+ε)=f(x)+εf (x)+ 2f (ξ)
with ξ ∈ [0, ε]. Thus we’re in the situation where Richardson extrapolation
applies. Define
so
hence
rerranging we get
y(ε)= f(x+ε)−f(x) =f′(x)+ ε +o(ε2) ε2
ε 2f(x+ ε)−2f(x) ε
y( )= 2 =f′(x)+ +o(ε2)
2ε4 y(ε) − 2y( ε ) = −f′(x) + o(ε2)
2
f′(x) = 2y( ε ) − y(ε) + o(ε2) 2
we now use our definition of y to compute:
−f(x+ε)+4 f(x+ ε)−3f(x)
f′(x) =
See differentiateRichardsonPlot for the MATLAB implementation.
2
ε
2 + o(ε2)