LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
solve_polynomial_quartic.cpp
浏览该文件的文档.
3#include <algorithm>
4#include <cmath>
5#include <limits>
6#include <stdexcept>
7
8namespace LMCAS {
9using namespace polynomial_solver_detail;
10
11std::vector<std::shared_ptr<SymbolicExpr>> polynomial_solver_detail::solve_quartic_impl(
12 const std::shared_ptr<SymbolicExpr>& a,
13 const std::shared_ptr<SymbolicExpr>& b,
14 const std::shared_ptr<SymbolicExpr>& c,
15 const std::shared_ptr<SymbolicExpr>& d,
16 const std::shared_ptr<SymbolicExpr>& e,
17 const std::string& var, ComputationContext& context) {
18 detail::RewriteBudget transform_budget(context, (context).limits().max_recursion_depth,
19 (context).limits().max_ast_nodes, "transform");
20
21 auto a_simp = detail::make_expression_ptr(detail::normalize_node(detail::node(a), transform_budget));
22 if (a_simp->get_number_value_is_zero()) {
23
24 return solve_cubic_impl(b, c, d, e, var, context);
25 }
26
27 {
31 var);
32 Polynomial<Rational> rational_poly;
33 if (convert_to_rational_poly(symbolic_poly, rational_poly, context)) {
34 return exact_polynomial_roots(rational_poly, context);
35 }
36 }
37
38 auto b_simp = detail::make_expression_ptr(detail::normalize_node(detail::node(b), transform_budget));
39 auto d_simp = detail::make_expression_ptr(detail::normalize_node(detail::node(d), transform_budget));
40 if (b_simp->get_number_value_is_zero() && d_simp->get_number_value_is_zero()) {
41 return solve_biquadratic_impl(a, c, e, var, context);
42 }
43
46}
47
48std::vector<std::shared_ptr<SymbolicExpr>> solve_quartic(
49 const std::shared_ptr<SymbolicExpr>& a,
50 const std::shared_ptr<SymbolicExpr>& b,
51 const std::shared_ptr<SymbolicExpr>& c,
52 const std::shared_ptr<SymbolicExpr>& d,
53 const std::shared_ptr<SymbolicExpr>& e,
54 const std::string& variable) {
56 return solve_quartic_impl(a, b, c, d, e, variable, context);
57}
58
59}
一元多项式模板类
std::shared_ptr<::LMCAS::SymbolicExpr > make_expression_ptr(SymbolicNodePtr root)
const SymbolicNodePtr & node(const ::LMCAS::SymbolicExpr &expression) noexcept
SymbolicNodePtr normalize_node(const SymbolicNodePtr &node, RewriteBudget &budget, const FactsQuery &facts, Domain domain)
std::vector< std::shared_ptr< SymbolicExpr > > solve_cubic_impl(const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, const std::shared_ptr< SymbolicExpr > &c, const std::shared_ptr< SymbolicExpr > &d, const std::string &variable, ComputationContext &context)
bool convert_to_rational_poly(const Polynomial< SymbolicPolyCoeff > &poly, Polynomial< Rational > &output, ComputationContext &context)
std::vector< std::shared_ptr< SymbolicExpr > > exact_polynomial_roots(const Polynomial< Rational > &polynomial, ComputationContext &context)
std::vector< std::shared_ptr< SymbolicExpr > > solve_biquadratic_impl(const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, const std::shared_ptr< SymbolicExpr > &c, const std::string &variable, ComputationContext &context)
std::vector< std::shared_ptr< SymbolicExpr > > symbolic_quartic_roots(const SymbolicQuarticDepression &depression, const std::string &variable, ComputationContext &context)
SymbolicQuarticDepression symbolic_quartic_depression(const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, const std::shared_ptr< SymbolicExpr > &c, const std::shared_ptr< SymbolicExpr > &d, const std::shared_ptr< SymbolicExpr > &e, ComputationContext &context)
std::vector< std::shared_ptr< SymbolicExpr > > solve_quartic_impl(const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, const std::shared_ptr< SymbolicExpr > &c, const std::shared_ptr< SymbolicExpr > &d, const std::shared_ptr< SymbolicExpr > &e, const std::string &variable, ComputationContext &context)
const std::string & variable
ExprResult e()
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
std::vector< std::shared_ptr< SymbolicExpr > > solve_quartic(const std::shared_ptr< SymbolicExpr > &a, const std::shared_ptr< SymbolicExpr > &b, const std::shared_ptr< SymbolicExpr > &c, const std::shared_ptr< SymbolicExpr > &d, const std::shared_ptr< SymbolicExpr > &e, const std::string &variable)
const VectorField const VectorField & c
const MultiPoly & b
__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