Skip to main content

Numerical Integration Ontology

Numerical Calculus
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 24 September 2026
Audio Overview
flow "NumericalIntegrationOntology" v1.0

# ============================================================
# NUMERICAL INTEGRATION ONTOLOGY — FLOW ALGEBRA
# ============================================================

SOURCE_URL := "https://kirethresearch.org/booksai-core/ontologies/calculus-analysis-ontologies/numerical-calculus/numerical-integration-ontology-4.html"
DOMAIN := "Mathematical Ontologies"
CATEGORY := "Calculus and Analysis Ontologies"
SUBCATEGORY := "Numerical Calculus"
ENTITY := "Numerical Integration"

# ---------- CORE ENTITY ----------
NUMERICAL_INTEGRATION := {
    type: NumericalIntegralApproximation,
    domain: NumericalCalculus,
    purpose: "Approximate definite integrals using finite weighted evaluations of an integrand when exact symbolic integration is unavailable, inefficient or unnecessary."
}

# ---------- CORE CONCEPTS ----------
CONCEPTS := {
    NUMERICAL_INTEGRATION,
    QUADRATURE,
    INTEGRAND,
    INTEGRATION_INTERVAL,
    NODE,
    WEIGHT,
    RECTANGLE_RULE,
    MIDPOINT_RULE,
    TRAPEZOIDAL_RULE,
    SIMPSON_RULE,
    NEWTON_COTES,
    GAUSSIAN_QUADRATURE,
    ADAPTIVE_QUADRATURE,
    ERROR_ESTIMATE,
    ROMBERG_INTEGRATION
}

# ---------- TARGET INTEGRAL ----------
I
    :=
integral_from_a_to_b(
    f(x)
    dx
)

NUMERICAL_INTEGRATION
    -> seek(APPROXIMATION_Q)

such that

Q
    approx
I

# ---------- QUADRATURE FORM ----------
general quadrature:

Q[f]
    :=
sum_from_i_0_to_n(
    w_i
    *
    f(x_i)
)

x_i
    -> QUADRATURE_NODE

w_i
    -> QUADRATURE_WEIGHT

QUADRATURE_RULE
    -> finite_weighted_sum_of(INTEGRAND_VALUES)

# ---------- COMPOSITE GRID ----------
partition:

a
    =
x_0
<
x_1
<
...
<
x_n
=
b

uniform case:

h
    :=
(b-a)/n

x_i
    =
a+i*h

COMPOSITE_QUADRATURE
    -> sums(LOCAL_RULES_OVER_SUBINTERVALS)

# ---------- LEFT RECTANGLE ----------
Q_left
    :=
h
*
sum_from_i_0_to_nminus1(
    f(x_i)
)

LEFT_RECTANGLE_RULE
    -> piecewise_constant_left_endpoint_approximation

global_error
    -> O(h)
       under(SUITABLE_SMOOTHNESS)

# ---------- RIGHT RECTANGLE ----------
Q_right
    :=
h
*
sum_from_i_1_to_n(
    f(x_i)
)

RIGHT_RECTANGLE_RULE
    -> piecewise_constant_right_endpoint_approximation

global_error
    -> O(h)

# ---------- MIDPOINT RULE ----------
midpoint_i
    :=
(
    x_i+x_(i+1)
)/2

Q_mid
    :=
h
*
sum_from_i_0_to_nminus1(
    f(midpoint_i)
)

MIDPOINT_RULE
    -> second_order_method

global_error
    -> O(h^2)
       under(SUFFICIENT_SMOOTHNESS)

# ---------- TRAPEZOIDAL RULE ----------
single interval:

Q_T
    :=
(b-a)
*
[
    f(a)+f(b)
]/2

COMPOSITE_TRAPEZOIDAL:

Q_T
    :=
h
*
[
    1/2*f(x_0)
    +
    sum_from_i_1_to_nminus1(
        f(x_i)
    )
    +
    1/2*f(x_n)
]

