HypergeometricFunctions: Confluent Hypergeometric Functions

Description Usage Arguments Details Value Author(s) References Examples

Description

A collection and description of special mathematical functions which compute the confluent hypergeometric and related functions. For example, these functions are required to valuate Asian Options based on the theory of exponential Brownian motion.

The functions are:

kummerM the Confluent Hypergeometric Function of the 1st Kind,
kummerU the Confluent Hypergeometric Function of the 2nd Kind,
whittakerM the Whittaker M Function,
whittakerW the Whittaker W Function,
hermiteH the Hermite Polynomials.

Usage

1
2
3
4
5
kummerM(x, a, b, lnchf = 0, ip = 0) 
kummerU(x, a, b, ip = 0)
whittakerM(x, kappa, mu, ip = 0) 
whittakerW(x, kappa, mu, ip = 0)
hermiteH(x, n, ip = 0)

Arguments

x

[kummer*] -
a complex numeric value or vector.

a, b

[kummer*] -
complex numeric indexes of the Kummer functions.

ip

an integer value that specifies how many array positions are desired, usually 10 is sufficient. Setting ip=0 causes the function to estimate the number of array positions.

kappa, mu

complex numeric indexes of the Whittaker functions.

lnchf

an integer value which selects how the result should be represented. A 0 will return the value in standard exponential form, a 1 will return the LOG of the result.

n

[hermiteH] -
the index of the Hermite polynomial, a positive integer value.

Details

The functions use the TOMS707 Algorithm by M. Nardin, W.F. Perger and A. Bhalla (1989). A numerical evaluator for the confluent hypergeometric function for complex arguments with large magnitudes using a direct summation of the Kummer series. The method used allows an accuracy of up to thirteen decimal places through the use of large real arrays and a single final division.

The confluent hypergeometric function is the solution to the differential equation:

zf"(z) + (a-z)f'(z) - bf(z) = 0

The Whittaker functions and the Hermite Polynomials are dervived from Kummer's functions.

Value

The functions return the values of the selected special mathematical function.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

References

Abramowitz M., Stegun I.A. (1972); Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables, 9th printing, New York, Dover Publishing.

Weisstein E.W. (2004); MathWorld – A Wolfram Web Resource, http://mathworld.wolfram.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
## kummerM - 
   # Abramowitz-Stegun: Formula 13.6.3/13.6.21
   x = c(0.001, 0.01, 0.1, 1, 10, 100, 1000)  
   nu = 1; a = nu+1/2; b = 2*nu+1
   M = Re ( kummerM(x = 2*x, a = a, b = b) )
   Bessel = gamma(1+nu) * exp(x)*(x/2)^(-nu) * BesselI(x, nu)
   cbind(x, M, Bessel) 

## kummerM -
   # Abramowitz-Stegun: Formula 13.6.14
   x = c(0.001, 0.01, 0.1, 1, 10, 100, 1000)  
   M = Re ( kummerM(2*x, a = 1, b = 2) )
   Sinh = exp(x)*sinh(x)/(x)
   cbind(x, M, Sinh)
   # Now the same for complex x:
   y = rep(1, length = length(x))
   x = complex(real = x, imag = y)
   M = kummerM(2*x, a = 1, b = 2)
   Sinh = exp(x)*sinh(x)/(x)
   cbind(x, M, Sinh)

## kummerU -
   # Abramowitz-Stegun: Formula 13.1.3
   x = c(0.001, 0.01, 0.1, 1, 10, 100, 1000) 
   a = 1/3; b = 2/3
   U = Re ( kummerU(x, a = a, b = b) )
   cbind(x, U)
 
## whittakerM - 
   # Abramowitz-Stegun: Example 13
   AS = c(1.10622, 0.57469)
   W = c(
     whittakerM(x = 1, kappa = 0, mu = -0.4),
     whittakerW(x = 1, kappa = 0, mu = -0.4) )
   data.frame(AS, W)

## kummerM
   # Abramowitz-Stegun: Example 17
   x = seq(0, 16, length = 200)
   plot(x = x, y = kummerM(x, -4.5, 1), type = "l", ylim = c(-25,125),
     main = "Figure 13.2:  M(-4.5, 1, x)")
   lines(x = c(0, 16), y = c(0, 0), col = 2)

Example output

Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics
Loading required package: fOptions
         x            M       Bessel
[1,] 1e-03 1.001001e+00 1.001001e+00
[2,] 1e-02 1.010063e+00 1.010063e+00
[3,] 1e-01 1.106553e+00 1.106553e+00
[4,] 1e+00 3.072523e+00 3.072523e+00
[5,] 1e+01 1.176649e+07 1.176649e+07
[6,] 1e+02 1.000000e+75 5.743804e+83
[7,] 1e+03 1.000000e+75          Inf
         x            M         Sinh
[1,] 1e-03 1.001001e+00 1.001001e+00
[2,] 1e-02 1.010067e+00 1.010067e+00
[3,] 1e-01 1.107014e+00 1.107014e+00
[4,] 1e+00 3.194528e+00 3.194528e+00
[5,] 1e+01 2.425826e+07 2.425826e+07
[6,] 1e+02 1.000000e+75 3.612987e+84
[7,] 1e+03 1.000000e+75          Inf
               x                           M                        Sinh
[1,]    0.001+1i  4.548500e-01+7.089448e-01i  4.548500e-01+7.089448e-01i
[2,]    0.010+1i  4.566648e-01+7.168434e-01i  4.566648e-01+7.168434e-01i
[3,]    0.100+1i  4.751436e-01+8.016558e-01i  4.751436e-01+8.016558e-01i
[4,]    1.000+1i  6.609793e-01+2.698446e+00i  6.609793e-01+2.698446e+00i
[5,]   10.000+1i -7.811090e+06+2.283908e+07i -7.811090e+06+2.283908e+07i
[6,]  100.000+1i  1.000000e+75+1.000000e+75i -1.470533e+84+3.299985e+84i
[7,] 1000.000+1i  1.000000e+75+1.000000e+75i           Inf+         Infi
         x             U
[1,] 1e-03  1.827638e+00
[2,] 1e-02  1.659957e+00
[3,] 1e-01  1.341021e+00
[4,] 1e+00  8.745968e-01
[5,] 1e+01  4.548890e-01
[6,] 1e+02  1.731347e+35
[7,] 1e+03 -1.318568e+76
       AS            W
1 1.10622 1.1062175+0i
2 0.57469 0.5746992+0i

fAsianOptions documentation built on May 2, 2019, 8:19 a.m.