vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

Why is some integer in denominator kept in bracket? #315

Open zhaoli-IHEP opened 5 years ago

zhaoli-IHEP commented 5 years ago

In some cases two integer denominators are not combined, so the result rational number looks strange. For example

symbol x;
Local expression = 22400/27/(2 + x)/(4 + x);
.sort
Local expr = expression*replace_(x,134);
.sort
print;
.end

This gives expr = 2800/459/(138);

jodavies commented 5 years ago

This is because they are still inside the internal denominator function. If you rename this, as in

CFunction den;
Denominators den;

You can see what is happening.

You can then use something like

Identify den(x?number_) = 1/x;

to get rid of them.

tueda commented 5 years ago

Indeed, to me, this seems to be a "normalization" bug related to the denom_ function. (Note that 22400/27/(2 + x)/(4 + x) is internally 22400/27*denom_(2 + x)*denom_(4 + x), as Josh mentioned.)

As a workaround, you can insert

argument;
endargument;

after the replacement, which should turn remaining denom_(integer) to be 1/integer.

zhaoli-IHEP commented 5 years ago

Thank you so much!