Bill Allombert on Mon, 14 Jan 2008 20:57:04 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Feature request: apply() for RFRAC


On Sat, Jan 12, 2008 at 12:15:41AM +0100, Jeroen Demeyer wrote:
> Hello developers,
> 
> Would it be possible to implement apply() for RFRAC's, so apply(f,x)
> should be the same as apply(f,numerator(x)) / apply(f,denominator(x)).

This is slightly semantically dangerous:

RFRAC does not always have a canonical representation, so the 
operation would not be well-defined if f is not homogenous.

1) What should return apply(x->x^2,z/(1/3*z+1/3)) ?

2) Looks at this example:

? A=(z*(z-Mod(a,a^2+1.)))/(z^2+1.)
%1 = (z^2 + Mod(-a, a^2 + 1.0000000000000000000000000000000000000)*z)/(z^2 + 1.0000000000000000000000000000000000000)
? B=z/(z+Mod(a,a^2+1.))
%2 = z/(z + Mod(a, a^2 + 1.0000000000000000000000000000000000000))
? A==B
%3 = 1
? applyr(f,x)=apply(f,numerator(x)) / apply(f,denominator(x));
? applyr(x->x^2,A)==applyr(x->x^2,B)
%5 = 0

This shows that applyr is not functionnal.

Cheers,
Bill.