LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
LMCAS::anonymous_namespace{symbolic_geometry.cpp} 命名空间参考

函数

ExpressionResult arc_length_checked_impl (std::shared_ptr< SymbolicExpr > f, std::shared_ptr< SymbolicExpr > a, std::shared_ptr< SymbolicExpr > b, const std::string &variable, ComputationContext &context, const std::string &operation)
ExpressionResult definite_integral_geometry_checked (const std::shared_ptr< SymbolicExpr > &integrand, const std::string &variable, const std::shared_ptr< SymbolicExpr > &lower_bound, const std::shared_ptr< SymbolicExpr > &upper_bound, const std::string &operation, ComputationContext &context)
ExpressionResult differentiate_geometry_checked (const std::shared_ptr< SymbolicExpr > &expr, const std::string &variable, const std::string &operation, ComputationContext &context)
ExpressionResult simplify_geometry_checked (std::shared_ptr< SymbolicExpr > expr, const std::string &operation, const std::string &message, ComputationContext &context)
std::shared_ptr< SymbolicExpr > squared_profile (const std::shared_ptr< SymbolicExpr > &f, ComputationContext &context)
Result< void > validate_geometry_inputs (const std::shared_ptr< SymbolicExpr > &function, const std::shared_ptr< SymbolicExpr > &lower, const std::shared_ptr< SymbolicExpr > &upper, ComputationContext &context, const std::string &operation)
ExpressionResult volume_of_revolution_checked_impl (std::shared_ptr< SymbolicExpr > f, std::shared_ptr< SymbolicExpr > a, std::shared_ptr< SymbolicExpr > b, const std::string &variable, ComputationContext &context, const std::string &operation)

函数说明

◆ arc_length_checked_impl()

ExpressionResult LMCAS::anonymous_namespace{symbolic_geometry.cpp}::arc_length_checked_impl ( std::shared_ptr< SymbolicExpr > f,
std::shared_ptr< SymbolicExpr > a,
std::shared_ptr< SymbolicExpr > b,
const std::string & variable,
ComputationContext & context,
const std::string & operation )

在文件 symbolic_geometry.cpp 第 197 行定义.

204{
205 auto valid = validate_geometry_inputs(f, a, b, context, operation);
206 if (!valid) return ExpressionResult::failure(valid.error());
207
208 auto step = context.consume_steps(10, operation);
209 if (!step) return ExpressionResult::failure(step.error());
210
211 try {
212 auto derivative_result = differentiate_geometry_checked(f, variable, operation, context);
213 if (!derivative_result) return derivative_result;
214 auto integrand = SymbolicExpr::sqrt(SymbolicExpr::add(
215 SymbolicExpr::number(1),
216 SymbolicExpr::power(derivative_result.value(), SymbolicExpr::number(2))));
218 integrand, variable, a, b, operation, context);
219 } catch (const std::bad_alloc&) {
221 "symbolic geometry allocation failed",
222 operation);
223 } catch (const std::exception& e) {
225 e.what(), operation);
226 }
227}
static Result failure(CasErrc code, std::string message, std::string operation={})
Result< void > validate_geometry_inputs(const std::shared_ptr< SymbolicExpr > &function, const std::shared_ptr< SymbolicExpr > &lower, const std::shared_ptr< SymbolicExpr > &upper, ComputationContext &context, const std::string &operation)
ExpressionResult definite_integral_geometry_checked(const std::shared_ptr< SymbolicExpr > &integrand, const std::string &variable, const std::shared_ptr< SymbolicExpr > &lower_bound, const std::shared_ptr< SymbolicExpr > &upper_bound, const std::string &operation, ComputationContext &context)
ExpressionResult differentiate_geometry_checked(const std::shared_ptr< SymbolicExpr > &expr, const std::string &variable, const std::string &operation, ComputationContext &context)
const std::string & variable
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

引用了 LMCAS::a, arc_length_checked_impl(), LMCAS::b, LMCAS::context, definite_integral_geometry_checked(), differentiate_geometry_checked(), LMCAS::e(), LMCAS::Result< std::shared_ptr< SymbolicExpr > >::failure(), LMCAS::InternalInvariant, LMCAS::ResourceLimit, validate_geometry_inputs() , 以及 LMCAS::variable.

被这些函数引用 arc_length_checked_impl().

函数调用图:
这是这个函数的调用关系图:

◆ definite_integral_geometry_checked()

