Question
i need to find values of follwing functions which have two parameters in each F(x, , h) =( c(exp(x + h), ) c(exp(x h), )
i need to find values of follwing functions which have two parameters in each
F(x, , h) =( c(exp(x + h), ) c(exp(x h), ) )/2h
G(S, , k) =( c(S + k, ) c(S k, ) )/2k
below is the code in c++ and all necessary information
#include
using namespace std; double cum_norm(double x) { const double root = sqrt(0.5); return 0.5*(1.0 + erf(x*root)); } //Call option valuation function: int call_option(double S, double sigma, double & call, double & delta) { call = 0.0; delta = 0.0; if ((S < 0.0) || (sigma < 0.0)) return 1; // fail if (S == 0.0) { call = 0.0; delta = 0.0; return 0; // ok } if (sigma == 0.0) { if (S > 1.0) { call = S - 1.0; delta = 1.0; } else { call = 0.0; delta = 0.0; } return 0; // ok } double d1 = log(S)/sigma + 0.5*sigma; double d2 = d1 - sigma; double Nd1 = cum_norm(d1); double Nd2 = cum_norm(d2); call = S*Nd1 - Nd2; delta = Nd1; return 0; // ok }
int main() { double sigma=0.5, s=0.9,c,delta; call_option(s,sigma,c,delta); cout << "delta = " << delta< //////////////////////// 8 Finite difference: call option Delta Let us calculate the partial derivative c/S via a numerical finite difference. Let us set S = 0.9 and = 0.5 . Question: calculate the value of N(d1(S, )) for S = 0.9, = 0.5. You can use the function call option(S, sigma, call, delta). Save the output value of delta. Call the answer (0.9, 0.5). You should obtain (0.9, 0.5) ' 0.515666 . . . (you should save it to more decimal places). Many experts in financial option pricing theory define S = e x or x = ln(S) and use x instead of S in calculations. Hence let us define f(x) = c(S). If we look at eq. (5.4.1), we see that we can also write the derivatives as dc dS = 1 e x df dx = 1 S df dx . (5.8.1) (Technically, we should use partial derivatives, but we shall keep the value of constant.) You can use the code given above to compute the value of c in this homework The fair value of the call option c is obtained by calling call option(...). The output field call gives the value of c. Let us compute the value of dc/dS numerically. We do it in two ways, using x and S. We use a stepsize h for x and k for S. Then (you have to make four function calls to call option(...)) F(x, , h) = c(exp(x + h), ) c(exp(x h), ) 2h G(S, , k) = c(S + k, ) c(S k, ) 2k Question: fill in the following table of values. Note that x = ln(0.9) ' 0.105360516. For brevity write A = (1/0.9)F(ln(0.9), 0.5, h) and B = G(0.9, 0.5, k).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started