6std::shared_ptr<SymbolicExpr> SymbolicExpr::series(
8 const std::shared_ptr<SymbolicExpr>&
point,
10 const LMCAS::AssumptionContext*)
const {
13 (
context).limits().max_ast_nodes,
"transform");
14 if (!impl_->root || !
point)
return nullptr;
15 if (
order < 0)
return nullptr;
17 auto variable_expr = SymbolicExpr::variable(
variable);
18 auto delta = SymbolicExpr::add(
20 SymbolicExpr::multiply(SymbolicExpr::number(-1),
point));
21 std::vector<std::shared_ptr<const SymbolicNode>> terms;
24 for (
int n = 0;; ++n) {
27 if (!derivative)
return nullptr;
32 if (!coefficient)
return nullptr;
35 auto term = coefficient;
37 term = SymbolicExpr::multiply(
39 SymbolicExpr::power(delta, SymbolicExpr::number(n)));
42 auto factorial = BigInt::factorial(BigInt(n));
43 term = SymbolicExpr::multiply(
45 SymbolicExpr::number(
Rational(BigInt(1), factorial)));
48 if (n ==
order)
break;
51 if (terms.empty())
return SymbolicExpr::number(0);
55std::shared_ptr<SymbolicExpr> SymbolicExpr::make_limit(
56 const std::shared_ptr<SymbolicExpr>& expression,
58 const std::shared_ptr<SymbolicExpr>&
point) {
59 if (!expression || !
point)
return nullptr;
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)
SymbolicNodePtr substitute_node(const SymbolicNodePtr &node, const std::string &variable, const SymbolicNodePtr &replacement, RewriteBudget &budget, const FactsQuery &facts, Domain domain)
const std::string const LimitExprPtr & point
const std::string & variable
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
const std::vector< FGLMPoly > const MonomialOrder & order
@ Rational
Rational numbers