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

函数

bool rd_factor_piece (const Polynomial< Rational > &piece, int mult, std::vector< std::pair< Polynomial< Rational >, int > > &factors_out)
bool rd_factor_quadratic (Polynomial< Rational > &current, int mult, std::vector< std::pair< Polynomial< Rational >, int > > &factors_out)

函数说明

◆ rd_factor_piece()

bool LMCAS::anonymous_namespace{integration_rational_factorization.cpp}::rd_factor_piece ( const Polynomial< Rational > & piece,
int mult,
std::vector< std::pair< Polynomial< Rational >, int > > & factors_out )

在文件 integration_rational_factorization.cpp 第 31 行定义.

32 {
33 auto current = piece.make_monic();
34 if (current.degree() == 0) { return true; }
35 if (current.degree() == 1) {
36 factors_out.push_back({current, mult});
37 return true;
38 }
39 if (current.degree() == 2) { return rd_factor_quadratic(current, mult, factors_out); }
40 auto roots = find_rational_roots(current);
41 for (const auto& r : roots) {
42 Polynomial<Rational> linear({Rational(0) - r, Rational(1)}, current.variable_name);
43 auto qr = current.div_mod(linear);
44 if (qr.second.is_zero()) {
45 factors_out.push_back({linear, mult});
46 current = qr.first;
47 if (current.degree() <= 0) { break; }
48 }
49 }
50
51 if (current.degree() <= 0) { return true; }
52 if (current.degree() == 1) {
53 factors_out.push_back({current.make_monic(), mult});
54 return true;
55 }
56 if (current.degree() == 2) {
57 factors_out.push_back({current.make_monic(), mult});
58 return true;
59 }
60 return false;
61}
Polynomial make_monic() const
首一化(使首项系数为 1)
bool rd_factor_quadratic(Polynomial< Rational > &current, int mult, std::vector< std::pair< Polynomial< Rational >, int > > &factors_out)
__attribute__((visibility("default"))) ComplexSymbolicResult complex_exp_form_checked(std __attribute__((visibility("default"))) ComplexSymbolicResult complex_exp_form_checked(std __attribute__((visibility("default"))) ComplexSymbolicResult complex_trig_form_checked(std __attribute__((visibility("default"))) ComplexSymbolicResult complex_trig_form_checked(std __attribute__((visibility("default"))) ComplexRootsResult solve_complex_nth_root_checked(std __attribute__((visibility("default"))) ComplexRootsResult solve_complex_nth_root_checked(std __attribute__((visibility("default"))) ComplexRootsResult solve_complex_quadratic_checked(std __attribute__((visibility("default"))) ComplexRootsResult solve_complex_quadratic_checked(std std::shared_ptr< SymbolicExpr > r
@ Rational
Rational numbers
std::vector< Rational > find_rational_roots(const Polynomial< Rational > &poly)
ExprSetResult roots(const ExprPtr &expression, const std::string &variable, ComputationContext &context, const SolveOptions &options)

引用了 LMCAS::Polynomial< CoeffType >::div_mod(), LMCAS::find_rational_roots(), LMCAS::Polynomial< CoeffType >::is_zero(), LMCAS::Polynomial< CoeffType >::make_monic(), LMCAS::r, rd_factor_piece(), rd_factor_quadratic() , 以及 LMCAS::roots().

被这些函数引用 rd_factor_piece().

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

◆ rd_factor_quadratic()

bool LMCAS::anonymous_namespace{integration_rational_factorization.cpp}::rd_factor_quadratic ( Polynomial< Rational > & current,
int mult,
std::vector< std::pair< Polynomial< Rational >, int > > & factors_out )

在文件 integration_rational_factorization.cpp 第 6 行定义.

7 {
8 auto roots = find_rational_roots(current);
9 if (!roots.empty()) {
10 for (const auto& r : roots) {
11 Polynomial<Rational> linear({Rational(0) - r, Rational(1)}, current.variable_name);
12 auto qr = current.div_mod(linear);
13 if (!qr.second.is_zero()) {
14 return false;
15 }
16 factors_out.push_back({linear, mult});
17 current = qr.first;
18 if (current.degree() == 0) { break; }
19 }
20 }
21 if (current.degree() == 2) {
22 factors_out.push_back({current.make_monic(), mult});
23 current = Polynomial<Rational>({Rational(1)}, current.variable_name);
24 } else if (current.degree() == 1) {
25 factors_out.push_back({current.make_monic(), mult});
26 current = Polynomial<Rational>({Rational(1)}, current.variable_name);
27 }
28 return true;
29}
一元多项式模板类
std::pair< Polynomial, Polynomial > div_mod(const Polynomial &other) const
多项式带余除法
std::string variable_name
变量名
bool is_zero() const
判断是否为零多项式
int degree() const
获取多项式的次数

引用了 LMCAS::Polynomial< CoeffType >::degree(), LMCAS::Polynomial< CoeffType >::div_mod(), LMCAS::find_rational_roots(), LMCAS::Polynomial< CoeffType >::is_zero(), LMCAS::Polynomial< CoeffType >::make_monic(), LMCAS::r, rd_factor_quadratic(), LMCAS::roots() , 以及 LMCAS::Polynomial< CoeffType >::variable_name.

被这些函数引用 rd_factor_piece() , 以及 rd_factor_quadratic().

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