[GiNaC-list] Bug in numer_denom?

Richard B. Kreckel kreckel at ginac.de
Wed Nov 17 01:06:39 CET 2010


Hi!

On 11/10/2010 04:22 PM, Ernst Moritz Hahn wrote:
> I think there is a problem with the numer_denom function with large
> polynomial fractions. I added "bug.txt" to the attachment, which is an
> input file for ginsh. Using the version of GiNaC shipped with current
> stable Ubuntu, I get the result "out-installed". Here, "/" is contained
> in numerator and denominator, which should not be the case, if I
> understood the functionality of numer_denom right. Using git version of
> GiNaC, I get "out-git.txt". Here, braces are used in numerator and
> denominator, which also seems strange to me.
>
> Do I understand something wrong or is this a bug?

Is anything wrong? I don't know. Please, try to reduce example output 
you send to the mailing list as much as possible. Nobody wants to 
discussing output of excessive length.

There is nothing wrong with brackets in numerator and denominator, I 
would say. The functions numer(), denom() and numer_denom() do not claim 
to expand their results, right? Here is a simpler variant:
 > numer_denom((1+a)*c/2);
{(1+a)*c,2}
 > numer((1+a)*c/2);
(1+a)*c
 > denom((1+a)*c/2);
2

On the other hand, the result computed by the installed version leaves 
room for improvement, as it treats numerator and denominator as 
polynomials over the rationals, as opposed to polynomials over the integers.

This change in behavior seems to be a consequence of Alexei Sheplyakov's 
patch edf1ae46a926d0a718063c149b78c1b9a7ec2043. It first featured in 
release 1.5.8.

Bye!
   -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>


More information about the GiNaC-list mailing list