From: Christian Bauer Date: Tue, 29 Oct 2002 19:03:35 +0000 (+0000) Subject: synced to 1.0 X-Git-Tag: release_1-1-0~58 X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=commitdiff_plain;h=c10e69042ed63fd19333fb1c3931001d11537b3c;p=ginac.git synced to 1.0 --- diff --git a/ginac/normal.cpp b/ginac/normal.cpp index c936b566..063ad69a 100644 --- a/ginac/normal.cpp +++ b/ginac/normal.cpp @@ -472,14 +472,14 @@ 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]. * * @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()) @@ -524,14 +524,14 @@ ex prem(const ex &a, const ex &b, const symbol &x, bool check_args) } -/** 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()) diff --git a/ginac/normal.h b/ginac/normal.h index 71bf7548..be67d8eb 100644 --- a/ginac/normal.h +++ b/ginac/normal.h @@ -42,9 +42,12 @@ extern ex rem(const ex &a, const ex &b, const symbol &x, bool check_args = true) // 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); diff --git a/ginsh/ginsh.1.in b/ginsh/ginsh.1.in index 9f797f57..e5202138 100644 --- a/ginsh/ginsh.1.in +++ b/ginsh/ginsh.1.in @@ -342,6 +342,9 @@ detail here. Please refer to the GiNaC documentation. .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 diff --git a/ginsh/ginsh_parser.yy b/ginsh/ginsh_parser.yy index 162f4564..fb644351 100644 --- a/ginsh/ginsh_parser.yy +++ b/ginsh/ginsh_parser.yy @@ -479,6 +479,12 @@ static ex f_series(const exprseq &e) return e[0].series(e[1], ex_to(e[2]).to_int()); } +static ex f_sprem(const exprseq &e) +{ + CHECK_ARG(2, symbol, sprem); + return sprem(e[0], e[1], ex_to(e[2])); +} + static ex f_sqrfree2(const exprseq &e) { CHECK_ARG(1, lst, sqrfree); @@ -571,6 +577,7 @@ static const fcn_init builtin_fcns[] = { {"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)},