[GiNaC-list] ldegree changes after expand

Matthias Naaf matthias.naaf at googlemail.com
Fri Jun 1 23:50:48 CEST 2018


Dear All,

I've just hit an unexpected behavior of the ex.ldegree() method in my
application. The problem is that ldegree() gives 0 before and 1 (the
expected value) after calling expand() on the expression. I did not
expect this, as the tutorial says that degree() and ldegree() "work
reliably on non-expanded input polynomials".

A small running example and its output are attached. The expression is
the one I encountered in my application. This looks like a bug to me, or
is it necessary to call expand() before using ldegree()? A related
question: What about coeff(), should I call expand() before using coeff()?

GiNaC version: 1.7.4
g++ version: 7.3.1
openSUSE (tumbleweed)

Thanks in advance for any help on these questions
Matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ldegree.cpp
Type: text/x-c++src
Size: 746 bytes
Desc: not available
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20180601/ccf522d4/attachment.bin>
-------------- next part --------------
e = C-(-1+A-B)*(-1+C-B)

f = C-(-1+A-B)*(1+B)-(-1+A-B)*(-1+C-B)
degree(C): 1
ldegree(C): 0
ldegree(C) after expand: 1


More information about the GiNaC-list mailing list