ExpressionResult LMCAS::anonymous_namespace{symbolic_geometry.cpp}::definite_integral_geometry_checked ( const std::shared_ptr< SymbolicExpr > & integrand,
const std::string & variable,
const std::shared_ptr< SymbolicExpr > & lower_bound,
const std::shared_ptr< SymbolicExpr > & upper_bound,
const std::string & operation,
ComputationContext & context )

在文件 symbolic_geometry.cpp 第 95 行定义.

101 {
102
103 if (!integrand || !LMCAS::detail::node(integrand)) {
106 "geometry integrand is outside the supported domain",
107 operation);
108 }
109 Integrator integrator;
110 auto integrated = integrator.integrate_def_checked(
111 *integrand, variable, *lower_bound, *upper_bound, context);
112 if (!integrated) { return ExpressionResult::failure(integrated.error()); }
113 auto result = detail::make_expression_ptr(std::move(integrated.value()));
117 "geometry integral is outside the supported domain",
118 operation);
119 }
121 result, operation,
122 "geometry definite integral result is outside the supported domain", context);
123} catch (const CasError& error) {
124 return ExpressionResult::failure(error);
125} catch (const std::bad_alloc&) {
126 return ExpressionResult::failure(CasErrc::ResourceLimit, "allocation failed", operation);
127} catch (const std::length_error& error) {
128 return ExpressionResult::failure(CasErrc::ResourceLimit, error.what(), operation);
129} catch (const std::exception& error) {
130 return ExpressionResult::failure(CasErrc::InternalInvariant, error.what(), operation);
131}
ExpressionResult simplify_geometry_checked(std::shared_ptr< SymbolicExpr > expr, const std::string &operation, const std::string &message, ComputationContext &context)
std::shared_ptr<::LMCAS::SymbolicExpr > make_expression_ptr(SymbolicNodePtr root)
const SymbolicNodePtr & node(const ::LMCAS::SymbolicExpr &expression) noexcept
bool contains_unevaluated_integral(const std::shared_ptr< const SymbolicNode > &node)
const std::vector< IntegrationStep > Integrator & integrator

引用了 LMCAS::contains_unevaluated_integral(), LMCAS::context, definite_integral_geometry_checked(), LMCAS::Result< std::shared_ptr< SymbolicExpr > >::failure(), LMCAS::Inconclusive, LMCAS::integrator, LMCAS::detail::make_expression_ptr(), LMCAS::detail::node(), simplify_geometry_checked() , 以及 LMCAS::variable.

被这些函数引用 arc_length_checked_impl(), definite_integral_geometry_checked() , 以及 volume_of_revolution_checked_impl().

函数调用图:
这是这个函数的调用关系图:

◆ differentiate_geometry_checked()

ExpressionResult LMCAS::anonymous_namespace{symbolic_geometry.cpp}::differentiate_geometry_checked ( const std::shared_ptr< SymbolicExpr > & expr,
const std::string & variable,
const std::string & operation,
ComputationContext & context )

在文件 symbolic_geometry.cpp 第 68 行定义.

72 {
73
74 detail::RewriteBudget transform_budget(context, (context).limits().max_recursion_depth,
75 (context).limits().max_ast_nodes, "transform");
76 auto derivative = detail::make_expression_ptr(
77 detail::differentiate_node(detail::node(expr), variable, transform_budget));
79 derivative, operation,
80 "geometry derivative is outside the supported domain", context);
81} catch (const CasError& error) {
84 "geometry derivative is outside the supported domain", operation);
85 }
86 return ExpressionResult::failure(error);
87} catch (const std::bad_alloc&) {
88 return ExpressionResult::failure(CasErrc::ResourceLimit, "allocation failed", operation);
89} catch (const std::length_error& error) {
90 return ExpressionResult::failure(CasErrc::ResourceLimit, error.what(), operation);
91} catch (const std::exception& error) {
92 return ExpressionResult::failure(CasErrc::InternalInvariant, error.what(), operation);
93}
SymbolicNodePtr differentiate_node(const SymbolicNodePtr &node, const std::string &variable, RewriteBudget &budget, const FactsQuery &facts, Domain domain)

引用了 LMCAS::context, differentiate_geometry_checked(), LMCAS::detail::differentiate_node(), LMCAS::detail::make_expression_ptr(), LMCAS::detail::node(), simplify_geometry_checked() , 以及 LMCAS::variable.

