}
-/** Pseudo-remainder of polynomials a(x) and b(x) in Z[x].
+/** Pseudo-remainder of polynomials a(x) and b(x) in Q[x].
*
* @param a first polynomial in x (dividend)
* @param b second polynomial in x (divisor)
* @param x a and b are polynomials in x
* @param check_args check whether a and b are polynomials with rational
* coefficients (defaults to "true")
- * @return pseudo-remainder of a(x) and b(x) in Z[x] */
+ * @return pseudo-remainder of a(x) and b(x) in Q[x] */
ex prem(const ex &a, const ex &b, const symbol &x, bool check_args)
{
if (b.is_zero())
}
-/** Sparse pseudo-remainder of polynomials a(x) and b(x) in Z[x].
+/** Sparse pseudo-remainder of polynomials a(x) and b(x) in Q[x].
*
* @param a first polynomial in x (dividend)
* @param b second polynomial in x (divisor)
* @param x a and b are polynomials in x
* @param check_args check whether a and b are polynomials with rational
* coefficients (defaults to "true")
- * @return sparse pseudo-remainder of a(x) and b(x) in Z[x] */
+ * @return sparse pseudo-remainder of a(x) and b(x) in Q[x] */
ex sprem(const ex &a, const ex &b, const symbol &x, bool check_args)
{
if (b.is_zero())
// Decompose rational function a(x)=N(x)/D(x) into Q(x)+R(x)/D(x) with degree(R, x) < degree(D, x)
extern ex decomp_rational(const ex &a, const symbol &x);
-// Pseudo-remainder of polynomials a(x) and b(x) in Z[x]
+// Pseudo-remainder of polynomials a(x) and b(x) in Q[x]
extern ex prem(const ex &a, const ex &b, const symbol &x, bool check_args = true);
+// Pseudo-remainder of polynomials a(x) and b(x) in Q[x]
+extern ex sprem(const ex &a, const ex &b, const symbol &x, bool check_args = true);
+
// Exact polynomial division of a(X) by b(X) in Q[X] (quotient returned in q), returns false when exact division fails
extern bool divide(const ex &a, const ex &b, ex &q, bool check_args = true);
.BI series( expression ", " relation-or-symbol ", " order )
\- series expansion
.br
+.BI sprem( expression ", " expression ", " symbol )
+\- sparse pseudo-remainder of polynomials
+.br
.BI sqrfree( "expression [" ", " symbol-list] )
\- square-free factorization of a polynomial
.br
return e[0].series(e[1], ex_to<numeric>(e[2]).to_int());
}
+static ex f_sprem(const exprseq &e)
+{
+ CHECK_ARG(2, symbol, sprem);
+ return sprem(e[0], e[1], ex_to<symbol>(e[2]));
+}
+
static ex f_sqrfree2(const exprseq &e)
{
CHECK_ARG(1, lst, sqrfree);
{"quo", fcn_desc(f_quo, 3)},
{"rem", fcn_desc(f_rem, 3)},
{"series", fcn_desc(f_series, 3)},
+ {"sprem", fcn_desc(f_sprem, 3)},
{"sqrfree", fcn_desc(f_sqrfree1, 1)},
{"sqrfree", fcn_desc(f_sqrfree2, 2)},
{"sqrt", fcn_desc(f_sqrt, 1)},