LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
numerical_integration.hpp
浏览该文件的文档.
1/**
2 * @file numerical_integration.hpp
3 * @brief 数值积分算法:辛普森法则和高斯求积(符号-数值混合桥接).
4 */
5#pragma once
7#include "symbolic.hpp"
8#include <memory>
9#include <string>
10
11namespace LMCAS {
12
14 double value = 0.0;
15 double estimated_error = 0.0;
16};
17
18/**
19 * @brief Checked composite Simpson integration.
20 *
21 * Endpoints and samples are evaluated through evaluate_numeric(); invalid
22 * arguments, odd subinterval counts, unbound variables, domain errors,
23 * cancellation, and budget exhaustion are reported explicitly. Equal finite
24 * endpoints return exact zero before reserving any integrand-sampling budget.
25 * Other finite endpoints are mapped through normalized coordinates, so their
26 * mathematical span need not itself be representable as a double when the
27 * result is finite.
28 * The returned value is the step-doubling Richardson extrapolation
29 * `S(2n) + (S(2n) - S(n)) / 15`; estimated_error is the corresponding
30 * `abs(S(2n) - S(n)) / 15` estimate, not a certified bound.
31 */
33 const std::shared_ptr<SymbolicExpr>& f,
34 const std::string& var,
35 const std::shared_ptr<SymbolicExpr>& a,
36 const std::shared_ptr<SymbolicExpr>& b,
38 int n = 100
39);
40
42 const std::shared_ptr<SymbolicExpr>& f,
43 const std::string& var,
44 const std::shared_ptr<SymbolicExpr>& a,
45 const std::shared_ptr<SymbolicExpr>& b,
46 int n = 100
47);
48/**
49 * @brief Checked Gauss-Legendre integration for orders 1 through 20.
50 *
51 * Every supported order is evaluated by LMMC's Gauss-Legendre implementation.
52 * Equal finite endpoints return exact zero before reserving quadrature samples.
53 * Other finite extreme endpoints use an overflow-safe affine map to [-1,1].
54 * The returned estimated_error is the difference from an adjacent-order rule,
55 * not a certified bound.
56 */
58 const std::shared_ptr<SymbolicExpr>& f,
59 const std::string& var,
60 const std::shared_ptr<SymbolicExpr>& a,
61 const std::shared_ptr<SymbolicExpr>& b,
63 int n = 5
64);
65
67 const std::shared_ptr<SymbolicExpr>& f,
68 const std::string& var,
69 const std::shared_ptr<SymbolicExpr>& a,
70 const std::shared_ptr<SymbolicExpr>& b,
71 int n = 5
72);
73
74/**
75 * @brief Checked adaptive Simpson integration.
76 *
77 * All endpoint and integrand evaluation goes through evaluate_numeric(); missing
78 * variables, domain errors, cancellation, and budget exhaustion are represented
79 * by CasError in the Result channel. Finite extreme endpoints are bisected and
80 * scaled through overflow-safe center and half-length formulas.
81 * The returned estimated_error is an absolute estimate, not a certified bound.
82 */
84 const std::shared_ptr<SymbolicExpr>& f,
85 const std::string& var,
86 const std::shared_ptr<SymbolicExpr>& a,
87 const std::shared_ptr<SymbolicExpr>& b,
89 double tol = 1e-10,
90 int max_depth = 50
91);
92
94 const std::shared_ptr<SymbolicExpr>& f,
95 const std::string& var,
96 const std::shared_ptr<SymbolicExpr>& a,
97 const std::shared_ptr<SymbolicExpr>& b,
98 double tol = 1e-10,
99 int max_depth = 50
100);
101
102} // namespace LMCAS
#define LMCAS_API
ExprResult e()
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
const MultiPoly & b
__attribute__((visibility("default"))) VectorCalculusExprResult curve_integral_scalar_checked(const std __attribute__((visibility("default"))) VectorCalculusExprResult curve_integral_scalar_checked(const std __attribute__((visibility("default"))) std const VectorField const std::string const std::shared_ptr< SymbolicExpr > & a
Result< QuadratureEstimate > quadrature_simpson_numeric(const std::shared_ptr< SymbolicExpr > &function, const std::string &variable, const std::shared_ptr< SymbolicExpr > &lower, const std::shared_ptr< SymbolicExpr > &upper, ComputationContext &context, int subdivisions)
Result< QuadratureEstimate > adaptive_simpson_numeric(const std::shared_ptr< SymbolicExpr > &function, const std::string &variable, const std::shared_ptr< SymbolicExpr > &lower, const std::shared_ptr< SymbolicExpr > &upper, ComputationContext &context, double tolerance, int max_depth)
Result< QuadratureEstimate > quadrature_gaussian_numeric(const std::shared_ptr< SymbolicExpr > &function, const std::string &variable, const std::shared_ptr< SymbolicExpr > &lower, const std::shared_ptr< SymbolicExpr > &upper, ComputationContext &context, int order)
符号表达式主类 SymbolicExpr 及其工厂方法,运算接口.