被这些函数引用 arc_length_checked_impl() , 以及 differentiate_geometry_checked().

函数调用图:
这是这个函数的调用关系图:

◆ simplify_geometry_checked()

ExpressionResult LMCAS::anonymous_namespace{symbolic_geometry.cpp}::simplify_geometry_checked ( std::shared_ptr< SymbolicExpr > expr,
const std::string & operation,
const std::string & message,
ComputationContext & context )

在文件 symbolic_geometry.cpp 第 36 行定义.

39 {
40
41 detail::RewriteBudget transform_budget(context, (context).limits().max_recursion_depth,
42 (context).limits().max_ast_nodes, "transform");
43 if (!expr || !LMCAS::detail::node(expr)) {
45 message, operation);
46 }
47 auto simplified = detail::make_expression_ptr(detail::normalize_node(detail::node(expr), transform_budget));
48 if (!simplified || !LMCAS::detail::node(simplified)) {
50 message, operation);
51 }
54 "geometry integral is outside the supported domain",
55 operation);
56 }
57 return ExpressionResult::success(std::move(simplified));
58} catch (const CasError& error) {
59 return ExpressionResult::failure(error);
60} catch (const std::bad_alloc&) {
61 return ExpressionResult::failure(CasErrc::ResourceLimit, "allocation failed", operation);
62} catch (const std::length_error& error) {
63 return ExpressionResult::failure(CasErrc::ResourceLimit, error.what(), operation);
64} catch (const std::exception& error) {
65 return ExpressionResult::failure(CasErrc::InternalInvariant, error.what(), operation);
66}
static Result success(std::shared_ptr< SymbolicExpr > value)
SymbolicNodePtr normalize_node(const SymbolicNodePtr &node, RewriteBudget &budget, const FactsQuery &facts, Domain domain)

引用了 LMCAS::contains_unevaluated_integral(), LMCAS::context, LMCAS::Result< std::shared_ptr< SymbolicExpr > >::failure(), LMCAS::Inconclusive, LMCAS::detail::make_expression_ptr(), LMCAS::detail::node(), LMCAS::detail::normalize_node(), simplify_geometry_checked() , 以及 LMCAS::Result< std::shared_ptr< SymbolicExpr > >::success().

被这些函数引用 definite_integral_geometry_checked(), differentiate_geometry_checked() , 以及 simplify_geometry_checked().

函数调用图:
这是这个函数的调用关系图:

◆ squared_profile()

std::shared_ptr< SymbolicExpr > LMCAS::anonymous_namespace{symbolic_geometry.cpp}::squared_profile ( const std::shared_ptr< SymbolicExpr > & f,
ComputationContext & context )

在文件 symbolic_geometry.cpp 第 133 行定义.

133 {
134
135 detail::RewriteBudget transform_budget(context, (context).limits().max_recursion_depth,
136 (context).limits().max_ast_nodes, "transform");
137 if (f) {
138 if (auto func = std::dynamic_pointer_cast<const FunctionNode>(LMCAS::detail::node(f))) {
139 if (func->type() == FunctionNode::FuncType::Sqrt && func->arguments().size() == 1) {
140 return detail::make_expression_ptr(detail::normalize_node(func->arguments()[0], transform_budget));
141 }
142 }
143 if (auto power = std::dynamic_pointer_cast<const PowerNode>(LMCAS::detail::node(f))) {
144 auto exponent = std::dynamic_pointer_cast<const NumberNode>(power->exponent());
145 if (exponent && std::holds_alternative<Rational>(exponent->value())) {
146 const auto& rational = std::get<Rational>(exponent->value());
147 if (rational.get_numerator() == BigInt(1) &&
148 rational.get_denominator() == BigInt(2)) {
149 return detail::make_expression_ptr(detail::normalize_node(power->base(), transform_budget));
150 }
151 }
152 }
153 }
154 return detail::make_expression_ptr(detail::normalize_node(detail::node(SymbolicExpr::power(f, SymbolicExpr::number(2))), transform_budget));
155}
@ Sqrt
对数、绝对值、平方根。
const ExprPtr & exponent
ExprResult rational(const Rational &value)

引用了 LMCAS::context, LMCAS::exponent, LMCAS::detail::make_expression_ptr(), LMCAS::detail::node(), LMCAS::detail::normalize_node(), LMCAS::rational(), LMCAS::FunctionNode::Sqrt , 以及 squared_profile().

