solve.h
Go to the documentation of this file.
1
7 #ifndef SYMENGINE_SOLVE_H
8 #define SYMENGINE_SOLVE_H
9
10 #include <symengine/sets.h>
13 #include <symengine/polys/uexprpoly.h>
16 #include <symengine/matrix.h>
17
18 namespace SymEngine
19 {
20 /*
21  * Solves the given equation f and returns all possible values of sym as a
22  * Set, given
23  * they satisfy the domain constraint.
24  */
25 RCP<const Set> solve(const RCP<const Basic> &f, const RCP<const Symbol> &sym,
26  const RCP<const Set> &domain = universalset());
27
28 // Solves rational equations.
29 RCP<const Set> solve_rational(const RCP<const Basic> &f,
30  const RCP<const Symbol> &sym,
31  const RCP<const Set> &domain = universalset());
32
33 // Solves Trigonometric equations.
34 RCP<const Set> solve_trig(const RCP<const Basic> &f,
35  const RCP<const Symbol> &sym,
36  const RCP<const Set> &domain = universalset());
37
38 // Solves Polynomial equations.
39 // Use this method, If you know for sure that f is a Polynomial.
40 RCP<const Set> solve_poly(const RCP<const Basic> &f,
41  const RCP<const Symbol> &sym,
42  const RCP<const Set> &domain = universalset());
43
44 // Helper method for solving lower order polynomials using known formulae.
45 RCP<const Set> solve_poly_heuristics(const vec_basic &coeffs,
46  const RCP<const Set> &domain
47  = universalset());
48
49 // Helper method for solving linear equations.
50 RCP<const Set> solve_poly_linear(const vec_basic &coeffs,
51  const RCP<const Set> &domain = universalset());
52
53 // Helper method for solving quadratic equations.
54 RCP<const Set> solve_poly_quadratic(const vec_basic &coeffs,
55  const RCP<const Set> &domain
56  = universalset());
57
58 // Helper method for solving cubic equations.
59 RCP<const Set> solve_poly_cubic(const vec_basic &coeffs,
60  const RCP<const Set> &domain = universalset());
61
62 // Helper method for solving quartic(degree-4) equations.
63 RCP<const Set> solve_poly_quartic(const vec_basic &coeffs,
64  const RCP<const Set> &domain
65  = universalset());
66
67 /*
68  * Helper method to decide if solve_trig can solve a particular equation.
69  * Checks the argument of Trigonometric part, and returns false if it is
70  * non-linear;
71  * true otherwise.
72  */
73 bool is_a_LinearArgTrigEquation(const Basic &b, const Symbol &x);
74
75 /* returns Inverse of a complex equation fX = gY wrt symbol sym.
76  * It is like a solver developed specifically to solve equations of the
77  * form exp(f(x)) = gY(required for trig solvers).
78  * For example : invertComplex(exp(x), {1}, x) would give you
79  * {2*I*pi*n | n in (-oo, oo)} aka values of x when exp(x) = 1.
80  * Dummy nD is used as the symbol for ImageSet while returning the solution
81  * set.
82  */
83 RCP<const Set> invertComplex(const RCP<const Basic> &fX,
84  const RCP<const Set> &gY,
85  const RCP<const Symbol> &sym,
86  const RCP<const Dummy> &nD = dummy("n"),
87  const RCP<const Set> &domain = universalset());
88
89 // Solver for System of Equations
90 // TODO : solve systems that have infinitely many solutions or no solution.
91 // Input as an Augmented Matrix. (A|b) to solve Ax=b.
92 vec_basic linsolve(const DenseMatrix &system, const vec_sym &syms);
93
94 // Input as a vector of linear equations.
95 vec_basic linsolve(const vec_basic &system, const vec_sym &syms);
96
97 // converts system of linear equations into Matrix form.
98 // first Matrix is for A and second one is for b.
100 linear_eqns_to_matrix(const vec_basic &equations, const vec_sym &syms);
101 } // namespace SymEngine
102
103 #endif // SYMENGINE_SOLVE_H
Main namespace for SymEngine package.