File: 3C-HypergeometricFunctions.Rd

package info (click to toggle)
foptions 240.10068-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,624 kB
  • ctags: 455
  • sloc: fortran: 3,556; sh: 22; makefile: 1
file content (173 lines) | stat: -rw-r--r-- 4,581 bytes parent folder | download
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
\name{HypergeometricFunctions}

\alias{HypergeometricFunctions}

\alias{kummerM}
\alias{kummerU}
\alias{whittakerM}
\alias{whittakerW}
\alias{hermiteH}


\title{Confluent Hypergeometric Functions}


\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.     
    \cr     

    The functions are:

    \tabular{ll}{
    \code{kummerM} \tab the Confluent Hypergeometric Function of the 1st Kind, \cr
    \code{kummerU} \tab the Confluent Hypergeometric Function of the 2nd Kind, \cr
    \code{whittakerM} \tab the Whittaker M Function, \cr
    \code{whittakerW} \tab the Whittaker W Function, \cr
    \code{hermiteH} \tab the Hermite Polynomials. }   
    
}


\usage{
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{
  
    \item{x}{
        [kummer*] - \cr
        a complex numeric value or vector.
        }
    \item{a, b}{
        [kummer*] - \cr
        complex numeric indexes of the Kummer functions.
        }
    \item{ip}{
        an integer value that specifies how many array positions are 
        desired, usually 10 is sufficient. Setting \code{ip=0} causes 
        the function to estimate the number of array positions.   
        }
    \item{kappa, mu}{
        complex numeric indexes of the Whittaker functions.
        }
    \item{lnchf}{
        an integer value which selects how the result should be 
        represented.  A \code{0} will return the value in standard 
        exponential form, a \code{1} will return the LOG of the result.
        }
    \item{n}{
        [hermiteH] - \cr
        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{

    Diethelm Wuertz for the Rmetrics \R-port.
    
}


\references{

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

Weisstein E.W. (2004);
    \emph{MathWorld -- A Wolfram Web Resource},
    http://mathworld.wolfram.com

}


\examples{
## SOURCE("fOptions.3C-HypergeometricFunctions")

## 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)
}


\keyword{math}