From: Christian Bauer Date: Mon, 2 Apr 2001 20:57:32 +0000 (+0000) Subject: degree(), ldegree(), coeff(), lcoeff(), tcoeff() and collect() can now X-Git-Tag: release_0-8-1~35 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=a40b470aeccc76b9a6055dc5191805e0bb6f7df2 degree(), ldegree(), coeff(), lcoeff(), tcoeff() and collect() can now be used with constants and indexed expressions as well, so you can use it to collect by powers of Pi or find the coefficient of gamma~0. Limitations: - it only works with symbols, constants and indexed expressions; trying to find the coefficient of, e.g., "x^2" or "x+y" won't work - it does not know about dummy index summations; the coefficient of gamma~0 in p.mu*gamma~mu should be p.0 but is returned as 0 - using the functions on elements of noncommutative products might return wrong or surprising results --- diff --git a/NEWS b/NEWS index 934d6caa..d68d427b 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,21 @@ This file records noteworthy changes. +0.8.1 () +* degree(), ldegree(), coeff(), lcoeff(), tcoeff() and collect() can now + be used with constants and indexed expressions as well, so you can use + it to collect by powers of Pi or find the coefficient of gamma~0. + Limitations: + - it only works with symbols, constants and indexed expressions; + trying to find the coefficient of, e.g., "x^2" or "x+y" won't work + - it does not know about dummy index summations; the coefficient of + gamma~0 in p.mu*gamma~mu should be p.0 but is returned as 0 + - using the functions on elements of noncommutative products might + return wrong or surprising results +* Added preliminary (re)implementations of color and clifford classes. +* simplify_indexed(): contraction of symmetric and antisymmetric tensors + is zero. +* Some bugfixes (indexed objects, archive writing). + 0.8.0 (24 March 2001) * Complete revamp of indexed objects. Instead of multiple classes for indexed things and their indices there is now only one "indexed" class diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index bb8c5cbf..d3a4d992 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -2083,7 +2083,7 @@ being polynomials in the remaining variables. The method @code{collect()} accomplishes this task: @example -ex ex::collect(const symbol & s); +ex ex::collect(const ex & s); @end example Note that the original polynomial needs to be in expanded form in order @@ -2098,8 +2098,8 @@ The degree and low degree of a polynomial can be obtained using the two methods @example -int ex::degree(const symbol & s); -int ex::ldegree(const symbol & s); +int ex::degree(const ex & s); +int ex::ldegree(const ex & s); @end example which also work reliably on non-expanded input polynomials (they even work @@ -2107,14 +2107,14 @@ on rational functions, returning the asymptotic degree). To extract a coefficient with a certain power from an expanded polynomial you use @example -ex ex::coeff(const symbol & s, int n); +ex ex::coeff(const ex & s, int n); @end example You can also obtain the leading and trailing coefficients with the methods @example -ex ex::lcoeff(const symbol & s); -ex ex::tcoeff(const symbol & s); +ex ex::lcoeff(const ex & s); +ex ex::tcoeff(const ex & s); @end example which are equivalent to @code{coeff(s, degree(s))} and @code{coeff(s, ldegree(s))}, diff --git a/ginac/add.cpp b/ginac/add.cpp index 150b4f82..7d73c306 100644 --- a/ginac/add.cpp +++ b/ginac/add.cpp @@ -240,7 +240,7 @@ bool add::info(unsigned inf) const return inherited::info(inf); } -int add::degree(const symbol & s) const +int add::degree(const ex & s) const { int deg = INT_MIN; if (!overall_coeff.is_equal(_ex0())) @@ -255,7 +255,7 @@ int add::degree(const symbol & s) const return deg; } -int add::ldegree(const symbol & s) const +int add::ldegree(const ex & s) const { int deg = INT_MAX; if (!overall_coeff.is_equal(_ex0())) @@ -269,7 +269,7 @@ int add::ldegree(const symbol & s) const return deg; } -ex add::coeff(const symbol & s, int n) const +ex add::coeff(const ex & s, int n) const { epvector coeffseq; coeffseq.reserve(seq.size()); diff --git a/ginac/add.h b/ginac/add.h index 8738bdf3..738d09b3 100644 --- a/ginac/add.h +++ b/ginac/add.h @@ -50,9 +50,9 @@ public: void printraw(std::ostream & os) const; void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence=0) const; bool info(unsigned inf) const; - int degree(const symbol & s) const; - int ldegree(const symbol & s) const; - ex coeff(const symbol & s, int n=1) const; + int degree(const ex & s) const; + int ldegree(const ex & s) const; + ex coeff(const ex & s, int n=1) const; ex eval(int level=0) const; ex series(const relational & r, int order, unsigned options = 0) const; ex normal(lst &sym_lst, lst &repl_lst, int level=0) const; diff --git a/ginac/basic.cpp b/ginac/basic.cpp index 42d1f866..fe1d4ea1 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -242,26 +242,26 @@ bool basic::has(const ex & other) const } /** Return degree of highest power in symbol s. */ -int basic::degree(const symbol & s) const +int basic::degree(const ex & s) const { return 0; } /** Return degree of lowest power in symbol s. */ -int basic::ldegree(const symbol & s) const +int basic::ldegree(const ex & s) const { return 0; } /** Return coefficient of degree n in symbol s. */ -ex basic::coeff(const symbol & s, int n) const +ex basic::coeff(const ex & s, int n) const { return n==0 ? *this : _ex0(); } /** Sort expression in terms of powers of some symbol. * @param s symbol to sort in. */ -ex basic::collect(const symbol & s) const +ex basic::collect(const ex & s) const { ex x; for (int n=this->ldegree(s); n<=this->degree(s); n++) diff --git a/ginac/basic.h b/ginac/basic.h index 2e1aefdf..1f4a4fdc 100644 --- a/ginac/basic.h +++ b/ginac/basic.h @@ -114,10 +114,10 @@ public: // only const functions please (may break reference counting) virtual ex operator[](const ex & index) const; virtual ex operator[](int i) const; virtual bool has(const ex & other) const; - virtual int degree(const symbol & s) const; - virtual int ldegree(const symbol & s) const; - virtual ex coeff(const symbol & s, int n = 1) const; - virtual ex collect(const symbol & s) const; + virtual int degree(const ex & s) const; + virtual int ldegree(const ex & s) const; + virtual ex coeff(const ex & s, int n = 1) const; + virtual ex collect(const ex & s) const; virtual ex eval(int level = 0) const; virtual ex evalf(int level = 0) const; virtual ex series(const relational & r, int order, unsigned options = 0) const; diff --git a/ginac/constant.cpp b/ginac/constant.cpp index 5b2bfebe..5aad78d0 100644 --- a/ginac/constant.cpp +++ b/ginac/constant.cpp @@ -154,6 +154,24 @@ void constant::printcsrc(std::ostream & os, unsigned type, unsigned upper_preced os << name; } +int constant::degree(const ex & s) const +{ + return is_equal(*s.bp) ? 1 : 0; +} + +int constant::ldegree(const ex & s) const +{ + return is_equal(*s.bp) ? 1 : 0; +} + +ex constant::coeff(const ex & s, int n) const +{ + if (is_equal(*s.bp)) + return n==1 ? _ex1() : _ex0(); + else + return n==0 ? *this : _ex0(); +} + ex constant::evalf(int level) const { if (ef!=0) { diff --git a/ginac/constant.h b/ginac/constant.h index b30fc262..d56f2bc8 100644 --- a/ginac/constant.h +++ b/ginac/constant.h @@ -52,6 +52,9 @@ public: void printraw(std::ostream & os) const; void printtree(std::ostream & os, unsigned indent) const; void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence = 0) const; + int degree(const ex & s) const; + int ldegree(const ex & s) const; + ex coeff(const ex & s, int n = 1) const; ex evalf(int level = 0) const; protected: ex derivative(const symbol & s) const; diff --git a/ginac/ex.cpp b/ginac/ex.cpp index 7570618d..f2dab641 100644 --- a/ginac/ex.cpp +++ b/ginac/ex.cpp @@ -179,25 +179,25 @@ bool ex::has(const ex & other) const return bp->has(other); } -int ex::degree(const symbol & s) const +int ex::degree(const ex & s) const { GINAC_ASSERT(bp!=0); return bp->degree(s); } -int ex::ldegree(const symbol & s) const +int ex::ldegree(const ex & s) const { GINAC_ASSERT(bp!=0); return bp->ldegree(s); } -ex ex::coeff(const symbol & s, int n) const +ex ex::coeff(const ex & s, int n) const { GINAC_ASSERT(bp!=0); return bp->coeff(s,n); } -ex ex::collect(const symbol & s) const +ex ex::collect(const ex & s) const { GINAC_ASSERT(bp!=0); return bp->collect(s); diff --git a/ginac/ex.h b/ginac/ex.h index d034dec2..3358c280 100644 --- a/ginac/ex.h +++ b/ginac/ex.h @@ -86,11 +86,11 @@ public: unsigned nops() const; ex expand(unsigned options=0) const; bool has(const ex & other) const; - int degree(const symbol & s) const; - int ldegree(const symbol & s) const; - ex coeff(const symbol & s, int n=1) const; - ex lcoeff(const symbol & s) const { return coeff(s, degree(s)); } - ex tcoeff(const symbol & s) const { return coeff(s, ldegree(s)); } + int degree(const ex & s) const; + int ldegree(const ex & s) const; + ex coeff(const ex & s, int n=1) const; + ex lcoeff(const ex & s) const { return coeff(s, degree(s)); } + ex tcoeff(const ex & s) const { return coeff(s, ldegree(s)); } ex numer(void) const; ex denom(void) const; ex unit(const symbol &x) const; @@ -102,7 +102,7 @@ public: ex to_rational(lst &repl_lst) const; ex smod(const numeric &xi) const; numeric max_coefficient(void) const; - ex collect(const symbol & s) const; + ex collect(const ex & s) const; ex eval(int level = 0) const; ex evalf(int level = 0) const; ex diff(const symbol & s, unsigned nth = 1) const; @@ -338,13 +338,13 @@ inline ex expand(const ex & thisex, unsigned options = 0) inline bool has(const ex & thisex, const ex & other) { return thisex.has(other); } -inline int degree(const ex & thisex, const symbol & s) +inline int degree(const ex & thisex, const ex & s) { return thisex.degree(s); } -inline int ldegree(const ex & thisex, const symbol & s) +inline int ldegree(const ex & thisex, const ex & s) { return thisex.ldegree(s); } -inline ex coeff(const ex & thisex, const symbol & s, int n=1) +inline ex coeff(const ex & thisex, const ex & s, int n=1) { return thisex.coeff(s, n); } inline ex numer(const ex & thisex) @@ -359,7 +359,7 @@ inline ex normal(const ex & thisex, int level=0) inline ex to_rational(const ex & thisex, lst & repl_lst) { return thisex.to_rational(repl_lst); } -inline ex collect(const ex & thisex, const symbol & s) +inline ex collect(const ex & thisex, const ex & s) { return thisex.collect(s); } inline ex eval(const ex & thisex, int level = 0) diff --git a/ginac/indexed.cpp b/ginac/indexed.cpp index e27a7f62..3e333e3f 100644 --- a/ginac/indexed.cpp +++ b/ginac/indexed.cpp @@ -350,6 +350,24 @@ ex indexed::eval(int level) const return base.bp->eval_indexed(*this); } +int indexed::degree(const ex & s) const +{ + return is_equal(*s.bp) ? 1 : 0; +} + +int indexed::ldegree(const ex & s) const +{ + return is_equal(*s.bp) ? 1 : 0; +} + +ex indexed::coeff(const ex & s, int n) const +{ + if (is_equal(*s.bp)) + return n==1 ? _ex1() : _ex0(); + else + return n==0 ? ex(*this) : _ex0(); +} + ex indexed::thisexprseq(const exvector & v) const { return indexed(symmetry, v); diff --git a/ginac/indexed.h b/ginac/indexed.h index 301f2d74..e98375d3 100644 --- a/ginac/indexed.h +++ b/ginac/indexed.h @@ -156,6 +156,9 @@ public: void print(std::ostream & os, unsigned upper_precedence=0) const; bool info(unsigned inf) const; ex eval(int level = 0) const; + int degree(const ex & s) const; + int ldegree(const ex & s) const; + ex coeff(const ex & s, int n = 1) const; exvector get_free_indices(void) const; protected: diff --git a/ginac/mul.cpp b/ginac/mul.cpp index e156a0ff..a00c9c92 100644 --- a/ginac/mul.cpp +++ b/ginac/mul.cpp @@ -247,7 +247,7 @@ bool mul::info(unsigned inf) const return inherited::info(inf); } -int mul::degree(const symbol & s) const +int mul::degree(const ex & s) const { int deg_sum = 0; for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { @@ -257,7 +257,7 @@ int mul::degree(const symbol & s) const return deg_sum; } -int mul::ldegree(const symbol & s) const +int mul::ldegree(const ex & s) const { int deg_sum = 0; for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { @@ -267,7 +267,7 @@ int mul::ldegree(const symbol & s) const return deg_sum; } -ex mul::coeff(const symbol & s, int n) const +ex mul::coeff(const ex & s, int n) const { exvector coeffseq; coeffseq.reserve(seq.size()+1); diff --git a/ginac/mul.h b/ginac/mul.h index c531fd6f..81459a44 100644 --- a/ginac/mul.h +++ b/ginac/mul.h @@ -51,9 +51,9 @@ public: void printraw(std::ostream & os) const; void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence) const; bool info(unsigned inf) const; - int degree(const symbol & s) const; - int ldegree(const symbol & s) const; - ex coeff(const symbol & s, int n = 1) const; + int degree(const ex & s) const; + int ldegree(const ex & s) const; + ex coeff(const ex & s, int n = 1) const; ex eval(int level=0) const; ex evalf(int level=0) const; ex series(const relational & s, int order, unsigned options = 0) const; diff --git a/ginac/ncmul.cpp b/ginac/ncmul.cpp index 12c1d5e4..9892670f 100644 --- a/ginac/ncmul.cpp +++ b/ginac/ncmul.cpp @@ -218,7 +218,7 @@ ex ncmul::expand(unsigned options) const status_flags::expanded); } -int ncmul::degree(const symbol & s) const +int ncmul::degree(const ex & s) const { int deg_sum=0; for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { @@ -227,7 +227,7 @@ int ncmul::degree(const symbol & s) const return deg_sum; } -int ncmul::ldegree(const symbol & s) const +int ncmul::ldegree(const ex & s) const { int deg_sum=0; for (exvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) { @@ -236,7 +236,7 @@ int ncmul::ldegree(const symbol & s) const return deg_sum; } -ex ncmul::coeff(const symbol & s, int n) const +ex ncmul::coeff(const ex & s, int n) const { exvector coeffseq; coeffseq.reserve(seq.size()); diff --git a/ginac/ncmul.h b/ginac/ncmul.h index dd96a891..ec8e5612 100644 --- a/ginac/ncmul.h +++ b/ginac/ncmul.h @@ -57,10 +57,10 @@ public: void printraw(std::ostream & os) const; void printcsrc(std::ostream & os, unsigned type, unsigned upper_precedence = 0) const; bool info(unsigned inf) const; - int degree(const symbol & s) const; - int ldegree(const symbol & s) const; + int degree(const ex & s) const; + int ldegree(const ex & s) const; ex expand(unsigned options=0) const; - ex coeff(const symbol & s, int n=1) const; + ex coeff(const ex & s, int n=1) const; ex eval(int level=0) const; ex subs(const lst & ls, const lst & lr) const; exvector get_free_indices(void) const; diff --git a/ginac/power.cpp b/ginac/power.cpp index 14fac0ad..f5d877e6 100644 --- a/ginac/power.cpp +++ b/ginac/power.cpp @@ -236,10 +236,10 @@ ex & power::let_op(int i) return i==0 ? basis : exponent; } -int power::degree(const symbol & s) const +int power::degree(const ex & s) const { if (is_exactly_of_type(*exponent.bp,numeric)) { - if ((*basis.bp).compare(s)==0) { + if (basis.is_equal(s)) { if (ex_to_numeric(exponent).is_integer()) return ex_to_numeric(exponent).to_int(); else @@ -250,10 +250,10 @@ int power::degree(const symbol & s) const return 0; } -int power::ldegree(const symbol & s) const +int power::ldegree(const ex & s) const { if (is_exactly_of_type(*exponent.bp,numeric)) { - if ((*basis.bp).compare(s)==0) { + if (basis.is_equal(s)) { if (ex_to_numeric(exponent).is_integer()) return ex_to_numeric(exponent).to_int(); else @@ -264,9 +264,9 @@ int power::ldegree(const symbol & s) const return 0; } -ex power::coeff(const symbol & s, int n) const +ex power::coeff(const ex & s, int n) const { - if ((*basis.bp).compare(s)!=0) { + if (!basis.is_equal(s)) { // basis not equal to s if (n == 0) return *this; diff --git a/ginac/power.h b/ginac/power.h index 2c748616..94602911 100644 --- a/ginac/power.h +++ b/ginac/power.h @@ -55,9 +55,9 @@ public: bool info(unsigned inf) const; unsigned nops() const; ex & let_op(int i); - int degree(const symbol & s) const; - int ldegree(const symbol & s) const; - ex coeff(const symbol & s, int n = 1) const; + int degree(const ex & s) const; + int ldegree(const ex & s) const; + ex coeff(const ex & s, int n = 1) const; ex eval(int level=0) const; ex evalf(int level=0) const; ex series(const relational & s, int order, unsigned options = 0) const; diff --git a/ginac/pseries.cpp b/ginac/pseries.cpp index 5a922183..7264d933 100644 --- a/ginac/pseries.cpp +++ b/ginac/pseries.cpp @@ -248,7 +248,7 @@ ex &pseries::let_op(int i) /** Return degree of highest power of the series. This is usually the exponent * of the Order term. If s is not the expansion variable of the series, the * series is examined termwise. */ -int pseries::degree(const symbol &s) const +int pseries::degree(const ex &s) const { if (var.is_equal(s)) { // Return last exponent @@ -276,7 +276,7 @@ int pseries::degree(const symbol &s) const * series is examined termwise. If s is the expansion variable but the * expansion point is not zero the series is not expanded to find the degree. * I.e.: (1-x) + (1-x)^2 + Order((1-x)^3) has ldegree(x) 1, not 0. */ -int pseries::ldegree(const symbol &s) const +int pseries::ldegree(const ex &s) const { if (var.is_equal(s)) { // Return first exponent @@ -306,7 +306,7 @@ int pseries::ldegree(const symbol &s) const * If s is not the expansion variable, an attempt is made to convert the * series to a polynomial and return the corresponding coefficient from * there. */ -ex pseries::coeff(const symbol &s, int n) const +ex pseries::coeff(const ex &s, int n) const { if (var.is_equal(s)) { if (seq.size() == 0) @@ -338,7 +338,7 @@ ex pseries::coeff(const symbol &s, int n) const } /** Does nothing. */ -ex pseries::collect(const symbol &s) const +ex pseries::collect(const ex &s) const { return *this; } @@ -489,7 +489,7 @@ ex basic::series(const relational & r, int order, unsigned options) const numeric fac(1); ex deriv = *this; ex coeff = deriv.subs(r); - const symbol *s = static_cast(r.lhs().bp); + const symbol &s = static_cast(*r.lhs().bp); if (!coeff.is_zero()) seq.push_back(expair(coeff, numeric(0))); @@ -497,7 +497,7 @@ ex basic::series(const relational & r, int order, unsigned options) const int n; for (n=1; n(r.lhs().bp); + ex s = r.lhs(); - if (this->is_equal(*s)) { + if (this->is_equal(*s.bp)) { if (order > 0 && !point.is_zero()) seq.push_back(expair(point, _ex0())); if (order > 1) @@ -680,19 +680,18 @@ ex pseries::mul_series(const pseries &other) const // Series multiplication epvector new_seq; - const symbol *s = static_cast(var.bp); - int a_max = degree(*s); - int b_max = other.degree(*s); - int a_min = ldegree(*s); - int b_min = other.ldegree(*s); + int a_max = degree(var); + int b_max = other.degree(var); + int a_min = ldegree(var); + int b_min = other.ldegree(var); int cdeg_min = a_min + b_min; int cdeg_max = a_max + b_max; int higher_order_a = INT_MAX; int higher_order_b = INT_MAX; - if (is_order_function(coeff(*s, a_max))) + if (is_order_function(coeff(var, a_max))) higher_order_a = a_max + b_min; - if (is_order_function(other.coeff(*s, b_max))) + if (is_order_function(other.coeff(var, b_max))) higher_order_b = b_max + a_min; int higher_order_c = std::min(higher_order_a, higher_order_b); if (cdeg_max >= higher_order_c) @@ -702,8 +701,8 @@ ex pseries::mul_series(const pseries &other) const ex co = _ex0(); // c(i)=a(0)b(i)+...+a(i)b(0) for (int i=a_min; cdeg-i>=b_min; ++i) { - ex a_coeff = coeff(*s, i); - ex b_coeff = other.coeff(*s, cdeg-i); + ex a_coeff = coeff(var, i); + ex b_coeff = other.coeff(var, cdeg-i); if (!is_order_function(a_coeff) && !is_order_function(b_coeff)) co += a_coeff * b_coeff; } @@ -712,7 +711,7 @@ ex pseries::mul_series(const pseries &other) const } if (higher_order_c < INT_MAX) new_seq.push_back(expair(Order(_ex1()), numeric(higher_order_c))); - return pseries(relational(var,point), new_seq); + return pseries(relational(var, point), new_seq); } @@ -785,18 +784,17 @@ ex pseries::power_const(const numeric &p, int deg) const return *this; } - const symbol *s = static_cast(var.bp); - int ldeg = ldegree(*s); + int ldeg = ldegree(var); // Compute coefficients of the powered series exvector co; co.reserve(deg); - co.push_back(power(coeff(*s, ldeg), p)); + co.push_back(power(coeff(var, ldeg), p)); bool all_sums_zero = true; for (int i=1; i(r.lhs().bp); + const symbol &s = static_cast(*r.lhs().bp); - if (var.is_equal(*s) && point.is_equal(p)) { - if (order > degree(*s)) + if (var.is_equal(s) && point.is_equal(p)) { + if (order > degree(s)) return *this; else { epvector new_seq; diff --git a/ginac/pseries.h b/ginac/pseries.h index 20005473..1dd37ffd 100644 --- a/ginac/pseries.h +++ b/ginac/pseries.h @@ -48,10 +48,10 @@ public: unsigned nops(void) const; ex op(int i) const; ex &let_op(int i); - int degree(const symbol &s) const; - int ldegree(const symbol &s) const; - ex coeff(const symbol &s, int n = 1) const; - ex collect(const symbol &s) const; + int degree(const ex &s) const; + int ldegree(const ex &s) const; + ex coeff(const ex &s, int n = 1) const; + ex collect(const ex &s) const; ex eval(int level=0) const; ex evalf(int level=0) const; ex series(const relational & r, int order, unsigned options = 0) const; diff --git a/ginac/symbol.cpp b/ginac/symbol.cpp index 4328d19b..b905a9a9 100644 --- a/ginac/symbol.cpp +++ b/ginac/symbol.cpp @@ -187,19 +187,19 @@ bool symbol::has(const ex & other) const return false; } -int symbol::degree(const symbol & s) const +int symbol::degree(const ex & s) const { - return compare_same_type(s)==0 ? 1 : 0; + return is_equal(*s.bp) ? 1 : 0; } -int symbol::ldegree(const symbol & s) const +int symbol::ldegree(const ex & s) const { - return compare_same_type(s)==0 ? 1 : 0; + return is_equal(*s.bp) ? 1 : 0; } -ex symbol::coeff(const symbol & s, int n) const +ex symbol::coeff(const ex & s, int n) const { - if (compare_same_type(s)==0) + if (is_equal(*s.bp)) return n==1 ? _ex1() : _ex0(); else return n==0 ? *this : _ex0(); diff --git a/ginac/symbol.h b/ginac/symbol.h index 425f85b9..16dcab0c 100644 --- a/ginac/symbol.h +++ b/ginac/symbol.h @@ -79,9 +79,9 @@ public: bool info(unsigned inf) const; ex expand(unsigned options = 0) const; bool has(const ex & other) const; - int degree(const symbol & s) const; - int ldegree(const symbol & s) const; - ex coeff(const symbol & s, int n = 1) const; + int degree(const ex & s) const; + int ldegree(const ex & s) const; + ex coeff(const ex & s, int n = 1) const; ex eval(int level = 0) const; ex series(const relational & s, int order, unsigned options = 0) const; ex normal(lst &sym_lst, lst &repl_lst, int level = 0) const; @@ -126,10 +126,10 @@ inline const symbol &ex_to_symbol(const ex &e) inline void unassign(symbol & symarg) { symarg.unassign(); } -inline int degree(const symbol & a, const symbol & s) +inline int degree(const symbol & a, const ex & s) { return a.degree(s); } -inline int ldegree(const symbol & a, const symbol & s) +inline int ldegree(const symbol & a, const ex & s) { return a.ldegree(s); } } // namespace GiNaC