13 const std::string&
t,
const std::shared_ptr<SymbolicExpr>&
a,
14 const std::shared_ptr<SymbolicExpr>&
b,
18 context.limits().max_ast_nodes,
"curve_integral_scalar");
19 const std::string operation =
"curve_integral_scalar";
35 }
catch (
const std::bad_alloc&) {
37 "curve integral allocation failed",
39 }
catch (
const std::length_error& error) {
41 }
catch (
const std::exception&
e) {
48 const std::string&
t,
const std::shared_ptr<SymbolicExpr>&
a,
49 const std::shared_ptr<SymbolicExpr>&
b)
57 const std::string&
t,
const std::shared_ptr<SymbolicExpr>&
a,
58 const std::shared_ptr<SymbolicExpr>&
b)
62 (
context).limits().max_ast_nodes,
"transform");
64 throw std::invalid_argument(
"curve_integral_scalar: f must not be null");
67 throw std::invalid_argument(
"curve_integral_scalar: parametrization must not be empty");
70 throw std::invalid_argument(
"curve_integral_scalar: bounds must not be null");
77 for (
size_t i = 0; i <
dim; ++i) {
82 std::shared_ptr<SymbolicExpr> speed_sq =
nullptr;
83 for (
size_t i = 0; i <
dim; ++i) {
89 auto sq = SymbolicExpr::power(deriv, SymbolicExpr::number(2));
94 speed_sq = SymbolicExpr::add(speed_sq, sq);
100 return SymbolicExpr::number(0);
103 auto speed = SymbolicExpr::sqrt(speed_sq);
106 auto integrand = SymbolicExpr::multiply(f_composed, speed);
116 const std::string&
t,
const std::shared_ptr<SymbolicExpr>&
a,
117 const std::shared_ptr<SymbolicExpr>&
b,
121 context.limits().max_ast_nodes,
"curve_integral_vector");
122 const std::string operation =
"curve_integral_vector";
140 }
catch (
const std::bad_alloc&) {
142 "curve integral allocation failed",
144 }
catch (
const std::length_error& error) {
146 }
catch (
const std::exception&
e) {
153 const std::string&
t,
const std::shared_ptr<SymbolicExpr>&
a,
154 const std::shared_ptr<SymbolicExpr>&
b)
162 const std::string&
t,
const std::shared_ptr<SymbolicExpr>&
a,
163 const std::shared_ptr<SymbolicExpr>&
b)
167 (
context).limits().max_ast_nodes,
"transform");
169 throw std::invalid_argument(
"curve_integral_vector: F must not be empty");
172 throw std::invalid_argument(
"curve_integral_vector: parametrization must not be empty");
175 throw std::invalid_argument(
176 "curve_integral_vector: F and parametrization must have the same dimension");
179 throw std::invalid_argument(
"curve_integral_vector: bounds must not be null");
185 std::shared_ptr<SymbolicExpr>
dot_product =
nullptr;
186 for (
size_t i = 0; i <
dim; ++i) {
191 auto Fi_composed = F[i];
192 for (
size_t j = 0; j <
dim; ++j) {
203 auto term = SymbolicExpr::multiply(Fi_composed, ri_prime);
215 return SymbolicExpr::number(0);
static Result failure(CasErrc code, std::string message, std::string operation={})
Symbolic integration APIs.
SymbolicNodePtr differentiate_node(const SymbolicNodePtr &node, const std::string &variable, RewriteBudget &budget, const FactsQuery &facts, Domain domain)
std::shared_ptr<::LMCAS::SymbolicExpr > make_expression_ptr(SymbolicNodePtr root)
const SymbolicNodePtr & node(const ::LMCAS::SymbolicExpr &expression) noexcept
SymbolicNodePtr normalize_node(const SymbolicNodePtr &node, RewriteBudget &budget, const FactsQuery &facts, Domain domain)
SymbolicNodePtr substitute_node(const SymbolicNodePtr &node, const std::string &variable, const SymbolicNodePtr &replacement, RewriteBudget &budget, const FactsQuery &facts, Domain domain)
Result< void > vector_calculus_validate_curve_scalar_inputs(const std::shared_ptr< SymbolicExpr > &f, const VectorField ¶metrization, const std::string &t, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, ComputationContext &context, const std::string &operation)
std::vector< std::string > vector_calculus_coord_vars(std::size_t dimension)
VectorCalculusExprResult curve_integral_scalar_strict(const std::shared_ptr< SymbolicExpr > &function, const VectorField ¶metrization, const std::string ¶meter, const std::shared_ptr< SymbolicExpr > &lower, const std::shared_ptr< SymbolicExpr > &upper, ComputationContext &context, const std::string &operation, detail::RewriteBudget &transform_budget)
std::shared_ptr< SymbolicExpr > vector_calculus_integrate_with_fallback(const std::shared_ptr< SymbolicExpr > &integrand, const std::string &variable, const std::shared_ptr< SymbolicExpr > &lower, const std::shared_ptr< SymbolicExpr > &upper, ComputationContext &context, detail::RewriteBudget &transform_budget)
Result< void > vector_calculus_validate_curve_vector_inputs(const VectorField &F, const VectorField ¶metrization, const std::string &t, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, ComputationContext &context, const std::string &operation)
VectorCalculusExprResult curve_integral_vector_strict(const VectorField &field, const VectorField ¶metrization, const std::string ¶meter, const std::shared_ptr< SymbolicExpr > &lower, const std::shared_ptr< SymbolicExpr > &upper, ComputationContext &context, const std::string &operation, detail::RewriteBudget &transform_budget)
VectorCalculusExprResult curve_integral_scalar_checked(const std::shared_ptr< SymbolicExpr > &f, const VectorField ¶metrization, const std::string &t, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, ComputationContext &context)
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
VectorCalculusExprResult curve_integral_vector_checked(const VectorField &F, const VectorField ¶metrization, const std::string &t, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, ComputationContext &context)
__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
std::vector< std::shared_ptr< SymbolicExpr > > VectorField
向量场由标量表达式组成。
__attribute__((visibility("default"))) MatrixRankResult matrix_rank_checked(const std __attribute__((visibility("default"))) MatrixRankResult matrix_rank_checked(const std __attribute__((visibility("default"))) ExpressionResult matrix_rref_checked(const std __attribute__((visibility("default"))) ExpressionResult matrix_rref_checked(const std __attribute__((visibility("default"))) MatrixNullspaceResult matrix_nullspace_checked(const std __attribute__((visibility("default"))) MatrixNullspaceResult matrix_nullspace_checked(const std __attribute__((visibility("default"))) MatrixLinearSolveResult matrix_solve_linear_checked(const std __attribute__((visibility("default"))) MatrixLinearSolveResult matrix_solve_linear_checked(const std int dim
__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 & parametrization
Result< std::shared_ptr< SymbolicExpr > > VectorCalculusExprResult
std::shared_ptr< SymbolicExpr > curve_integral_vector(const VectorField &F, const VectorField ¶metrization, const std::string &t, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b)
std::shared_ptr< SymbolicExpr > curve_integral_scalar(const std::shared_ptr< SymbolicExpr > &f, const VectorField ¶metrization, const std::string &t, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &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 & t
VectorCalculusExprResult dot_product(const VectorField &a, const VectorField &b)