global_error
    -> O(h^2)

# ---------- TRAPEZOIDAL ERROR ----------
if
    f_double_prime
        -> continuous

then

I-Q_T
    =
-
(b-a)/12
*
h^2
*
f_double_prime(xi)

for some
    xi in (a,b)

under
    standard_uniform_composite_rule_conditions

ERROR
    -> controlled_by(SECOND_DERIVATIVE)

# ---------- SIMPSON RULE ----------
for two equal subintervals:

Q_S
    :=
h/3
*
[
    f(x_0)
    +
    4*f(x_1)
    +
    f(x_2)
]

where
    h=(x_2-x_0)/2

COMPOSITE_SIMPSON
    -> requires(EVEN_NUMBER_OF_SUBINTERVALS)

weights:
    1,4,2,4,...,2,4,1

# ---------- SIMPSON ERROR ----------
for sufficiently smooth f:

global_error
    -> O(h^4)

and

I-Q_S
    =
-
(b-a)/180
*
h^4
*
f^(4)(xi)

for some xi
under
    standard_composite_Simpson_conditions

SIMPSON_RULE
    -> fourth_order_composite_method

# ---------- NEWTON-COTES ----------
NEWTON_COTES_RULE
    -> derived_by(INTEGRATING_INTERPOLATING_POLYNOMIAL)

nodes
    -> equally_spaced

closed_rule
    -> includes(ENDPOINTS)

open_rule
    -> excludes(ENDPOINTS)

RECTANGLE_TRAPEZOID_SIMPSON
    -> members_of(NEWTON_COTES_FAMILY)

# ---------- HIGH-DEGREE CAUTION ----------
HIGH_ORDER_NEWTON_COTES
    -> may_have(LARGE_OR_NEGATIVE_WEIGHTS)

HIGH_DEGREE_EQUALLY_SPACED_INTERPOLATION
    -> may_be(NUMERICALLY_UNFAVOURABLE)

COMPOSITE_LOW_ORDER_RULES
    -> often_preferred

# ---------- GAUSSIAN QUADRATURE ----------
for weight function
    w(x)

seek

integral(
    w(x)*f(x)
    dx
)

approx

sum_from_i_1_to_n(
    W_i*f(x_i)
)

nodes
    -> chosen_as(ROOTS_OF_ORTHOGONAL_POLYNOMIAL)

n_point_GAUSS
    -> exact_for(POLYNOMIALS_UP_TO_DEGREE_2n_MINUS_1)

under
    corresponding_weight_and_interval

# ---------- GAUSS-LEGENDRE ----------
interval:
    [-1,1]

weight:
    1

nodes
    -> roots_of(LEGENDRE_POLYNOMIAL)

GAUSS_LEGENDRE
    -> standard_Gaussian_quadrature_for_unweighted_finite_interval

general interval
    [a,b]

-> map_affinely_to([-1,1])

# ---------- OTHER GAUSSIAN FAMILIES ----------
GAUSS_HERMITE
    -> weight(exp(-x^2))
    -> interval(-infinity,infinity)

GAUSS_LAGUERRE
    -> weight(exp(-x))
    -> interval(0,infinity)

GAUSS_CHEBYSHEV
    -> Chebyshev_weight

ORTHOGONAL_POLYNOMIAL_FAMILY
    -> matched_to(INTEGRATION_WEIGHT_AND_DOMAIN)

# ---------- ADAPTIVE QUADRATURE ----------
procedure:
    approximate_on(interval)
    -> estimate(error)
    -> if(error > tolerance):
         subdivide(interval)
         recurse
    -> else:
         accept(local_approximation)

ADAPTIVE_QUADRATURE
    -> concentrates_nodes_where(INTEGRAND_IS_DIFFICULT)

# ---------- ERROR ESTIMATION ----------
compute
    Q_coarse

and
    Q_fine

difference:

