X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fbasic.cpp;h=fb73096fa70a4796e301ade46306d53849d25068;hp=d77e7dc44fe3838f6e8c65765faa19fd583b8dd4;hb=146be3afbf5f340ea81cda30b35b35c158af31c2;hpb=e7cc6a764ff67b5885d6633385fac23ccc1dc9a7;ds=sidebyside diff --git a/ginac/basic.cpp b/ginac/basic.cpp index d77e7dc4..fb73096f 100644 --- a/ginac/basic.cpp +++ b/ginac/basic.cpp @@ -236,19 +236,22 @@ ex basic::map(map_function & f) const /** Return degree of highest power in object s. */ int basic::degree(const ex & s) const { - return 0; + return is_equal(ex_to(s)) ? 1 : 0; } /** Return degree of lowest power in object s. */ int basic::ldegree(const ex & s) const { - return 0; + return is_equal(ex_to(s)) ? 1 : 0; } /** Return coefficient of degree n in object s. */ ex basic::coeff(const ex & s, int n) const { - return n==0 ? *this : _ex0; + if (is_equal(ex_to(s))) + return n==1 ? _ex1 : _ex0; + else + return n==0 ? *this : _ex0; } /** Sort expanded expression in terms of powers of some object(s).