Re: [sage-devel] Problem of reduction of rational functions

2018-04-16 Thread John Cremona
On 16 April 2018 at 00:06, Nils Bruin  wrote:

> On Sunday, April 15, 2018 at 3:53:08 PM UTC-7, Dima Pasechnik wrote:
>>
>>
>> It would be nice to have better simplification rules for QQ (and more
>>> generally fraction fields).
>>>
>>
>> I suppose it's only OK to have as an option, as in general computing such
>> a canonical
>> form would be slow, no?
>>
>> For fraction fields of euclidean domains it's not so bad (as
> ZZ['x'].fraction_field() shows).  Furthermore, if you consistently don't
> clear common content from your numerator/denominator pairs you can end up
> with quite bad coefficient blow-up.
>
> Of course, the work-around is to use Z['x'].fraction_field().
>

In this case (one variable, over QQ) it would be simple to extract the
leading coefficients of the numerator and denominator, say a and b, reduce
the rational number a/b to a1/b1, and scale the rational function so that
the new leading coefficients are a1 and b1 which will be coprime integers.
This is simpler than writing numerator and denominator as a rational times
a primitive integral polynomial, though that is probably what users would
prefer.

John


> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Problem of reduction of rational functions

2018-04-16 Thread Dima Pasechnik
in multivariate case things like GCD are certainly very expensive.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Problem of reduction of rational functions

2018-04-15 Thread Nils Bruin
On Sunday, April 15, 2018 at 3:53:08 PM UTC-7, Dima Pasechnik wrote:
>
>
> It would be nice to have better simplification rules for QQ (and more 
>> generally fraction fields). 
>>
>
> I suppose it's only OK to have as an option, as in general computing such 
> a canonical
> form would be slow, no?
>
> For fraction fields of euclidean domains it's not so bad (as 
ZZ['x'].fraction_field() shows).  Furthermore, if you consistently don't 
clear common content from your numerator/denominator pairs you can end up 
with quite bad coefficient blow-up.

Of course, the work-around is to use Z['x'].fraction_field().

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Problem of reduction of rational functions

2018-04-15 Thread Dima Pasechnik


On Sunday, April 15, 2018 at 9:27:40 PM UTC+1, vdelecroix wrote:
>
> The representation is indeed not canonical but the object compare 
> coherently 
>
> sage: R.=QQ[] 
> sage: (2*t+2)/(2*t) 
> (2*t + 2)/(2*t) 
> sage: (2*t+2)/(2*t) == (t+1)/t 
> True 
>
> The reason is that 2 is a unit in QQ. You can compare with 
>
> sage: R.=ZZ[] 
> sage: (2*t+2)/(2*t) 
> (t + 1)/t 
>
> It would be nice to have better simplification rules for QQ (and more 
> generally fraction fields). 
>

I suppose it's only OK to have as an option, as in general computing such a 
canonical
form would be slow, no?

Dima 

>
> Vincent 
>
> On 15/04/2018 21:37, dhr wrote: 
> > Hi 
> > 
> > Reduction of rational functions seems not to work in specific cases. 
> > In the following output, 
> > 
> > === 
> > sage: R.=QQ[] 
> > sage: (2*t+2)/(2*t) 
> > (2*t + 2)/(2*t) 
> > sage: (2*t+2)/(2) 
> > t + 1 
> > sage: (2*t^2+2*t)/(2*t) 
> > t + 1 
> > 
> > === 
> > 2 is not reduced in the first calculation. 
> > 
> > SageMath version 8.1 
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Problem of reduction of rational functions

2018-04-15 Thread Vincent Delecroix

The representation is indeed not canonical but the object compare coherently

sage: R.=QQ[]
sage: (2*t+2)/(2*t)
(2*t + 2)/(2*t)
sage: (2*t+2)/(2*t) == (t+1)/t
True

The reason is that 2 is a unit in QQ. You can compare with

sage: R.=ZZ[]
sage: (2*t+2)/(2*t)
(t + 1)/t

It would be nice to have better simplification rules for QQ (and more
generally fraction fields).

Vincent

On 15/04/2018 21:37, dhr wrote:

Hi

Reduction of rational functions seems not to work in specific cases.
In the following output,

===
sage: R.=QQ[]
sage: (2*t+2)/(2*t)
(2*t + 2)/(2*t)
sage: (2*t+2)/(2)
t + 1
sage: (2*t^2+2*t)/(2*t)
t + 1

===
2 is not reduced in the first calculation.

SageMath version 8.1



--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.