naginterfaces.library.pde.dim1_​blackscholes_​means

naginterfaces.library.pde.dim1_blackscholes_means(t0, tmat, td, phid)[source]

dim1_blackscholes_means computes average values of a continuous function of time over the remaining life of an option. It is used together with dim1_blackscholes_closed() to value options with time-dependent arguments.

For full information please refer to the NAG Library document for d03ne

https://support.nag.com/numeric/nl/nagdoc_30/flhtml/d03/d03nef.html

Parameters
t0float

The current time .

tmatfloat

The maturity time .

tdfloat, array-like, shape

The discrete times at which is specified.

phidfloat, array-like, shape

must contain the value of at time , for .

Returns
phiavfloat, ndarray, shape

contains the value of interpolated to , contains the first-order average and contains the second-order average , where:

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

Unexpected failure in internal call to spline function.

Notes

dim1_blackscholes_means computes the quantities

from a given set of values of a continuous time-dependent function at a set of discrete points , 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 dim1_blackscholes_closed() 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 Use with dim1_blackscholes_closed).