|Q_fine-Q_coarse|
    -> local_error_indicator

if known order p:

ERROR_ESTIMATE
    -> derived_using(RICHARDSON_SCALING)

ADAPTIVITY
    -> driven_by(ERROR_ESTIMATE)

# ---------- ADAPTIVE SIMPSON ----------
S(a,b)
    -> Simpson_estimate_on_whole_interval

S(a,m)
+
S(m,b)
    -> refined_estimate

difference
    -> estimates(local_error)

ADAPTIVE_SIMPSON
    -> recursively_subdivides_until(TOLERANCE)

# ---------- RICHARDSON EXTRAPOLATION ----------
if

Q(h)
    =
I
+
C*h^p
+
higher_order_terms

then combine
    Q(h)
    and
    Q(h/2)

to eliminate
    C*h^p

RICHARDSON_EXTRAPOLATION
    -> improves(INTEGRAL_APPROXIMATION)

# ---------- ROMBERG INTEGRATION ----------
start_with
    COMPOSITE_TRAPEZOIDAL_RULE

successively halve
    h

then apply
    RICHARDSON_EXTRAPOLATION_TABLE

ROMBERG_INTEGRATION
    -> high_order_extrapolated_quadrature

# ---------- IMPROPER INTEGRALS ----------
if interval
    -> infinite

or integrand
    -> singular

then

NUMERICAL_INTEGRATION
    -> may_require(
        VARIABLE_TRANSFORMATION,
        DOMAIN_TRUNCATION,
        SPECIAL_QUADRATURE,
        SINGULARITY_SUBTRACTION
    )

STANDARD_RULE
    -/> automatically_reliable_for(IMPROPER_INTEGRAL)

# ---------- ENDPOINT SINGULARITY ----------
if
    f(x)
        -> singular_near(a)

then

change_of_variable
    -> may_regularise(INTEGRAND)

ADAPTIVE_METHOD
    -> may_refine_near(SINGULARITY)

SINGULARITY_STRUCTURE
    -> should_be_explicitly_handled

# ---------- OSCILLATORY INTEGRALS ----------
integrand:

f(x)
*
exp(i*omega*x)

for large omega:

STANDARD_QUADRATURE
    -> may_require(MANY_NODES)

SPECIAL_OSCILLATORY_QUADRATURE
    -> exploits(OSCILLATION_STRUCTURE)

examples:
    FILON_TYPE_METHODS
    LEVIN_TYPE_METHODS

# ---------- PERIODIC TRAPEZOIDAL BEHAVIOUR ----------
for smooth periodic analytic functions:

TRAPEZOIDAL_RULE
    -> can_converge(VERY_RAPIDLY)

PERIODIC_STRUCTURE
    -> may_make(TRAPEZOIDAL_RULE_EXCEPTIONALLY_EFFECTIVE)

ERROR_RATE
    -> depends_on(ANALYTICITY_AND_PERIODICITY)

# ---------- MULTIDIMENSIONAL INTEGRATION ----------
I
    :=
integral_Omega(
    f(x)
    dx
)

methods:
    PRODUCT_QUADRATURE
    CUBATURE
    MONTE_CARLO
    QUASI_MONTE_CARLO
    SPARSE_GRID

DIMENSION
    -> strongly_affects(COMPUTATIONAL_COST)

# ---------- PRODUCT QUADRATURE ----------
1D_RULE
    -> tensor_product
    -> MULTIDIMENSIONAL_RULE

number_of_nodes
    -> grows_exponentially_with(DIMENSION)

CURSE_OF_DIMENSIONALITY
    -> limits(TENSOR_PRODUCT_QUADRATURE)

# ---------- MONTE CARLO RELATION ----------
random samples
    X_i

estimate

I
    approx
volume(Omega)
*
1/N
*
sum_i(
    f(X_i)
)

statistical_error
    -> O(N^(-1/2))
       under(STANDARD_MONTE_CARLO_ASSUMPTIONS)

