Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please solve #3 if Numerical Methods for Differential Equations in Finance (MTH 4115) Project 1: Nonlinear Solvers and Implied Volatility 1. We solve a nonlinear
Please solve #3
if
Numerical Methods for Differential Equations in Finance (MTH 4115) Project 1: Nonlinear Solvers and Implied Volatility 1. We solve a nonlinear equation f(x) = 0. Write a MATLAB function for secant method. function y = secant(x0,x1,f, tol,maxn) x0,x1 are two initial guesses. f is the function handle. For example, f=Q(x) x*x+x+1. tol is the tolerance regarding the stopping criteria. Use the absolute error. maxn is the maximum number of iterations allowed for the algorithm. To test your program, call the function with the following inputs: f(x) = = 23 + r -1, Po = 0, After 8 iterations, xg shall be obtained as 0.68232780382802. X1 = 1. 2. The Black-Scholes formulas consist of C = Se-9f N(d) Ke="tN(da), P = Ke="tN(-d2) Se-9t N(-d), where In(S/K) +t(r q+02/2) di = d2 = d -ovt. ovt In the above, o is the implied volatility and N(2) is the cdf of a standard normal random variable. Write a MATLAB function to compute the Black-Scholes formulas. function V = BS_Formula(id, K, t, S, sigma, q, r) To calculate N(L) in the formula, use the intrinsic MATLAB function cdf. If id==1, the function is for a call option. Otherwise it is for a put option. We use the following parameters to test: K = 100, S= 100, r=0.03, t=0.25, O=0.2, q=0.02, which shall yield following approximations C~4.0884, P3.8399. 3. In Problem 2, we can compute an option price, V, given an implied volatility, o. In this problem, we compute o given V. Write a MATLAB function to compute the implied volatility of an option under the Black-Scholes model using the secant method. function sigma = volatility_european_formula(id, V, K, t, s, q, r, so, s1, tol, maxn) V is the option price, and so and s1 are two initial values. Command Window 4.088377014143525Step 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