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

类

struct  QuadRadical

函数

bool trigsub_half_exponent (const NumberNode &number, Rational &exponent)
bool trigsub_match_radical (const std::shared_ptr< const SymbolicNode > &node, const std::string &var, ComputationContext &context, QuadRadical &out)
bool trigsub_quadratic_coefficients (const detail::SymbolicNodePtr &radicand, const std::string &var, ComputationContext &context, Rational &c0, Rational &c2)

类说明

◆ LMCAS::anonymous_namespace{integration_trig_substitution.cpp}::QuadRadical

struct LMCAS::anonymous_namespace{integration_trig_substitution.cpp}::QuadRadical

在文件 integration_trig_substitution.cpp 第 10 行定义.

LMCAS::anonymous_namespace{integration_trig_substitution.cpp}::QuadRadical 的协作图:
类成员
Rational a_sq {0}
Rational exponent {0}
int pattern = 0

函数说明

◆ trigsub_half_exponent()

bool LMCAS::anonymous_namespace{integration_trig_substitution.cpp}::trigsub_half_exponent ( const NumberNode & number,
Rational & exponent )

在文件 integration_trig_substitution.cpp 第 16 行定义.

16 {
17 const auto exact = detail::exact_rational_value(number);
18 if (!exact || (*exact != Rational(1, 2) && *exact != Rational(-1, 2))) {
19 return false;
20 }
21 exponent = *exact;
22 return true;
23}
std::optional< Rational > exact_rational_value(const NumberNode &number)
const ExprPtr & exponent

引用了 LMCAS::detail::exact_rational_value(), LMCAS::exponent , 以及 trigsub_half_exponent().

被这些函数引用 trigsub_half_exponent() , 以及 trigsub_match_radical().

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

◆ trigsub_match_radical()

bool LMCAS::anonymous_namespace{integration_trig_substitution.cpp}::trigsub_match_radical ( const std::shared_ptr< const SymbolicNode > & node,
const std::string & var,
ComputationContext & context,
QuadRadical & out )

在文件 integration_trig_substitution.cpp 第 41 行定义.

44 {
45 auto pw = std::dynamic_pointer_cast<const PowerNode>(node);
46 if (!pw) { return false; }
47 auto en = std::dynamic_pointer_cast<const NumberNode>(pw->exponent());
48 if (!en) { return false; }
49 Rational exponent;
50 auto radicand = pw->base();
51 const auto outer = detail::exact_rational_value(*en);
52 if (outer && *outer == Rational(-1)) {
53 if (const auto* root = dynamic_cast<const PowerNode*>(radicand.get())) {
54 const auto inner = detail::exact_rational_value(root->exponent());
55 if (!inner || *inner != Rational(1, 2)) { return false; }
56 radicand = root->base();
57 } else if (const auto* root = dynamic_cast<const FunctionNode*>(radicand.get());
58 root && root->type() == FunctionNode::FuncType::Sqrt &&
59 root->arguments().size() == 1) {
60 radicand = root->arguments()[0];
61 } else {
62 return false;
63 }
64 exponent = Rational(-1, 2);
65 } else if (!trigsub_half_exponent(*en, exponent)) {
66 return false;
67 }
68 Rational c0, c2;
69 if (!trigsub_quadratic_coefficients(radicand, var, context, c0, c2)) { return false; }
70 out.exponent = exponent;
71 if (c2 < Rational(0) && c0 > Rational(0)) { out.pattern = 1; out.a_sq = c0; }
72 else if (c2 > Rational(0) && c0 > Rational(0)) { out.pattern = 2; out.a_sq = c0; }
73 else if (c2 > Rational(0) && c0 < Rational(0)) { out.pattern = 3; out.a_sq = Rational(0) - c0; }
74 else return false;
75 return true;
76}
@ Sqrt
对数、绝对值、平方根。
bool trigsub_quadratic_coefficients(const detail::SymbolicNodePtr &radicand, const std::string &var, ComputationContext &context, Rational &c0, Rational &c2)
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
@ Rational
Rational numbers

引用了 LMCAS::anonymous_namespace{integration_trig_substitution.cpp}::QuadRadical::a_sq, LMCAS::context, LMCAS::detail::exact_rational_value(), LMCAS::anonymous_namespace{integration_trig_substitution.cpp}::QuadRadical::exponent, LMCAS::exponent, LMCAS::anonymous_namespace{integration_trig_substitution.cpp}::QuadRadical::pattern, LMCAS::FunctionNode::Sqrt, trigsub_half_exponent(), trigsub_match_radical(), trigsub_quadratic_coefficients() , 以及 LMCAS::FunctionNode::type().

被这些函数引用 trigsub_match_radical().

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

◆ trigsub_quadratic_coefficients()

bool LMCAS::anonymous_namespace{integration_trig_substitution.cpp}::trigsub_quadratic_coefficients ( const detail::SymbolicNodePtr & radicand,
const std::string & var,
ComputationContext & context,
Rational & c0,
Rational & c2 )

在文件 integration_trig_substitution.cpp 第 25 行定义.

26 {
27 auto polynomial = recognize_rational_polynomial(
29 if (!polynomial) { throw polynomial.error(); }
30 if (!polynomial.value() || polynomial.value()->degree() != 2) { return false; }
31 const auto& coefficients = polynomial.value()->coeffs;
32 if (coefficients[1] != Rational(0) ||
33 (coefficients[2] != Rational(1) && coefficients[2] != Rational(-1))) {
34 return false;
35 }
36 c0 = coefficients[0];
37 c2 = coefficients[2];
38 return true;
39}
inline ::LMCAS::SymbolicExpr expression_from_node(SymbolicNodePtr root)
Result< OptionalRationalPolynomial > recognize_rational_polynomial(const SymbolicExpr &expression, const std::string &variable, ComputationContext &context)

引用了 LMCAS::context, LMCAS::detail::expression_from_node(), LMCAS::recognize_rational_polynomial() , 以及 trigsub_quadratic_coefficients().

被这些函数引用 trigsub_match_radical() , 以及 trigsub_quadratic_coefficients().

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