GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
erf.f
Go to the documentation of this file.
1 *DECK ERF
2  FUNCTION erf (X)
3 C***BEGIN PROLOGUE ERF
4 C***PURPOSE Compute the error function.
5 C***LIBRARY SLATEC (FNLIB)
6 C***CATEGORY C8A, L5A1E
7 C***TYPE SINGLE PRECISION (ERF-S, DERF-D)
8 C***KEYWORDS ERF, ERROR FUNCTION, FNLIB, SPECIAL FUNCTIONS
9 C***AUTHOR Fullerton, W., (LANL)
10 C***DESCRIPTION
11 C
12 C ERF(X) calculates the single precision error function for
13 C single precision argument X.
14 C
15 C Series for ERF on the interval 0. to 1.00000D+00
16 C with weighted error 7.10E-18
17 C log weighted error 17.15
18 C significant figures required 16.31
19 C decimal places required 17.71
20 C
21 C***REFERENCES (NONE)
22 C***ROUTINES CALLED CSEVL, ERFC, INITS, R1MACH
23 C***REVISION HISTORY (YYMMDD)
24 C 770401 DATE WRITTEN
25 C 890531 Changed all specific intrinsics to generic. (WRB)
26 C 890531 REVISION DATE from Version 3.2
27 C 891214 Prologue converted to Version 4.0 format. (BAB)
28 C 900727 Added EXTERNAL statement. (WRB)
29 C 920618 Removed space from variable name. (RWC, WRB)
30 C***END PROLOGUE ERF
31  dimension erfcs(13)
32  LOGICAL FIRST
33  EXTERNAL erfc
34  SAVE erfcs, sqrtpi, nterf, xbig, sqeps, first
35  DATA erfcs( 1) / -.0490461212 34691808e0 /
36  DATA erfcs( 2) / -.1422612051 0371364e0 /
37  DATA erfcs( 3) / .0100355821 87599796e0 /
38  DATA erfcs( 4) / -.0005768764 69976748e0 /
39  DATA erfcs( 5) / .0000274199 31252196e0 /
40  DATA erfcs( 6) / -.0000011043 17550734e0 /
41  DATA erfcs( 7) / .0000000384 88755420e0 /
42  DATA erfcs( 8) / -.0000000011 80858253e0 /
43  DATA erfcs( 9) / .0000000000 32334215e0 /
44  DATA erfcs(10) / -.0000000000 00799101e0 /
45  DATA erfcs(11) / .0000000000 00017990e0 /
46  DATA erfcs(12) / -.0000000000 00000371e0 /
47  DATA erfcs(13) / .0000000000 00000007e0 /
48  DATA sqrtpi /1.772453850 9055160e0/
49  DATA first /.true./
50 C***FIRST EXECUTABLE STATEMENT ERF
51  IF (first) THEN
52  nterf = inits(erfcs, 13, 0.1*r1mach(3))
53  xbig = sqrt(-log(sqrtpi*r1mach(3)))
54  sqeps = sqrt(2.0*r1mach(3))
55  ENDIF
56  first = .false.
57 C
58  y = abs(x)
59  IF (y.GT.1.) go to 20
60 C
61 C ERF(X) = 1. - ERFC(X) FOR -1. .LE. X .LE. 1.
62 C
63  IF (y.LE.sqeps) erf = 2.0*x/sqrtpi
64  IF (y.GT.sqeps) erf = x*(1.0 + csevl(2.*x**2-1., erfcs, nterf))
65  RETURN
66 C
67 C ERF(X) = 1. - ERFC(X) FOR ABS(X) .GT. 1.
68 C
69  20 IF (y.LE.xbig) erf = sign(1.0-erfc(y), x)
70  IF (y.GT.xbig) erf = sign(1.0, x)
71 C
72  RETURN
73  END
function inits(OS, NOS, ETA)
Definition: inits.f:2
function csevl(X, CS, N)
Definition: csevl.f:2
function erfc(X)
Definition: erfc.f:2
function erf(X)
Definition: erf.f:2
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the base of natural logarithms The constant ex $e satisfies the equation log(e)
is false
Definition: cellfun.cc:398
may be zero for pure relative error test tem the relative tolerance must be greater than or equal to
Definition: Quad-opts.cc:233
OCTAVE_EXPORT octave_value_list etc The functions then dimension(columns)
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup abs(local error in x(i))<
octave_value sqrt(void) const
Definition: ov.h:1388