library.specfun
Submodule¶
Module Summary¶
Interfaces for the NAG Mark 30.3 specfun Chapter.
specfun
- Approximations of Special Functions
This module is concerned with the provision of some commonly occurring physical and mathematical functions.
See Also¶
naginterfaces.library.examples.specfun
:This subpackage contains examples for the
specfun
module. See also the Examples subsection.
Functionality Index¶
Airy function
, real argument
scalar:
airy_bi_deriv()
vectorized:
airy_bi_deriv_vector()
, real argument
scalar:
airy_ai_deriv()
vectorized:
airy_ai_deriv_vector()
, real argument
scalar:
airy_ai_real()
vectorized:
airy_ai_real_vector()
or , complex argument, optionally scaled:
airy_ai_complex()
, real argument
scalar:
airy_bi_real()
vectorized:
airy_bi_real_vector()
or , complex argument, optionally scaled:
airy_bi_complex()
Arccos
inverse circular cosine:
arccos()
Arccosh
inverse hyperbolic cosine:
arccosh()
Arcsin
inverse circular sine:
arcsin()
Arcsinh
inverse hyperbolic sine:
arcsinh()
Arctanh
inverse hyperbolic tangent:
arctanh()
Bessel function
, complex argument, optionally scaled:
bessel_i_complex()
, real argument
scalar:
bessel_i0_real()
vectorized:
bessel_i0_real_vector()
, real argument
scalar:
bessel_i1_real()
vectorized:
bessel_i1_real_vector()
, complex argument:
bessel_j_seq_complex()
, complex argument, optionally scaled:
bessel_j_complex()
, real argument
scalar:
bessel_j0_real()
vectorized:
bessel_j0_real_vector()
, real argument
scalar:
bessel_j1_real()
vectorized:
bessel_j1_real_vector()
, complex argument, optionally scaled:
bessel_k_complex()
, real argument
scalar:
bessel_k0_real()
vectorized:
bessel_k0_real_vector()
, real argument
scalar:
bessel_k1_real()
vectorized:
bessel_k1_real_vector()
, complex argument, optionally scaled:
bessel_y_complex()
, real argument
scalar:
bessel_y0_real()
vectorized:
bessel_y0_real_vector()
, real argument
scalar:
bessel_y1_real()
vectorized:
bessel_y1_real_vector()
beta function
regularized incomplete
scalar:
beta_incomplete()
vectorized:
beta_incomplete_vector()
Complement of the Cumulative Normal distribution
scalar:
compcdf_normal()
vectorized:
compcdf_normal_vector()
Complement of the Error function
complex argument, scaled
scalar:
erfc_complex()
vectorized:
erfc_complex_vector()
real argument
scalar:
erfc_real()
vectorized:
erfc_real_vector()
real argument, scaled
scalar:
erfcx_real()
vectorized:
erfcx_real_vector()
Cosine
hyperbolic:
cosh()
Cosine Integral: integral_cos()
Cumulative Normal distribution function
scalar:
cdf_normal()
vectorized:
cdf_normal_vector()
Dawson’s Integral
scalar:
dawson()
vectorized:
dawson_vector()
Digamma function, scaled: polygamma_deriv()
Elliptic functions, Jacobian, sn, cn, dn
complex argument:
jacellip_complex()
real argument:
jacellip_real()
Elliptic integral
general
of 2nd kind, :
ellipint_general_2()
Legendre form
complete of 1st kind, :
ellipint_complete_1()
complete of 2nd kind, :
ellipint_complete_2()
of 1st kind, :
ellipint_legendre_1()
of 2nd kind, :
ellipint_legendre_2()
of 3rd kind, :
ellipint_legendre_3()
symmetrised
degenerate of 1st kind, :
ellipint_symm_1_degen()
of 1st kind, :
ellipint_symm_1()
of 2nd kind, :
ellipint_symm_2()
of 3rd kind, :
ellipint_symm_3()
Erf
real argument
scalar:
erf_real()
vectorized:
erf_real_vector()
Erfc
complex argument, scaled
scalar:
erfc_complex()
vectorized:
erfc_complex_vector()
real argument
scalar:
erfc_real()
vectorized:
erfc_real_vector()
erfcx
real argument
scalar:
erfcx_real()
vectorized:
erfcx_real_vector()
Exponential
complex:
exp_complex()
Exponential Integral: integral_exp()
Fresnel integral
scalar:
fresnel_c()
vectorized:
fresnel_c_vector()
scalar:
fresnel_s()
vectorized:
fresnel_s_vector()
Gamma function
incomplete
scalar:
gamma_incomplete()
vectorized:
gamma_incomplete_vector()
scalar:
gamma()
vectorized:
gamma_vector()
Generalized factorial function
scalar:
gamma()
vectorized:
gamma_vector()
Hankel function or
complex argument, optionally scaled:
hankel_complex()
Hypergeometric functions
, confluent, real argument:
hyperg_confl_real()
, confluent, real argument, scaled form:
hyperg_confl_real_scaled()
, Gauss, real argument:
hyperg_gauss_real()
, Gauss, real argument, scaled form:
hyperg_gauss_real_scaled()
Jacobian theta functions
real argument:
jactheta_real()
Kelvin function
scalar:
kelvin_bei()
vectorized:
kelvin_bei_vector()
scalar:
kelvin_ber()
vectorized:
kelvin_ber_vector()
scalar:
kelvin_kei()
vectorized:
kelvin_kei_vector()
scalar:
kelvin_ker()
vectorized:
kelvin_ker_vector()
Legendre functions of 1st kind , : legendre_p()
Logarithm of : log_shifted()
Logarithm of beta function
real
scalar:
beta_log_real()
vectorized:
beta_log_real_vector()
Logarithm of gamma function
complex:
gamma_log_complex()
real
scalar:
gamma_log_real()
vectorized:
gamma_log_real_vector()
real, scaled:
gamma_log_scaled_real()
Mathieu function (angular)
periodic, real
vectorized:
mathieu_ang_periodic_real()
Modified Struve function
, real argument
scalar:
struve_i0ml0()
, real argument
scalar:
struve_i1ml1()
, real argument
scalar:
struve_l0()
, real argument
scalar:
struve_l1()
Option Pricing
American option, Bjerksund and Stensland option price:
opt_amer_bs_price()
Asian option, geometric continuous average rate price:
opt_asian_geom_price()
Asian option, geometric continuous average rate price with Greeks:
opt_asian_geom_greeks()
binary asset-or-nothing option price:
opt_binary_aon_price()
binary asset-or-nothing option price with Greeks:
opt_binary_aon_greeks()
binary cash-or-nothing option price:
opt_binary_con_price()
binary cash-or-nothing option price with Greeks:
opt_binary_con_greeks()
Black–Scholes implied volatility:
opt_imp_vol()
Black–Scholes–Merton option price:
opt_bsm_price()
Black–Scholes–Merton option price with Greeks:
opt_bsm_greeks()
European option, option prices, using Merton jump-diffusion model:
opt_jumpdiff_merton_price()
European option, option price with Greeks, using Merton jump-diffusion model:
opt_jumpdiff_merton_greeks()
floating-strike lookback option price:
opt_lookback_fls_price()
floating-strike lookback option price with Greeks:
opt_lookback_fls_greeks()
Heston’s model option price:
opt_heston_price()
Heston’s model option price with Greeks:
opt_heston_greeks()
Heston’s model option price with Greeks, sensitivities of model parameters and negative rates:
opt_heston_more_greeks()
Heston’s model with term structure:
opt_heston_term()
standard barrier option price:
opt_barrier_std_price()
Polygamma function
, real :
psi_deriv_real()
, complex :
psi_deriv_complex()
psi function: polygamma()
psi function derivatives, scaled: polygamma_deriv()
Scaled modified Bessel function(s)
, real argument
scalar:
bessel_i0_scaled()
vectorized:
bessel_i0_scaled_vector()
, real argument
scalar:
bessel_i1_scaled()
vectorized:
bessel_i1_scaled_vector()
, real argument
scalar:
bessel_k0_scaled()
vectorized:
bessel_k0_scaled_vector()
, real argument
scalar:
bessel_k1_scaled()
vectorized:
bessel_k1_scaled_vector()
Sine
hyperbolic:
sinh()
Sine Integral: integral_sin()
Struve function
Tangent
Trigamma function, scaled: polygamma_deriv()
Zeros of Bessel functions , , ,
scalar:
bessel_zeros()
For full information please refer to the NAG Library document
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/s/sintro.html
Examples¶
- naginterfaces.library.examples.specfun.opt_bsm_price_ex.main()[source]¶
Example for
naginterfaces.library.specfun.opt_bsm_price()
.Computes the European option price given by the Black–Scholes–Merton formula.
>>> main() naginterfaces.library.specfun.opt_bsm_price Python Example Results. Prices for six European call options. Strike Expiry Price 58.0000 0.7000 5.9198 58.0000 0.8000 6.5506 60.0000 0.7000 5.0809 60.0000 0.8000 5.6992 62.0000 0.7000 4.3389 62.0000 0.8000 4.9379
- naginterfaces.library.examples.specfun.opt_heston_more_greeks_ex.main()[source]¶
Example for
naginterfaces.library.specfun.opt_heston_more_greeks()
.Computes the European option price given by the Heston model, provides greeks and derivatives with respect to model parameters.
>>> main() naginterfaces.library.specfun.opt_heston_more_greeks Python Example Results. Prices for four European call options. q r Price dp_dsigmav 0.0250 0.0100 6.5961 -1.9804 0.0250 -0.0100 7.9845 -1.7047 -0.0250 0.0100 3.9303 -2.4431 -0.0250 -0.0100 5.0138 -2.3868