<s>
Adaptive	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
method	I-Algorithm
,	O
also	O
called	O
adaptive	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
rule	I-Algorithm
,	O
is	O
a	O
method	O
of	O
numerical	B-Algorithm
integration	I-Algorithm
proposed	O
by	O
G.F.	O
Kuncir	O
in	O
1962	O
.	O
</s>
<s>
It	O
is	O
probably	O
the	O
first	O
recursive	O
adaptive	O
algorithm	O
for	O
numerical	B-Algorithm
integration	I-Algorithm
to	O
appear	O
in	O
print	O
,	O
although	O
more	O
modern	O
adaptive	O
methods	O
based	O
on	O
Gauss	B-Algorithm
–	I-Algorithm
Kronrod	I-Algorithm
quadrature	I-Algorithm
and	O
Clenshaw	B-Algorithm
–	I-Algorithm
Curtis	I-Algorithm
quadrature	I-Algorithm
are	O
now	O
generally	O
preferred	O
.	O
</s>
<s>
Adaptive	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
method	I-Algorithm
uses	O
an	O
estimate	O
of	O
the	O
error	O
we	O
get	O
from	O
calculating	O
a	O
definite	O
integral	O
using	O
Simpson	B-Algorithm
's	I-Algorithm
rule	I-Algorithm
.	O
</s>
<s>
If	O
the	O
error	O
exceeds	O
a	O
user-specified	O
tolerance	O
,	O
the	O
algorithm	O
calls	O
for	O
subdividing	O
the	O
interval	O
of	O
integration	O
in	O
two	O
and	O
applying	O
adaptive	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
method	I-Algorithm
to	O
each	O
subinterval	O
in	O
a	O
recursive	O
manner	O
.	O
</s>
<s>
The	O
technique	O
is	O
usually	O
much	O
more	O
efficient	O
than	O
composite	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
rule	I-Algorithm
since	O
it	O
uses	O
fewer	O
function	O
evaluations	O
in	O
places	O
where	O
the	O
function	O
is	O
well-approximated	O
by	O
a	O
cubic	O
function	O
.	O
</s>
<s>
Simpson	B-Algorithm
's	I-Algorithm
rule	I-Algorithm
is	O
an	O
interpolatory	O
quadrature	O
rule	O
which	O
is	O
exact	O
when	O
the	O
integrand	O
is	O
a	O
polynomial	O
of	O
degree	O
three	O
or	O
lower	O
.	O
</s>
<s>
Using	O
Richardson	B-Algorithm
extrapolation	I-Algorithm
,	O
the	O
more	O
accurate	O
Simpson	O
estimate	O
for	O
six	O
function	O
values	O
is	O
combined	O
with	O
the	O
less	O
accurate	O
estimate	O
for	O
three	O
function	O
values	O
by	O
applying	O
the	O
correction	O
.	O
</s>
<s>
where	O
is	O
an	O
interval	O
with	O
midpoint	O
,	O
while	O
,	O
,	O
and	O
given	O
by	O
Simpson	B-Algorithm
's	I-Algorithm
rule	I-Algorithm
are	O
the	O
estimates	O
of	O
,	O
,	O
and	O
respectively	O
,	O
and	O
is	O
the	O
desired	O
maximum	O
error	O
tolerance	O
for	O
the	O
interval	O
.	O
</s>
<s>
To	O
perform	O
adaptive	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
method	I-Algorithm
,	O
do	O
the	O
following	O
:	O
if	O
,	O
add	O
and	O
to	O
the	O
sum	O
of	O
Simpson	B-Algorithm
's	I-Algorithm
rules	I-Algorithm
which	O
are	O
used	O
to	O
approximate	O
the	O
integral	O
,	O
otherwise	O
,	O
perform	O
the	O
same	O
operation	O
with	O
and	O
instead	O
of	O
.	O
</s>
<s>
Some	O
inputs	O
will	O
fail	O
to	O
converge	O
in	O
adaptive	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
method	I-Algorithm
quickly	O
,	O
resulting	O
in	O
the	O
tolerance	O
underflowing	B-Algorithm
and	O
producing	O
an	O
infinite	O
loop	O
.	O
</s>
<s>
The	O
interval	O
size	O
may	O
also	O
approach	O
the	O
local	O
machine	B-Algorithm
epsilon	I-Algorithm
,	O
giving	O
.	O
</s>
<s>
Here	O
is	O
an	O
implementation	O
of	O
adaptive	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
method	I-Algorithm
in	O
Python	B-Language
.	O
</s>
<s>
Efficient	O
recursive	O
implementation	O
of	O
adaptive	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
rule	I-Algorithm
.	O
</s>
<s>
Here	O
is	O
an	O
implementation	O
of	O
the	O
adaptive	B-Algorithm
Simpson	I-Algorithm
's	I-Algorithm
method	I-Algorithm
in	O
C99	O
that	O
avoids	O
redundant	O
evaluations	O
of	O
f	O
and	O
quadrature	O
computations	O
.	O
</s>
<s>
This	O
implementation	O
has	O
been	O
incorporated	O
into	O
a	O
C++	O
ray	B-Algorithm
tracer	I-Algorithm
intended	O
for	O
X-Ray	O
Laser	O
simulation	O
at	O
Oak	O
Ridge	O
National	O
Laboratory	O
,	O
among	O
other	O
projects	O
.	O
</s>
<s>
Here	O
is	O
an	O
implementation	O
of	O
the	O
adaptive	B-Algorithm
Simpson	I-Algorithm
method	I-Algorithm
in	O
Racket	B-Operating_System
with	O
a	O
behavioral	O
software	O
contract	O
.	O
</s>
<s>
Henriksson	O
(	O
1961	O
)	O
is	O
a	O
non-recursive	O
variant	O
of	O
Simpson	B-Algorithm
's	I-Algorithm
Rule	I-Algorithm
.	O
</s>
<s>
Algorithm	O
103	O
consists	O
of	O
a	O
larger	O
routine	O
with	O
a	O
nested	O
subroutine	O
(	O
loop	O
AA	O
)	O
,	O
made	O
recursive	O
by	O
the	O
use	O
of	O
the	O
goto	B-Application
statement	O
.	O
</s>
<s>
It	O
guards	O
against	O
the	O
underflowing	B-Algorithm
of	O
interval	O
widths	O
(	O
loop	O
BB	O
)	O
,	O
and	O
aborts	O
as	O
soon	O
as	O
the	O
user-specified	O
eps	O
is	O
exceeded	O
.	O
</s>
<s>
Created	O
as	O
a	O
set	O
of	O
four	O
modifications	O
of	O
McKeeman	O
1962	O
,	O
it	O
replaces	O
trisection	O
with	O
bisection	O
to	O
lower	O
computational	O
costs	O
(	O
Modifications	O
1+2	O
,	O
coinciding	O
with	O
the	O
Kuncir	O
integrator	O
)	O
and	O
improves	O
McKeeman	O
's	O
1962/63	O
error	O
estimates	O
to	O
the	O
fifth	O
order	O
(	O
Modification	O
3	O
)	O
,	O
in	O
a	O
way	O
related	O
to	O
Boole	B-Algorithm
's	I-Algorithm
rule	I-Algorithm
and	O
Romberg	B-Algorithm
's	I-Algorithm
method	I-Algorithm
.	O
</s>
