15 const std::shared_ptr<SymbolicExpr>&
lower,
16 const std::shared_ptr<SymbolicExpr>&
upper,
18 const std::string& operation)
20 auto step =
context.consume_steps(1, operation);
21 if (!step)
return step;
24 "profile expression cannot be null",
29 "integration bounds cannot be null",
37 const std::string& operation,
42 (
context).limits().max_ast_nodes,
"transform");
54 "geometry integral is outside the supported domain",
60}
catch (
const std::bad_alloc&) {
62}
catch (
const std::length_error& error) {
64}
catch (
const std::exception& error) {
69 const std::shared_ptr<SymbolicExpr>& expr,
75 (
context).limits().max_ast_nodes,
"transform");
79 derivative, operation,
80 "geometry derivative is outside the supported domain",
context);
84 "geometry derivative is outside the supported domain", operation);
87}
catch (
const std::bad_alloc&) {
89}
catch (
const std::length_error& error) {
91}
catch (
const std::exception& error) {
96 const std::shared_ptr<SymbolicExpr>& integrand,
98 const std::shared_ptr<SymbolicExpr>& lower_bound,
99 const std::shared_ptr<SymbolicExpr>& upper_bound,
106 "geometry integrand is outside the supported domain",
110 auto integrated =
integrator.integrate_def_checked(
117 "geometry integral is outside the supported domain",
122 "geometry definite integral result is outside the supported domain",
context);
125}
catch (
const std::bad_alloc&) {
127}
catch (
const std::length_error& error) {
129}
catch (
const std::exception& error) {
136 (
context).limits().max_ast_nodes,
"transform");
144 auto exponent = std::dynamic_pointer_cast<const NumberNode>(power->exponent());
147 if (
rational.get_numerator() == BigInt(1) &&
148 rational.get_denominator() == BigInt(2)) {
158 std::shared_ptr<SymbolicExpr> f,
159 std::shared_ptr<SymbolicExpr>
a,
160 std::shared_ptr<SymbolicExpr>
b,
163 const std::string& operation)
166 (
context).limits().max_ast_nodes,
"transform");
170 auto step =
context.consume_steps(8, operation);
179 }
catch (
const std::bad_alloc&) {
181 "symbolic geometry allocation failed",
185 e.what(), operation);
189}
catch (
const std::bad_alloc&) {
191}
catch (
const std::length_error& error) {
193}
catch (
const std::exception& error) {
198 std::shared_ptr<SymbolicExpr> f,
199 std::shared_ptr<SymbolicExpr>
a,
200 std::shared_ptr<SymbolicExpr>
b,
203 const std::string& operation)
208 auto step =
context.consume_steps(10, operation);
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))));
219 }
catch (
const std::bad_alloc&) {
221 "symbolic geometry allocation failed",
223 }
catch (
const std::exception&
e) {
225 e.what(), operation);
232 std::shared_ptr<SymbolicExpr> fx,
233 std::shared_ptr<SymbolicExpr>
a,
234 std::shared_ptr<SymbolicExpr>
b,
237 return volume_of_revolution_checked_impl(
238 std::move(fx), std::move(
a), std::move(
b),
"x",
239 context,
"volume_of_revolution_x");
243 std::shared_ptr<SymbolicExpr> fx,
244 std::shared_ptr<SymbolicExpr>
a,
245 std::shared_ptr<SymbolicExpr>
b
254 std::shared_ptr<SymbolicExpr> fx,
255 std::shared_ptr<SymbolicExpr>
a,
256 std::shared_ptr<SymbolicExpr>
b,
259 return arc_length_checked_impl(
260 std::move(fx), std::move(
a), std::move(
b),
"x",
265 std::shared_ptr<SymbolicExpr> fx,
266 std::shared_ptr<SymbolicExpr>
a,
267 std::shared_ptr<SymbolicExpr>
b
275 std::shared_ptr<SymbolicExpr> fy,
276 std::shared_ptr<SymbolicExpr>
a,
277 std::shared_ptr<SymbolicExpr>
b,
280 return volume_of_revolution_checked_impl(
281 std::move(fy), std::move(
a), std::move(
b),
"y",
282 context,
"volume_of_revolution_y");
286 std::shared_ptr<SymbolicExpr> fy,
287 std::shared_ptr<SymbolicExpr>
a,
288 std::shared_ptr<SymbolicExpr>
b
297 std::shared_ptr<SymbolicExpr> fy,
298 std::shared_ptr<SymbolicExpr>
a,
299 std::shared_ptr<SymbolicExpr>
b,
302 return arc_length_checked_impl(
303 std::move(fy), std::move(
a), std::move(
b),
"y",
308 std::shared_ptr<SymbolicExpr> fy,
309 std::shared_ptr<SymbolicExpr>
a,
310 std::shared_ptr<SymbolicExpr>
b
static Result failure(CasErrc code, std::string message, std::string operation={})
static Result success(T value)
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)
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 simplify_geometry_checked(std::shared_ptr< SymbolicExpr > expr, const std::string &operation, const std::string &message, ComputationContext &context)
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 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)
std::shared_ptr< SymbolicExpr > squared_profile(const std::shared_ptr< SymbolicExpr > &f, ComputationContext &context)
ExpressionResult differentiate_geometry_checked(const std::shared_ptr< SymbolicExpr > &expr, const std::string &variable, const std::string &operation, ComputationContext &context)
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
std::shared_ptr< const Node > make_node(Args &&... args)
SymbolicNodePtr normalize_node(const SymbolicNodePtr &node, RewriteBudget &budget, const FactsQuery &facts, Domain domain)
const std::string & variable
__attribute__((visibility("default"))) ExprResult function(const std __attribute__((visibility("default"))) ExprResult finite_set(std ExprPtr upper
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
ExpressionResult arc_length_y_checked(std::shared_ptr< SymbolicExpr > fy, std::shared_ptr< SymbolicExpr > a, std::shared_ptr< SymbolicExpr > b, ComputationContext &context)
bool contains_unevaluated_integral(const std::shared_ptr< const SymbolicNode > &node)
Result< std::shared_ptr< SymbolicExpr > > ExpressionResult
Result of an operation that produces a symbolic expression.
__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
ExpressionResult arc_length_x_checked(std::shared_ptr< SymbolicExpr > fx, std::shared_ptr< SymbolicExpr > a, std::shared_ptr< SymbolicExpr > b, ComputationContext &context)
ExpressionResult volume_of_revolution_x_checked(std::shared_ptr< SymbolicExpr > fx, std::shared_ptr< SymbolicExpr > a, std::shared_ptr< SymbolicExpr > b, ComputationContext &context)
ExprResult function(const std::string &name, std::vector< ExprPtr > arguments)
ExpressionResult volume_of_revolution_y_checked(std::shared_ptr< SymbolicExpr > fy, std::shared_ptr< SymbolicExpr > a, std::shared_ptr< SymbolicExpr > b, ComputationContext &context)
ExprResult rational(const Rational &value)
const std::vector< IntegrationStep > Integrator & integrator
符号表达式主类 SymbolicExpr 及其工厂方法,运算接口.