Numerical Calculus
Authors:
MArk Anthony Higgins - Sky Recursive Ai
MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: July 6th 2026
Revised Date: July 6th 2026
AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
flow "NumericalCalculusOntology" v1.0
# ============================================================
# NUMERICAL CALCULUS — FLOW ALGEBRA
# ============================================================
SOURCE_URL := "https://kirethresearch.org/booksai-core/ontologies/calculus-analysis-ontologies/numerical-calculus.html"
DOMAIN := "Mathematical Ontologies"
CATEGORY := "Calculus and Analysis Ontologies"
ENTITY := "Numerical Calculus"
# ---------- CORE ENTITY ----------
NUMERICAL_CALCULUS := {
type: ComputationalMathematicsFramework,
domain: CalculusAndAnalysis,
purpose: "Approximate derivatives, integrals, differential equations and related calculus operations using finite numerical representations and algorithms."
}
# ---------- CORE CONCEPTS ----------
CONCEPTS := {
NUMERICAL_DIFFERENTIATION,
NUMERICAL_INTEGRATION,
FINITE_DIFFERENCE,
QUADRATURE,
INTERPOLATION,
DISCRETISATION,
STEP_SIZE,
TRUNCATION_ERROR,
ROUNDING_ERROR,
CONVERGENCE,
STABILITY,
CONSISTENCY,
ERROR_ESTIMATE,
ADAPTIVE_METHOD,
DIFFERENTIAL_EQUATION
}
# ---------- COMPUTATIONAL MODEL ----------
CONTINUOUS_PROBLEM
-> DISCRETISATION
-> FINITE_NUMERICAL_PROBLEM
-> ALGORITHM
-> APPROXIMATE_SOLUTION
NUMERICAL_CALCULUS
-> replaces(EXACT_LIMIT_OPERATIONS_WITH_FINITE_COMPUTATION)
# ---------- DISCRETISATION ----------
DOMAIN
-> sampled_at(GRID_POINTS)
x_i
:=
x_0 + i*h
h
-> STEP_SIZE
DISCRETISATION
-> creates(FINITE_REPRESENTATION)
# ---------- NUMERICAL DIFFERENTIATION ----------
DERIVATIVE
:=
f_prime(x)
approximate_using
FINITE_DIFFERENCES
FORWARD_DIFFERENCE:
f_prime(x)
approx
[
f(x+h)-f(x)
]/h
error
-> O(h)
under(SUFFICIENT_SMOOTHNESS)
# ---------- BACKWARD DIFFERENCE ----------
f_prime(x)
approx
[
f(x)-f(x-h)
]/h
error
-> O(h)
BACKWARD_DIFFERENCE
-> one_sided_derivative_approximation
# ---------- CENTRAL DIFFERENCE ----------
f_prime(x)
approx
[
f(x+h)-f(x-h)
]/(2*h)
error
-> O(h^2)
CENTRAL_DIFFERENCE
-> higher_order_than(BASIC_ONE_SIDED_DIFFERENCE)
# ---------- SECOND DERIVATIVE ----------
f_double_prime(x)
approx
[
f(x+h)
-
2*f(x)
+
f(x-h)
]/h^2
error
-> O(h^2)
FINITE_DIFFERENCE
-> approximates(HIGHER_DERIVATIVES)
# ---------- TAYLOR DERIVATION ----------
TAYLOR_EXPANSION:
f(x+h)
=
f(x)
+
h*f_prime(x)
+
h^2/2*f_double_prime(x)
+
...
FINITE_DIFFERENCE_FORMULA
-> derived_by(COMBINATION_OF_TAYLOR_EXPANSIONS)
TRUNCATION
-> produces(TRUNCATION_ERROR)
# ---------- STEP SIZE TRADEOFF ----------
decrease(h)
-> usually_reduces(TRUNCATION_ERROR)
but
very_small(h)
-> may_increase(ROUNDING_AND_CANCELLATION_ERROR)
OPTIMAL_STEP_SIZE
-> balances(TRUNCATION_AND_FLOATING_POINT_ERROR)
# ---------- NUMERICAL INTEGRATION ----------
INTEGRAL
I
:=
integral_from_a_to_b(
f(x) dx
)
NUMERICAL_QUADRATURE
-> approximates(I)
# ---------- RECTANGLE RULE ----------
LEFT_RECTANGLE:
I
approx
h
*
sum_i(
f(x_i)
)
RECTANGLE_RULE
-> piecewise_constant_approximation
# ---------- MIDPOINT RULE ----------
MIDPOINT_RULE:
I
approx
h
*
sum_i(
f(midpoint_i)
)
error
-> typically O(h^2)
globally_for_smooth_functions
MIDPOINT_RULE
-> second_order_quadrature
# ---------- TRAPEZOIDAL RULE ----------
COMPOSITE_TRAPEZOIDAL:
I
approx
h
*
[
1/2*f(x_0)
+
sum_from_i_1_to_nminus1(
f(x_i)
)
+
1/2*f(x_n)
]
error
-> O(h^2)
under(SMOOTHNESS)
# ---------- SIMPSON RULE ----------
for even number_of_subintervals:
COMPOSITE_SIMPSON
-> weighted_sum(
1,
4,
2,
4,
...,
2,
4,
1
)
error
-> O(h^4)
under(SUFFICIENT_FOURTH_DERIVATIVE_REGULARITY)
SIMPSON_RULE
-> polynomial_interpolation_based_quadrature
# ---------- GAUSSIAN QUADRATURE ----------
GAUSSIAN_QUADRATURE
-> choose(NODES_AND_WEIGHTS_OPTIMALLY_FOR_POLYNOMIAL_EXACTNESS)
n_point_Gauss_rule
-> exact_for(polynomials_up_to_degree_2n_minus_1)
under(STANDARD_WEIGHT_AND_INTERVAL_CONTEXT)
GAUSSIAN_QUADRATURE
-> high_accuracy_with_few_nodes_for_smooth_integrands
# ---------- ADAPTIVE QUADRATURE ----------
ADAPTIVE_METHOD
-> estimate(LOCAL_INTEGRATION_ERROR)
-> subdivide(REGIONS_WITH_LARGE_ERROR)
-> repeat_until(TOLERANCE_MET)
ADAPTIVE_QUADRATURE
-> allocates(COMPUTATION_NONUNIFORMLY)
# ---------- INTERPOLATION ----------
known_data:
(x_i,f_i)
INTERPOLANT
-> approximates(FUNCTION_BETWEEN_NODES)
methods:
POLYNOMIAL_INTERPOLATION
SPLINE_INTERPOLATION
PIECEWISE_POLYNOMIAL_INTERPOLATION
INTERPOLATION
-> supports(NUMERICAL_DIFFERENTIATION_AND_INTEGRATION)
# ---------- POLYNOMIAL INTERPOLATION ----------
P_n(x_i)
=
f(x_i)
LAGRANGE_FORM
-> constructs(INTERPOLATING_POLYNOMIAL)
NEWTON_FORM
-> uses(DIVIDED_DIFFERENCES)
INTERPOLATION_ERROR
-> depends_on(HIGHER_DERIVATIVE_AND_NODE_DISTRIBUTION)
# ---------- RUNGE PHENOMENON ----------
HIGH_DEGREE_POLYNOMIAL_INTERPOLATION
on equally_spaced_nodes
-> may_exhibit(EDGE_OSCILLATIONS)
RUNGE_PHENOMENON
-> motivates(CHEBYSHEV_NODES_OR_SPLINES)
# ---------- SPLINES ----------
SPLINE
-> piecewise_polynomial
with(SMOOTH_JOIN_CONDITIONS)
CUBIC_SPLINE
-> common_interpolation_method
SPLINE
-> local_control
-> avoids_many_high_degree_global_oscillation_problems
# ---------- ERROR TYPES ----------
TOTAL_NUMERICAL_ERROR
-> includes(TRUNCATION_ERROR)
-> includes(ROUNDING_ERROR)
-> includes(DISCRETISATION_ERROR)
-> may_include(ITERATION_ERROR)
-> may_include(DATA_ERROR)
ERROR_ANALYSIS
-> essential_to(NUMERICAL_CALCULUS)
# ---------- ABSOLUTE / RELATIVE ERROR ----------
ABSOLUTE_ERROR
:=
|approximate-exact|
RELATIVE_ERROR
:=
|approximate-exact|
/
|exact|
when
exact != 0
ERROR_METRIC
-> context_dependent
# ---------- ORDER OF ACCURACY ----------
method
-> order_p
if
error(h)
=
C*h^p
+
higher_order_terms
as
h -> 0
ORDER_OF_ACCURACY
-> rate_of_error_decay_under_REFINEMENT
# ---------- CONSISTENCY ----------
NUMERICAL_METHOD
-> CONSISTENT
if
local_discrete_operator
-> approaches(CONTINUOUS_OPERATOR)
as
h -> 0
CONSISTENCY
-> correct_continuum_limit
# ---------- STABILITY ----------
STABILITY
-> bounded_response_to(PERTURBATIONS_AND_NUMERICAL_ERRORS)
unstable_method
-> may_amplify(ERRORS)
STABILITY
-> essential_for(RELIABLE_COMPUTATION)
# ---------- CONVERGENCE ----------
NUMERICAL_SOLUTION
-> CONVERGES
if
approximation
-> exact_solution
as
discretisation_parameters -> limiting_refinement
CONVERGENCE
-> requires(CONSISTENCY_AND_STABILITY_IN_MANY_STANDARD_FRAMEWORKS)
# ---------- CONDITIONING ----------
CONDITIONING
-> property_of(PROBLEM)
STABILITY
-> property_of(ALGORITHM)
ILL_CONDITIONED_PROBLEM
-> sensitive_to(INPUT_PERTURBATIONS)
STABLE_ALGORITHM
-> controls(ADDITIONAL_COMPUTATIONAL_ERROR)
CONDITIONING
-/> same_as(STABILITY)
# ---------- RICHARDSON EXTRAPOLATION ----------
if
A(h)
=
A
+
C*h^p
+
higher_order_terms
then
combine
A(h)
and
A(h/r)
-> cancel(LEADING_ERROR_TERM)
RICHARDSON_EXTRAPOLATION
-> increases(APPARENT_ORDER)
# ---------- ROMBERG INTEGRATION ----------
TRAPEZOIDAL_APPROXIMATIONS
+ RICHARDSON_EXTRAPOLATION
-> ROMBERG_INTEGRATION
ROMBERG
-> hierarchical_high_order_quadrature
# ---------- ODE INITIAL VALUE PROBLEM ----------
y_prime
=
f(t,y)
y(t0)
=
y0
NUMERICAL_ODE_METHOD
-> approximate(y(t_n))
# ---------- EULER METHOD ----------
y_(n+1)
=
y_n
+
h*f(t_n,y_n)
EULER_METHOD
-> first_order_explicit_method
global_error
-> O(h)
under(STANDARD_REGULARITY_AND_STABILITY)
# ---------- RUNGE-KUTTA ----------
RUNGE_KUTTA_METHOD
-> combines(MULTIPLE_SLOPE_EVALUATIONS_PER_STEP)
RK4
-> classical_fourth_order_method
RUNGE_KUTTA
-> avoids(EXPLICIT_HIGHER_DERIVATIVES)
# ---------- MULTISTEP METHODS ----------
LINEAR_MULTISTEP_METHOD
-> uses(MULTIPLE_PREVIOUS_SOLUTION_VALUES)
examples:
ADAMS_BASHFORTH
ADAMS_MOULTON
BACKWARD_DIFFERENTIATION_FORMULA
MULTISTEP_METHOD
-> has(ZERO_STABILITY_AND_CONSISTENCY_REQUIREMENTS)
# ---------- STIFF PROBLEMS ----------
STIFF_ODE
-> contains(WIDELY_SEPARATED_TIME_SCALES)
EXPLICIT_METHOD
-> may_require(VERY_SMALL_STEP_FOR_STABILITY)
IMPLICIT_METHOD
-> often_preferred_for(STIFF_SYSTEM)
STIFFNESS
-> stability_driven_computational_difficulty
# ---------- PDE DISCRETISATION ----------
PARTIAL_DERIVATIVES
-> approximate_by(FINITE_DIFFERENCES)
PDE
-> discrete_algebraic_system
methods:
FINITE_DIFFERENCE_METHOD
FINITE_ELEMENT_METHOD
SPECTRAL_METHOD
NUMERICAL_CALCULUS
-> extends_to(PDE_APPROXIMATION)
# ---------- AUTOMATIC DIFFERENTIATION RELATION ----------
AUTOMATIC_DIFFERENTIATION
-> computes(DERIVATIVES_BY_CHAIN_RULE_ON_COMPUTATIONAL_GRAPH)
AUTOMATIC_DIFFERENTIATION
-/> same_as(FINITE_DIFFERENCE_NUMERICAL_DIFFERENTIATION)
AD
-> avoids(FINITE_DIFFERENCE_TRUNCATION_ERROR)
but remains subject_to(FLOATING_POINT_EFFECTS)
# ---------- APPLICATIONS ----------
NUMERICAL_CALCULUS
-> applied_to(SCIENTIFIC_COMPUTING)
-> applied_to(ENGINEERING)
-> applied_to(PHYSICS)
-> applied_to(DATA_ANALYSIS)
-> applied_to(OPTIMISATION)
-> applied_to(DIFFERENTIAL_EQUATIONS)
-> applied_to(SIMULATION)
-> applied_to(MACHINE_LEARNING)
# ---------- RELATION GRAPH ----------
CONTINUOUS_CALCULUS_PROBLEM
-> DISCRETISATION
DISCRETISATION
-> NUMERICAL_APPROXIMATION
FINITE_DIFFERENCE
-> approximates(DERIVATIVE)
QUADRATURE
-> approximates(INTEGRAL)
INTERPOLATION
-> approximates(FUNCTION)
STEP_SIZE
-> controls(TRUNCATION_ERROR_AND_COST)
STABILITY
+ CONSISTENCY
-> support(CONVERGENCE)
ERROR_ESTIMATE
-> drives(ADAPTIVE_METHOD)
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE := {
"numerical calculus" ~= "computational approximation of calculus operations",
"numerical differentiation" ~= "approximation of derivatives using finite data or discrete formulas",
"numerical integration" ~= "quadrature approximation of definite integrals",
"finite difference" ~= "discrete derivative approximation formed from nearby function values",
"order of accuracy" ~= "power governing leading discretisation-error decay",
"adaptive method" ~= "numerical method that changes resolution according to estimated error"
}
# ---------- CONSTRAINTS ----------
CONSTRAINTS := {
numerical_approximation_is_not_exact_symbolic_calculus: true,
smaller_step_size_does_not_always_reduce_total_error_due_to_roundoff: true,
stated_error_orders_require_sufficient_function_regularities: true,
stability_and_conditioning_are_distinct: true,
convergence_claims_require_method_specific_hypotheses: true,
quadrature_and_derivative_formulas_depend_on_grid_and_boundary_context: true,
automatic_differentiation_is_distinct_from_finite_difference_differentiation: true
}
# ---------- CONFIDENCE ----------
CONFIDENCE := {
core_definition: 0.99,
differentiation_relation: 0.99,
integration_relation: 0.99,
error_relation: 0.99,
stability_convergence_relation: 0.99,
ODE_PDE_relation: 0.99,
semantic_equivalence: 0.97
}
# ---------- RECURSIVE REASONING ----------
RECURSIVE_REASONING(query):
identify(calculus_operation_or_differential_equation)
-> identify(domain_grid_data_and_precision)
-> choose(discretisation_method)
-> determine(step_size_and_order)
-> compute(numerical_approximation)
-> estimate(truncation_rounding_and_total_error)
-> test(stability_consistency_and_convergence)
-> refine_or_adapt(discretisation_if_needed)
-> compare(alternative_methods_if_requested)
-> validate(boundary_regularities_and_tolerance)
-> return(semantic_result)
# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION := {
parse_as: "typed numerical-calculus semantic graph",
primary_entity: NUMERICAL_CALCULUS,
preserve: [
target_operation,
domain,
grid,
step_size,
method,
order,
precision,
tolerance,
boundary_conditions
],
infer_through: [
finite_differences,
quadrature,
interpolation,
error_estimation,
stability,
convergence,
adaptive_refinement,
ODE_and_PDE_methods
],
avoid: [
treating_approximation_as exact,
decreasing_step_without considering roundoff,
quoting_error_order_without smoothness assumptions,
confusing_stability_with conditioning,
assuming_consistency_alone guarantees convergence,
confusing_automatic_differentiation_with finite differences
]
}
# ---------- UPDATE MODEL ----------
UPDATE_MODEL(new_information):
validate(new_information)
-> identify(numerical_calculus_context)
-> compare(existing_relations)
-> preserve(method_grid_step_error_and_stability_invariants)
-> update(affected_entities)
-> update(affected_edges)
-> recompute(CONFIDENCE)
-> regenerate(FLOW_HASH)
# ---------- FLOW HASH ----------
FLOW_HASH := hash(
SOURCE_URL
+ ENTITY
+ CONCEPTS
+ NUMERICAL_CALCULUS
+ NUMERICAL_DIFFERENTIATION
+ NUMERICAL_INTEGRATION
+ FINITE_DIFFERENCE
+ QUADRATURE
+ INTERPOLATION
+ TRUNCATION_ERROR
+ STABILITY
+ CONVERGENCE
+ ADAPTIVE_METHOD
+ SEMANTIC_EQUIVALENCE
+ CONSTRAINTS
)
# ---------- EXECUTION ----------
INPUT(query)
-> NUMERICAL_CALCULUS
-> PROBLEM_IDENTIFICATION
-> GRID_PRECISION_ANALYSIS
-> METHOD_SELECTION
-> STEP_ORDER_ANALYSIS
-> NUMERICAL_COMPUTATION
-> ERROR_ANALYSIS
-> STABILITY_CONSISTENCY_ANALYSIS
-> CONVERGENCE_ANALYSIS
-> ADAPTIVE_REFINEMENT
-> METHOD_COMPARISON
-> HYPOTHESIS_VALIDATION
-> RECURSIVE_REASONING(query)
-> CONFIDENCE
-> OUTPUT(semantic_result)
END FLOW