You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@section[#:tag"complex-real-functions"]{Complexand real Functions}
60
60
61
61
@defproc[(gamma [x Number]) Number]{
62
62
Computes the @hyperlink["http://en.wikipedia.org/wiki/Gamma_function"]{gamma function},
@@ -132,8 +132,6 @@ error.
132
132
If you need low relative error near negative roots, use @racket[bfpsi0].
133
133
}
134
134
135
-
@section[#:tag"real-functions"]{Real Functions}
136
-
137
135
@defproc[(psi [m Integer] [x Real]) Flonum]{
138
136
Computes a @hyperlink["http://en.wikipedia.org/wiki/Polygamma_function"]{polygamma function},
139
137
or the @racket[m]th logarithmic derivative of the gamma function. The order @racket[m] must be
@@ -154,7 +152,7 @@ near negative roots. Near negative roots, relative error is apparently unbounded
154
152
is low.
155
153
}
156
154
157
-
@deftogether[(@defproc[(erf [x Real]) Real]
155
+
@deftogether[(@defproc[(erf [x Number]) Number]
158
156
@defproc[(erfc [x Real]) Real])]{
159
157
Compute the @hyperlink["http://en.wikipedia.org/wiki/Error_function"]{error function and
160
158
complementary error function}, respectively. The only exact cases are @racket[(erf 0) = 0]
@@ -167,7 +165,8 @@ and @racket[(erfc 0) = 1].
167
165
(erf 1)
168
166
(- 1 (erfc 1))
169
167
(erf -1)
170
-
(- (erfc 1) 1)]
168
+
(- (erfc 1) 1)
169
+
(erf 1+i)]
171
170
172
171
Mathematically, erfc(@italic{x}) = 1 - erf(@italic{x}), but having separate implementations
173
172
can help maintain accuracy. To compute an expression containing erf, use @racket[erf] for
@@ -185,8 +184,8 @@ manipulate @racket[(- 1.0 (erfc x))] and its surrounding expressions to avoid th
185
184
(flulp-error (fllog1p (- (erfc x))) log-erf-x)]
186
185
For negative @racket[x] away from @racket[0.0], do the same with @racket[(- (erfc (- x)) 1.0)].
187
186
188
-
For @racket[erf], error is no greater than 2 @tech{ulps} everywhere that has been tested, and
189
-
is almost always no greater than 1. For @racket[erfc], observed error is no greater than 4 ulps,
187
+
For @racket[erf], on the real line the error is no greater than 2 @tech{ulps} everywhere that has been tested, and
188
+
is almost always no greater than 1.In the complex plane the relative error is smaller 1e-12. For @racket[erfc], observed error is no greater than 4 ulps,
190
189
and is usually no greater than 2.
191
190
}
192
191
@@ -394,10 +393,10 @@ have very dissimilar magnitudes (e.g. @racket[1e-16] and @racket[1e16]), it exhi
394
393
@tech{catastrophic cancellation}. We are working on it.
Spot-checks within the region 0<=x<=150 sugest that the error is no greater than 1e-14 everywhere that has been tested, and usually is lower than 2e-15.
415
+
Spot-checks on the real line within the region 0<=x<=150 sugest that the error is no greater than 1e-14
416
+
everywhere that has been tested, and usually is lower than 2e-15. In the complex plane the relative error
0 commit comments