12 const std::shared_ptr<SymbolicExpr>& integrand,
13 const std::string& var,
14 const std::shared_ptr<SymbolicExpr>&
a,
15 const std::shared_ptr<SymbolicExpr>&
b,
19 (
context).limits().max_ast_nodes,
"transform");
21 auto integrated =
integrator.integrate_def_checked(
26 SymbolicExpr result = std::move(integrated.value());
29 return std::shared_ptr<SymbolicExpr>{};
35 return std::shared_ptr<SymbolicExpr>{};
37 return simplified ? simplified : res;
38}
catch (
const CasError& error) {
40}
catch (
const std::bad_alloc&) {
42}
catch (
const std::length_error& error) {
44}
catch (
const std::exception& error) {
48 const std::shared_ptr<SymbolicExpr>& f,
const std::string& var,
49 const std::shared_ptr<SymbolicExpr>&
a,
const std::shared_ptr<SymbolicExpr>&
b,
53 (
context).limits().max_ast_nodes,
"transform");
54 const std::string operation =
"surface_area_revolution_x";
59 auto step =
context.consume_steps(8, operation);
69 "surface derivative is outside the supported domain",
73 auto f_prime_sq = SymbolicExpr::power(f_prime, SymbolicExpr::number(2));
74 auto one_plus_fp_sq = SymbolicExpr::add(SymbolicExpr::number(1), f_prime_sq);
75 auto arc_factor = SymbolicExpr::sqrt(one_plus_fp_sq);
80 "absolute value node construction failed",
83 auto integrand = SymbolicExpr::multiply(abs_f, arc_factor);
90 if (!integral.value() ||
94 "surface area integral could not be evaluated exactly",
98 auto two_pi = SymbolicExpr::multiply(
101 auto result = SymbolicExpr::multiply(
102 two_pi, std::move(integral.value()));
105 }
catch (
const std::bad_alloc&) {
107 "surface area allocation failed",
111 e.what(), operation);
113}
catch (
const CasError& error) {
115}
catch (
const std::bad_alloc&) {
117}
catch (
const std::length_error& error) {
119}
catch (
const std::exception& error) {
124 const std::shared_ptr<SymbolicExpr>& f,
const std::string& var,
125 const std::shared_ptr<SymbolicExpr>&
a,
const std::shared_ptr<SymbolicExpr>&
b)
133 const std::shared_ptr<SymbolicExpr>& f,
const std::string& var,
134 const std::shared_ptr<SymbolicExpr>&
a,
const std::shared_ptr<SymbolicExpr>&
b,
138 (
context).limits().max_ast_nodes,
"transform");
139 const std::string operation =
"surface_area_revolution_y";
144 auto step =
context.consume_steps(8, operation);
154 "surface derivative is outside the supported domain",
158 auto f_prime_sq = SymbolicExpr::power(f_prime, SymbolicExpr::number(2));
159 auto one_plus_fp_sq = SymbolicExpr::add(SymbolicExpr::number(1), f_prime_sq);
160 auto arc_factor = SymbolicExpr::sqrt(one_plus_fp_sq);
161 auto var_expr = SymbolicExpr::variable(var);
166 "absolute value node construction failed",
169 auto integrand = SymbolicExpr::multiply(abs_var, arc_factor);
176 if (!integral.value() ||
180 "surface area integral could not be evaluated exactly",
184 auto two_pi = SymbolicExpr::multiply(
187 auto result = SymbolicExpr::multiply(
188 two_pi, std::move(integral.value()));
191 }
catch (
const std::bad_alloc&) {
193 "surface area allocation failed",
197 e.what(), operation);
199}
catch (
const CasError& error) {
201}
catch (
const std::bad_alloc&) {
203}
catch (
const std::length_error& error) {
205}
catch (
const std::exception& error) {
210 const std::shared_ptr<SymbolicExpr>& f,
const std::string& var,
211 const std::shared_ptr<SymbolicExpr>&
a,
const std::shared_ptr<SymbolicExpr>&
b)
static Result failure(CasErrc code, std::string message, std::string operation={})
static Result success(std::shared_ptr< SymbolicExpr > value)
Symbolic integration APIs.
std::shared_ptr< SymbolicExpr > calculus_utils_make_abs(const std::shared_ptr< SymbolicExpr > &expr)
Result< void > calculus_utils_validate_expr_bounds(const std::shared_ptr< SymbolicExpr > &expr, const std::string &var, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, ComputationContext &context, const std::string &operation)
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)
static ExpressionResult calculus_utils_try_symbolic_definite(const std::shared_ptr< SymbolicExpr > &integrand, const std::string &var, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, ComputationContext &context)
const std::vector< Polynomial< BigInt > > const BigInt 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 surface_area_revolution_y_checked(const std::shared_ptr< SymbolicExpr > &f, const std::string &var, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, ComputationContext &context)
ExpressionResult surface_area_revolution_x_checked(const std::shared_ptr< SymbolicExpr > &f, const std::string &var, const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, ComputationContext &context)
const std::vector< IntegrationStep > Integrator & integrator