MONTE_CARLO
    -> useful_in(HIGH_DIMENSIONS)

# ---------- QUASI-MONTE CARLO ----------
LOW_DISCREPANCY_POINTS
    -> replace(RANDOM_POINTS)

QUASI_MONTE_CARLO
    -> deterministic_sampling_method

CONVERGENCE
    -> depends_on(DIMENSION_AND_FUNCTION_REGULARITY)

# ---------- DATA INTEGRATION ----------
if only sampled data available:

NUMERICAL_INTEGRATION
    -> use(DATA_BASED_QUADRATURE)

TRAPEZOIDAL_RULE
    -> supports(IRREGULAR_SPACING_WITH_LOCAL_WIDTHS)

SIMPSON_RULE
    -> requires(APPROPRIATE_SPACING_STRUCTURE_OR_GENERALISATION)

DATA_GRID
    -> determines(AVAILABLE_METHODS)

# ---------- ROUNDING ERROR ----------
large number_of_function_evaluations
    -> accumulation_of(FLOATING_POINT_ERROR)

SUMMATION
    -> may_benefit_from(COMPENSATED_SUMMATION)

ROUNDING_ERROR
    -> usually_secondary_but_can_matter_in(HIGH_ACCURACY_COMPUTATION)

# ---------- COST ----------
COMPUTATIONAL_COST
    -> number_of(FUNCTION_EVALUATIONS)
    + overhead

EXPENSIVE_INTEGRAND
    -> motivates(HIGH_EFFICIENCY_QUADRATURE)

ADAPTIVE_METHOD
    -> attempts_to_allocate(EVALUATIONS_WHERE_NEEDED)

# ---------- APPLICATIONS ----------
NUMERICAL_INTEGRATION
    -> applied_to(SCIENTIFIC_COMPUTING)
    -> applied_to(PROBABILITY)
    -> applied_to(PHYSICS)
    -> applied_to(ENGINEERING)
    -> applied_to(FINITE_ELEMENT_METHODS)
    -> applied_to(STATISTICS)
    -> applied_to(INTEGRAL_EQUATIONS)
    -> applied_to(COMPUTATIONAL_GEOMETRY)

# ---------- RELATION GRAPH ----------
DEFINITE_INTEGRAL
    -> approximated_by(QUADRATURE)

QUADRATURE
    -> uses(NODES_AND_WEIGHTS)

INTERPOLATION
    -> generates(NEWTON_COTES_RULES)

ORTHOGONAL_POLYNOMIALS
    -> generate(GAUSSIAN_QUADRATURE)

ERROR_ESTIMATE
    -> controls(ADAPTIVE_REFINEMENT)

RICHARDSON_EXTRAPOLATION
    -> generates(ROMBERG_STRUCTURE)

DIMENSION
    -> influences(METHOD_SELECTION)

# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE := {
    "numerical integration" ~= "approximation of definite integrals by numerical algorithms",
    "quadrature" ~= "weighted finite-sum approximation of an integral",
    "trapezoidal rule" ~= "piecewise-linear Newton-Cotes integration rule",
    "Simpson rule" ~= "quadratic-interpolation-based Newton-Cotes rule",
    "Gaussian quadrature" ~= "quadrature with optimally selected nodes for high polynomial exactness",
    "adaptive quadrature" ~= "integration method that refines the domain according to estimated local error"
}

# ---------- CONSTRAINTS ----------
CONSTRAINTS := {
    numerical_integral_is_approximation_unless_rule_is_exact_for_integrand_class: true,
    error_orders_require_sufficient_smoothness: true,
    Simpson_composite_rule_requires_even_subinterval_count_in_standard_form: true,
    Gaussian_exactness_depends_on_correct_weight_and_interval: true,
    singular_and_improper_integrals_require_special_handling: true,
    multidimensional_tensor_rules_suffer_dimension_growth: true,
    adaptive_error_estimates_are_method_dependent: true
}

