-
Notifications
You must be signed in to change notification settings - Fork 0
/
BBS-Numerical-integration_real.ads
27 lines (27 loc) · 1.19 KB
/
BBS-Numerical-integration_real.ads
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
generic
type F is digits <>;
package BBS.Numerical.integration_real is
--
-- Define a type for the function to integrate.
--
type test_func is access function (x : f'Base) return f'Base;
--
-- Integrate the provided function between the lower and upper limits using
-- the composite trapezoid method with the specified number of steps.
--
function trapezoid(test : test_func; lower, upper : f'Base; steps : Positive) return f'Base;
--
-- Integrate the provided function between the lower and upper limits using
-- the composite Simpson's rule with the specified number of steps. Note
-- that since Simpson's rule evaluates the function in the midpoint of a
-- segment, the effective number of steps is doubled.
--
function simpson(test : test_func; lower, upper : f'Base; steps : Positive) return f'Base;
--
-- Integrate the provided function between the lower and upper limits using
-- adaptive Simpson's integration. A requested tolerance is input and
-- returned as an estimated value.
--
function adapt_simpson(test : test_func; lower, upper : f'Base; tol : in out f'Base;
levels : Natural) return f'Base;
end;