被这些函数引用 squared_profile() , 以及 volume_of_revolution_checked_impl().

函数调用图:
这是这个函数的调用关系图:

◆ validate_geometry_inputs()

Result< void > LMCAS::anonymous_namespace{symbolic_geometry.cpp}::validate_geometry_inputs ( const std::shared_ptr< SymbolicExpr > & function,
const std::shared_ptr< SymbolicExpr > & lower,
const std::shared_ptr< SymbolicExpr > & upper,
ComputationContext & context,
const std::string & operation )

在文件 symbolic_geometry.cpp 第 14 行定义.

19{
20 auto step = context.consume_steps(1, operation);
21 if (!step) return step;
24 "profile expression cannot be null",
25 operation);
26 }
29 "integration bounds cannot be null",
30 operation);
31 }
32 return Result<void>::success();
33}
__attribute__((visibility("default"))) ExprResult function(const std __attribute__((visibility("default"))) ExprResult finite_set(std ExprPtr upper
const ExprPtr & lower
ExprResult function(const std::string &name, std::vector< ExprPtr > arguments)

引用了 LMCAS::context, LMCAS::Result< T >::failure(), LMCAS::function(), LMCAS::InvalidArgument, LMCAS::lower, LMCAS::detail::node(), LMCAS::Result< T >::success(), LMCAS::upper , 以及 validate_geometry_inputs().

被这些函数引用 arc_length_checked_impl(), validate_geometry_inputs() , 以及 volume_of_revolution_checked_impl().

函数调用图:
这是这个函数的调用关系图:

◆ volume_of_revolution_checked_impl()

ExpressionResult LMCAS::anonymous_namespace{symbolic_geometry.cpp}::volume_of_revolution_checked_impl ( std::shared_ptr< SymbolicExpr > f,
std::shared_ptr< SymbolicExpr > a,
std::shared_ptr< SymbolicExpr > b,
const std::string & variable,
ComputationContext & context,
const std::string & operation )

在文件 symbolic_geometry.cpp 第 157 行定义.

164 {
165 detail::RewriteBudget transform_budget(context, (context).limits().max_recursion_depth,
166 (context).limits().max_ast_nodes, "transform");
167 auto valid = validate_geometry_inputs(f, a, b, context, operation);
168 if (!valid) return ExpressionResult::failure(valid.error());
169
170 auto step = context.consume_steps(8, operation);
171 if (!step) return ExpressionResult::failure(step.error());
172
173 try {
176 auto integrand = detail::make_expression_ptr(detail::normalize_node(detail::node(SymbolicExpr::multiply(pi, squared_profile(f, context))), transform_budget));
178 integrand, variable, a, b, operation, context);
179 } catch (const std::bad_alloc&) {
181 "symbolic geometry allocation failed",
182 operation);
183 } catch (const std::length_error& error) { return ExpressionResult::failure(CasErrc::ResourceLimit, error.what(), operation); } catch (const std::exception& e) {
185 e.what(), operation);
186 }
187} catch (const CasError& error) {
188 return ExpressionResult::failure(error);
189} catch (const std::bad_alloc&) {
190 return ExpressionResult::failure(CasErrc::ResourceLimit, "allocation failed", operation);
191} catch (const std::length_error& error) {
192 return ExpressionResult::failure(CasErrc::ResourceLimit, error.what(), operation);
193} catch (const std::exception& error) {
194 return ExpressionResult::failure(CasErrc::InternalInvariant, error.what(), operation);
195}
std::shared_ptr< SymbolicExpr > squared_profile(const std::shared_ptr< SymbolicExpr > &f, ComputationContext &context)
std::shared_ptr< const Node > make_node(Args &&... args)
ExprResult pi()

引用了 LMCAS::a, LMCAS::b, LMCAS::context, definite_integral_geometry_checked(), LMCAS::e(), LMCAS::Result< std::shared_ptr< SymbolicExpr > >::failure(), LMCAS::InternalInvariant, LMCAS::detail::make_expression_ptr(), LMCAS::detail::make_node(), LMCAS::detail::node(), LMCAS::detail::normalize_node(), LMCAS::pi(), LMCAS::ResourceLimit, squared_profile(), validate_geometry_inputs(), LMCAS::variable , 以及 volume_of_revolution_checked_impl().

被这些函数引用 volume_of_revolution_checked_impl().

函数调用图:
这是这个函数的调用关系图: