nag_pde_bs_1d_means (d03nec) computes average values of a continuous function of time over the remaining life of an option. It is used together with nag_pde_bs_1d_analytic (d03ndc) to value options with time-dependent arguments.
nag_pde_bs_1d_means (d03nec) computes the quantities
from a given set of values phid of a continuous time-dependent function at a set of discrete points td, where is the current time and is the maturity time. Thus and are first and second order averages of over the remaining life of an option.
The function may be used in conjunction with nag_pde_bs_1d_analytic (d03ndc) in order to value an option in the case where the risk-free interest rate , the continuous dividend , or the stock volatility is time-dependent and is described by values at a set of discrete times (see Section 8.2). This is illustrated in Section 9.
t0 – doubleInput
On entry: the current time .
tmat – doubleInput
On entry: the maturity time .
ntd – IntegerInput
the number of discrete times at which is given.
Suppose you wish to evaluate the analytic solution of the Black–Scholes equation in the case when the risk-free interest rate is a known function of time, and is represented as a set of values at discrete times. A call to nag_pde_bs_1d_means (d03nec) providing these values in phid produces an output array phiav suitable for use as the argument r in a subsequent call to nag_pde_bs_1d_analytic (d03ndc).
Time-dependent values of the continuous dividend and the volatility may be handled in the same way.
8.3 Algorithmic Details
The ntd data points are fitted with a cubic B-spline using the function nag_1d_spline_interpolant (e01bac). Evaluation is then performed using nag_1d_spline_evaluate (e02bbc), and the definite integrals are computed using direct integration of the cubic splines in each interval. The special case of is handled by interpolating at that point.
This example demonstrates the use of the function in conjunction with nag_pde_bs_1d_analytic (d03ndc) to solve the Black–Scholes equation for valuation of a -month American call option on a non-dividend-paying stock with an exercise price of $50. The risk-free interest rate varies linearly with time and the stock volatility has a quadratic variation. Since these functions are integrated exactly by nag_pde_bs_1d_means (d03nec) the solution of the Black–Scholes equation by nag_pde_bs_1d_analytic (d03ndc) is also exact.
The option is valued at a range of times and stock prices.