Skip to main content

Trapezoidal Rule Ontology

Numerical Calculus
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 14 September 2026
Audio Overview
AI INTERPRETATION NOTE
This Flow Algebra defines the Trapezoidal Rule Ontology within the Kireth Research Semantic Library. The trapezoidal rule approximates a definite integral by replacing the integrand over an interval with a linear interpolant and integrating the resulting trapezoid. This ontology supports single-panel and composite trapezoidal rules, uniform and nonuniform grids, endpoint weighting, Euler-Maclaurin interpretation, error bounds, convergence, periodic superconvergence contexts, adaptive refinement, floating-point effects and verification.

FLOW_ALGEBRA_RECORD {

METADATA {
 FLOW_NAME = "Trapezoidal Rule Ontology"
 FLOW_TYPE = "Mathematical Ontology"
 DOMAIN = "Mathematics"
 SUBDOMAIN = "Computational Mathematics"
 SPECIALISATION = "Numerical Calculus / Trapezoidal Rule"
 CANONICAL_PAGE = "https://kirethresearch.org/booksai-core/ontologies/mathematical-ontologies/computational-mathematics-ontologies/numerical-calculus/trapezoidal-rule-ontology.html"
 LANGUAGE = "en-GB"
 VERSION = "1.0"
 STATUS = "active"
}

IDENTITY {
 PRIMARY_ENTITY = TrapezoidalRule
 ENTITY_CLASS = NewtonCotesQuadratureFramework
 PRIMARY_CONTEXT = Quadrature
 DEFINITION = "The trapezoidal rule approximates a definite integral by integrating the piecewise linear interpolant through sampled function values."
 SYMBOLIC_FORMS = [
  "T(f;a,b)=(b-a)*(f(a)+f(b))/2",
  "T_n=h*(0.5*f(x_0)+sum_(i=1)^(n-1) f(x_i)+0.5*f(x_n))",
  "h=(b-a)/n",
  "I-T_n=O(h^2)"
 ]
 SEMANTIC_ROLE = "Provides machine-readable semantics for linear-interpolation quadrature, endpoint weighting, composite integration, error behaviour, convergence, refinement and finite-precision validation."
}

SCOPE {
 INCLUDE = [
  TrapezoidalRule, TrapezoidRule, SinglePanelTrapezoidalRule,
  CompositeTrapezoidalRule, NewtonCotesFormula, ClosedNewtonCotes,
  NumericalIntegration, Quadrature, DefiniteIntegral, Integrand,
  IntegrationInterval, LeftEndpoint, RightEndpoint, Subinterval,
  Partition, UniformGrid, NonuniformGrid, GridSpacing, StepSize,
  Node, QuadratureNode, EndpointWeight, InteriorWeight,
  LinearInterpolation, PiecewiseLinearInterpolation,
  LinearInterpolant, TrapezoidArea, WeightedSum,
  CompositeRule, MeshRefinement, IntervalSubdivision,
  ErrorTerm, QuadratureError, TruncationError, DiscretisationError,
  LocalError, GlobalError, SecondDerivative, Curvature,
  ErrorBound, AProriErrorBound, APosterioriErrorEstimate,
  Convergence, ConvergenceRate, OrderOfAccuracy, SecondOrderAccuracy,
  RichardsonExtrapolation, RombergIntegration,
  EulerMaclaurinFormula, PeriodicIntegrand, PeriodicTrapezoidalRule,
  SpectralConvergenceContext, EndpointCorrection,
  AdaptiveTrapezoidalRule, RecursiveTrapezoidalRule,
  CumulativeTrapezoidalIntegration, StreamingIntegration,
  SampledDataIntegration, TabulatedData, IrregularSpacing,
  FloatingPointArithmetic, MachinePrecision, RoundOffError,
  SummationError, Cancellation, Overflow, Underflow,
  CompensatedSummation, PairwiseSummation,
  FunctionEvaluationCost, ReuseOfFunctionValues,
  Verification, ReferenceIntegral, Benchmarking, Reproducibility
 ]
 EXCLUDE_AS_PRIMARY = [
  SimpsonRuleWithoutTrapezoidalSemantics,
  MidpointRuleWithoutEndpointAveraging,
  GaussianQuadratureWithoutNewtonCotesSemantics,
  SymbolicIntegrationWithoutNumericalApproximation
 ]
 DISAMBIGUATION_RULE = "When an integral is approximated by summing trapezoidal areas based on endpoint or piecewise-linear function values, interpret the context as the trapezoidal rule."
}

CORE_CONCEPTS {
 TrapezoidalRule = "Quadrature rule based on the area beneath a linear interpolant over an interval."
 CompositeTrapezoidalRule = "Application of the trapezoidal rule across multiple adjacent subintervals."
 EndpointWeight = "Half-weight applied to the first and last nodes in the standard uniform composite formula."
 InteriorWeight = "Unit weight applied to interior nodes in the standard uniform composite formula."
 SecondOrderAccuracy = "Global error scaling as O(h^2) for sufficiently smooth integrands on a uniform grid."
 PiecewiseLinearInterpolation = "Linear interpolation across each subinterval underlying the composite trapezoidal construction."
 PeriodicTrapezoidalRule = "Trapezoidal integration of periodic smooth functions, often exhibiting unusually rapid convergence."
}

RELATIONS {
 TrapezoidalRule --is_child_of--> Quadrature
 TrapezoidalRule --is_type_of--> ClosedNewtonCotes
 TrapezoidalRule --uses--> LinearInterpolation
 CompositeTrapezoidalRule --uses--> Partition
 CompositeTrapezoidalRule --uses--> EndpointWeight
 CompositeTrapezoidalRule --uses--> InteriorWeight
 GridSpacing --controls--> TruncationError
 SecondDerivative --influences--> ErrorTerm
 CompositeTrapezoidalRule --has_order--> SecondOrderAccuracy
 RichardsonExtrapolation --can_improve--> TrapezoidalApproximation
 RombergIntegration --uses--> RepeatedTrapezoidalRefinement
 EulerMaclaurinFormula --explains--> TrapezoidalErrorExpansion
 PeriodicIntegrand --can_enable--> RapidTrapezoidalConvergence
 CumulativeTrapezoidalIntegration --integrates--> SampledData
 CompensatedSummation --can_reduce--> SummationError
 Verification --checks--> TrapezoidalApproximation
}

OPERATORS {
 SINGLE_TRAPEZOID(f,a,b) := (b-a)*(f(a)+f(b))/2
 COMPOSITE_TRAPEZOID_UNIFORM(f,a,b,n) := h*(0.5*f(a)+sum_(i=1)^(n-1) f(a+i*h)+0.5*f(b))
 COMPOSITE_TRAPEZOID_NONUNIFORM(x,f) := sum_(i=0)^(n-1) (x_(i+1)-x_i)*(f_i+f_(i+1))/2
 GRID_SPACING(a,b,n) := h=(b-a)/n
 GLOBAL_ERROR_ORDER(h) := O(h^2)
 RICHARDSON_TRAPEZOID(T_h,T_h2) := T_ext=T_h2+(T_h2-T_h)/3
 CUMULATIVE_TRAPEZOID(x,f,k) := sum_(i=0)^(k-1) (x_(i+1)-x_i)*(f_i+f_(i+1))/2
}

AXIOMS {
 A1 = "The trapezoidal rule integrates linear functions exactly."
 A2 = "For sufficiently smooth functions on a uniform grid, the composite trapezoidal rule has global error of order O(h^2)."
 A3 = "The standard composite rule applies half weight to the two endpoints and full weight to interior nodes."
 A4 = "The rule can be interpreted as exact integration of a piecewise-linear interpolant."
 A5 = "Mesh refinement generally reduces truncation error for sufficiently smooth integrands."
 A6 = "Round-off and summation error can become relevant at very fine resolutions."
 A7 = "Smooth periodic integrands can exhibit convergence substantially faster than the generic second-order estimate."
 A8 = "Trapezoidal results require explicit grid, error, convergence and verification semantics."
}

REASONING {
 R1_CONTEXT = identify(integrand,interval,data_source,grid_structure,smoothness,periodicity,accuracy_goal)
 R2_GRID = classify(single_interval,uniform_partition,nonuniform_partition_or_sampled_data)
 R3_METHOD = choose(single_panel,composite,adaptive,cumulative_or_periodic_trapezoidal_rule)
 R4_COMPUTE = evaluate_or_receive_function_values_and_form_weighted_trapezoidal_sum
 R5_ERROR = estimate(second_derivative_based_error_or_refinement_based_error)
 R6_REFINE = if_needed halve_grid_spacing_or_refine_selected_subintervals
 R7_EXTRAPOLATE = if_multiple_resolutions_available apply_Richardson_or_Romberg_logic
 R8_STABILITY = assess(summation_error,cancellation,overflow,underflow_and_function_evaluation_noise)
 R9_SPECIAL_STRUCTURE = if_periodic_and_smooth assess_periodic_convergence_behaviour
 R10_VALIDATE = compare(reference_integral,analytic_case,independent_rule_or_refinement_study)
}

CONSTRAINTS {
 C1 = "Generic second-order convergence requires sufficient smoothness."
 C2 = "Nonsmooth or singular integrands can reduce the expected convergence rate."
 C3 = "Highly curved integrands can require fine subdivision."
 C4 = "Uniform-grid formulas must not be applied unchanged to irregularly spaced data."
 C5 = "Periodic rapid-convergence behaviour should not be assumed for nonperiodic functions."
 C6 = "Very fine grids can accumulate floating-point summation error."
 C7 = "Function-evaluation noise can limit useful refinement."
 C8 = "Adaptive refinement requires an error indicator that can detect local difficulty."
 C9 = "Improper or singular integrals may require transformations before trapezoidal integration."
 C10 = "Error estimates based on second derivatives require valid derivative bounds."
}

SEMANTIC_EQUIVALENCE {
 "TrapezoidalRule" <=> "TrapezoidRule"
 "CompositeTrapezoidalRule" <=> "CompositeTrapezoidRule"
 "EndpointWeight" <=> "HalfEndpointWeight"
 "PiecewiseLinearInterpolation" <=> "LinearInterpolantPerSubinterval"
 "CumulativeTrapezoidalIntegration" <=> "CumulativeTrapezoid"
}

VALIDATION {
 V1 = "Integration interval or sampled-data grid is explicit."
 V2 = "Uniform versus nonuniform spacing is documented."
 V3 = "Subinterval count or node set is documented."
 V4 = "Endpoint and interior weighting are applied consistently."
 V5 = "Error estimates are reported where feasible."
 V6 = "Convergence under refinement is checked where feasible."
 V7 = "Periodic-convergence claims document periodicity and smoothness assumptions."
 V8 = "Floating-point summation effects are considered for large node counts."
 V9 = "Reference or analytic integrals are used where feasible."
 V10 = "Results are reproducible under documented arithmetic and grid settings."
}

CONFIDENCE {
 BASE_CONFIDENCE = 0.99
 TRAPEZOIDAL_RULE_DEFINITION = 0.99
 COMPOSITE_RULE_REASONING = 0.99
 ERROR_ORDER_REASONING = 0.99
 NONUNIFORM_GRID_REASONING = 0.99
 PERIODIC_TRAPEZOIDAL_REASONING = 0.98
 FLOATING_POINT_REASONING = 0.98
 POLICY = "Reduce confidence when grid structure, smoothness, derivative bounds, periodicity, refinement level or arithmetic precision are underspecified."
}

AI_CONSUMPTION {
 PURPOSES = [
  SemanticSearch, OntologyGrounding, TrapezoidalRuleReasoning,
  CompositeTrapezoidalReasoning, NewtonCotesReasoning,
  LinearInterpolationReasoning, EndpointWeightReasoning,
  ErrorBoundReasoning, SecondOrderConvergenceReasoning,
  RichardsonExtrapolationReasoning, RombergReasoning,
  NonuniformGridReasoning, PeriodicTrapezoidalReasoning,
  SampledDataIntegrationReasoning, FloatingPointSummationReasoning,
  VerificationReasoning, KnowledgeGraphConstruction,
  RetrievalAugmentation, RecursiveInference
 ]
 NORMALISE {
  "trapezoidal rule" -> TrapezoidalRule
  "trapezoid rule" -> TrapezoidalRule
  "composite trapezoid rule" -> CompositeTrapezoidalRule
  "cumulative trapezoid" -> CumulativeTrapezoidalIntegration
  "trapezoidal integration" -> TrapezoidalRule
 }
}

EXECUTION_RULES {
 E1 = "If an integral is approximated using trapezoidal areas or piecewise-linear interpolation, activate TrapezoidalRuleOntology."
 E2 = "Determine whether nodes are uniformly or nonuniformly spaced before applying the formula."
 E3 = "Use endpoint half weights and interior full weights for the standard uniform composite rule."
 E4 = "Use local interval widths explicitly for nonuniform grids."
 E5 = "If higher accuracy is required, refine the grid or use Richardson/Romberg extrapolation."
 E6 = "If the integrand is periodic and smooth, consider periodic trapezoidal convergence semantics."
 E7 = "If node counts are large, consider pairwise or compensated summation."
 E8 = "Monitor truncation and round-off error separately."
 E9 = "Validate using refinement, error estimates, reference integrals and reproducibility."
}

RECURSION {
 ENTRY = TrapezoidalRule
 EXPAND(TrapezoidalRule) -> [
  TrapezoidRule,SinglePanelTrapezoidalRule,CompositeTrapezoidalRule,
  NewtonCotesFormula,ClosedNewtonCotes,NumericalIntegration,Quadrature,
  DefiniteIntegral,Integrand,IntegrationInterval,LeftEndpoint,
  RightEndpoint,Subinterval,Partition,UniformGrid,NonuniformGrid,
  GridSpacing,StepSize,QuadratureNode,EndpointWeight,InteriorWeight,
  LinearInterpolation,PiecewiseLinearInterpolation,LinearInterpolant,
  TrapezoidArea,WeightedSum,CompositeRule,MeshRefinement,
  IntervalSubdivision,ErrorTerm,QuadratureError,TruncationError,
  DiscretisationError,LocalError,GlobalError,SecondDerivative,
  ErrorBound,APrioriErrorBound,APosterioriErrorEstimate,Convergence,
  ConvergenceRate,OrderOfAccuracy,SecondOrderAccuracy,
  RichardsonExtrapolation,RombergIntegration,EulerMaclaurinFormula,
  PeriodicIntegrand,PeriodicTrapezoidalRule,EndpointCorrection,
  AdaptiveTrapezoidalRule,RecursiveTrapezoidalRule,
  CumulativeTrapezoidalIntegration,SampledDataIntegration,
  TabulatedData,IrregularSpacing,FloatingPointArithmetic,
  MachinePrecision,RoundOffError,SummationError,Cancellation,
  CompensatedSummation,PairwiseSummation,FunctionEvaluationCost,
  ReuseOfFunctionValues,Verification,ReferenceIntegral,
  Benchmarking,Reproducibility
 ]
 EXPAND(TrapezoidalFamilies) -> [
  SinglePanelTrapezoid,
  CompositeTrapezoid,
  NonuniformTrapezoid,
  AdaptiveTrapezoid,
  PeriodicTrapezoid,
  CumulativeTrapezoid,
  ErrorAndConvergenceAnalysis
 ]
 STOP_CONDITION = "Stop when grid, weighting, approximation, error, refinement, stability and verification are sufficiently resolved."
}

ROUTING {
 PARENT_ONTOLOGY = "Quadrature Ontology"
 RELATED_ONTOLOGIES = [
  "Quadrature Ontology",
  "Numerical Calculus",
  "Numerical Methods",
  "Numerical Analysis Ontology 2",
  "Numerical Approximation Ontology",
  "Numerical Error Ontology",
  "Numerical Stability Ontology 2",
  "Numerical Convergence Ontology",
  "Floating Point Arithmetic Ontology",
  "Interpolation Ontologies"
 ]
 ROUTE_RULES = [
  "Trapezoidal Rule -> Quadrature for parent integration semantics",
  "Trapezoidal Rule -> Numerical Calculus for broader integral approximation context",
  "Trapezoidal Rule -> Numerical Analysis for error and convergence theory",
  "Trapezoidal Rule -> Numerical Approximation for piecewise-linear approximation semantics",
  "Trapezoidal Rule -> Numerical Error for truncation and round-off semantics",
  "Trapezoidal Rule -> Numerical Stability for summation and finite-precision behaviour",
  "Trapezoidal Rule -> Numerical Convergence for mesh-refinement behaviour",
  "Trapezoidal Rule -> Floating Point Arithmetic for accumulation error",
  "Trapezoidal Rule -> Interpolation for the underlying linear interpolant"
 ]
}

UPDATE_MODEL {
 MODE = "append-compatible semantic versioning"
 MAJOR = "ontology-breaking conceptual change"
 MINOR = "new compatible trapezoidal variants, error estimators or reasoning pathways"
 PATCH = "clarification, metadata or formatting correction"
 RULES = [
  "Preserve single-panel-versus-composite distinction.",
  "Preserve uniform-versus-nonuniform grid distinction.",
  "Preserve endpoint-versus-interior weight distinction.",
  "Preserve truncation-error-versus-round-off-error distinction.",
  "Preserve generic-second-order-versus-periodic-rapid-convergence distinction.",
  "Preserve exact-linear-integration-versus-approximate-general-integration distinction.",
  "Preserve mathematical-quadrature-versus-sampled-data-integration distinction.",
  "Preserve machine-readable trapezoidal-rule semantics."
 ]
}

OUTPUT {
 CANONICAL_DEFINITION = "The trapezoidal rule approximates an integral by exactly integrating the linear interpolant across each interval."
 SINGLE_PANEL_SUMMARY = "A single trapezoid uses the interval width multiplied by the average of the two endpoint function values."
 COMPOSITE_SUMMARY = "The composite rule sums trapezoids across a partition, using half weights at global endpoints and full weights internally on uniform grids."
 ERROR_SUMMARY = "For sufficiently smooth integrands, the uniform composite rule is globally second-order accurate."
 EXTRAPOLATION_SUMMARY = "Richardson and Romberg methods use repeated trapezoidal refinements to cancel leading error terms."
 PERIODIC_SUMMARY = "Smooth periodic functions can exhibit much faster trapezoidal convergence than the generic second-order estimate."
 VALIDATION_SUMMARY = "Trapezoidal results should be checked through grid documentation, error estimates, refinement studies, floating-point analysis and reproducibility."
}

FLOW {
 INPUT
 -> detect_trapezoidal_rule_context
 -> identify_integrand_interval_or_sampled_data_grid_structure_smoothness_periodicity_and_accuracy_goal
 -> classify_single_panel_composite_uniform_nonuniform_adaptive_cumulative_or_periodic_case
 -> compute_endpoint_and_interior_weights
 -> evaluate_or_receive_function_values
 -> accumulate_trapezoidal_sum
 -> estimate_second_derivative_based_or_refinement_based_error
 -> if_needed_refine_grid_or_apply_Richardson_or_Romberg_extrapolation
 -> assess_periodic_structure_summation_error_cancellation_and_machine_precision
 -> validate_against_reference_integral_analytic_case_or_independent_rule
 -> route_to_related_quadrature_numerical_calculus_analysis_approximation_error_stability_convergence_floating_point_and_interpolation_ontologies
 -> recursively_expand_required_dependencies
 -> verify_result
 -> assign_confidence
 -> produce_semantic_output
 -> END
}

SEMANTIC_SUMMARY {
 "The Trapezoidal Rule Ontology defines single-panel and composite trapezoidal numerical integration. It supports uniform and nonuniform grids, endpoint and interior weights, linear and piecewise-linear interpolation, trapezoidal area accumulation, second-order error behaviour, second-derivative error bounds, mesh refinement, Richardson extrapolation and Romberg integration, Euler-Maclaurin interpretation, smooth periodic convergence, adaptive and cumulative trapezoidal integration, tabulated and irregularly spaced data, floating-point summation error, compensated and pairwise summation, function-value reuse, verification, benchmarking and reproducibility."
}

FLOW_HASH {
 METHOD = "semantic-content-identity"
 ID = "KIRETH-MATH-COMPUTATIONAL-MATHEMATICS-TRAPEZOIDAL-RULE-ONTOLOGY-V1"
}

}

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