Thursday, February 27, 2014

C++ Coding - Time to first exit

Question Calculate the expected time to first exit from the interval [0,1] for a Brownian motion X with the following SDE
where dW is a standard Wiener process and X(t=0)=0.56.

Thursday, March 7, 2013

Friday, February 22, 2013

C++ Coding - Euler's Method

Question

Consider an initial value ODE of the following form

dy-
dx = f (x,y),
x ∈ [a,b] and y (a ) = α
write a function to return the value of y at x=b given
            3x
f (x, y) = xe  −  2y,
a = 0,   b = 1, and α = 0

Thursday, February 7, 2013

C++ - Coding - Deterministic Coupon Bond Pricer

Question You must price a coupon bond with a principle of $100 maturing in 2 years time. Two coupons of $5 are paid at the end of year one and year two, and the continuous compound interest rate is a constant 10%. Extend your code to price a coupon bond with any specification.

C++ - Coding Black Scholes Formula

Question: Write a C++ code to calculate the option values for a call C(t = 0,S), and a put P(t = 0,S) using the Black-Scholes formula:
C(t = 0,S ) = SN (d1) − Xe −r(T−t)N (d2),
(2)

P (t = 0,S ) = Xe − r(T− t)N (− d2) − SN (− d1 )
(3)