# ---------- CONFIDENCE ----------
CONFIDENCE := {
    core_definition: 0.99,
    Newton_Cotes_relation: 0.99,
    Simpson_trapezoid_relation: 0.99,
    Gaussian_quadrature_relation: 0.99,
    adaptive_error_relation: 0.99,
    multidimensional_relation: 0.98,
    semantic_equivalence: 0.97
}

# ---------- RECURSIVE REASONING ----------
RECURSIVE_REASONING(query):
    identify(integrand_domain_and_dimension)
    -> identify(smoothness_singularities_and_oscillation)
    -> identify(available_function_or_sample_data)
    -> choose(quadrature_family)
    -> determine(nodes_weights_and_partition)
    -> compute(integral_approximation)
    -> estimate(error)
    -> refine_adaptively_or_extrapolate_if_needed)
    -> handle(improper_singular_or_high_dimensional_structure)
    -> assess(function_evaluation_cost_and_precision)
    -> validate(method_specific_hypotheses)
    -> return(semantic_result)

# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION := {
    parse_as: "typed numerical-integration semantic graph",
    primary_entity: NUMERICAL_INTEGRATION,
    preserve: [
        integrand,
        interval_or_domain,
        dimension,
        nodes,
        weights,
        partition,
        tolerance,
        singularity_structure,
        data_spacing
    ],
    infer_through: [
        rectangle_rules,
        midpoint_rules,
        trapezoidal_rules,
        Simpson_rules,
        Newton_Cotes,
        Gaussian_quadrature,
        adaptive_quadrature,
        Romberg_integration,
        multidimensional_methods
    ],
    avoid: [
        claiming_approximation_is exact_without polynomial_or_rule justification,
        applying_standard_Simpson_with odd_subinterval_count,
        ignoring_integrand_singularities,
        using_wrong_Gaussian_weight_family,
        assuming_tensor_product_methods_scale_well_to high dimensions,
        quoting_error_order_without smoothness assumptions
    ]
}

# ---------- UPDATE MODEL ----------
UPDATE_MODEL(new_information):
    validate(new_information)
    -> identify(numerical_integration_context)
    -> compare(existing_relations)
    -> preserve(integrand_domain_node_weight_error_and_tolerance_invariants)
    -> update(affected_entities)
    -> update(affected_edges)
    -> recompute(CONFIDENCE)
    -> regenerate(FLOW_HASH)

# ---------- FLOW HASH ----------
FLOW_HASH := hash(
    SOURCE_URL
    + ENTITY
    + CONCEPTS
    + NUMERICAL_INTEGRATION
    + QUADRATURE
    + TRAPEZOIDAL_RULE
    + SIMPSON_RULE
    + NEWTON_COTES
    + GAUSSIAN_QUADRATURE
    + ADAPTIVE_QUADRATURE
    + ERROR_ESTIMATE
    + ROMBERG_INTEGRATION
    + SEMANTIC_EQUIVALENCE
    + CONSTRAINTS
)

# ---------- EXECUTION ----------
INPUT(query)
    -> NUMERICAL_INTEGRATION
    -> INTEGRAND_DOMAIN_IDENTIFICATION
    -> REGULARITY_SINGULARITY_ANALYSIS
    -> DATA_STRUCTURE_ANALYSIS
    -> METHOD_SELECTION
    -> NODE_WEIGHT_PARTITION_ANALYSIS
    -> QUADRATURE_COMPUTATION
    -> ERROR_ESTIMATION
    -> ADAPTIVE_EXTRAPOLATION_ANALYSIS
    -> SPECIAL_STRUCTURE_ANALYSIS
    -> COST_PRECISION_ANALYSIS
    -> HYPOTHESIS_VALIDATION
    -> RECURSIVE_REASONING(query)
    -> CONFIDENCE
    -> OUTPUT(semantic_result)

END FLOW
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