Michel <michel.vandenbe...@uhasselt.be> writes: > Hi Nicolas, > > A long time ago I made a FractionFIeld implementation which would > cache factorizations of denominators. instead of taking gcd's all the > time > > http://markmail.org/message/7hxox5cbz5knxjse#query:new%20implementation%20of%20fraction%20field+page:1+mid:5bf3l37bsim34m4g+state:results > > It is usually much faster than the naive implementation but it is > possible to make examples where it is slower (see the above > thread). That's why it was rejected.
Maybe there is a way to make Sage do it as in FriCAS: (please excuse the ASCII art) (1) -> a: FRAC FR INT (2) -> a := 12/25 2 2 3 (2) --- 2 5 Type: Fraction(Factored(Integer)) (3) -> a * 5 2 2 3 (3) --- 5 Type: Fraction(Factored(Integer)) In words: Fraction is a domain constructor that takes any integral domain and returns it's field of fractions. Factored is a domain constructor that takes an integral domain, and tries to keep its elements in factored form as long as possible. (and I hurry to add that I'd rather have something like: Factored is a domain constructor that takes a unique factorisation domain, and keeps its elements in factored form) On Mar 9, 6:05 am, "Nicolas M. Thiery" <nicolas.thi...@u-psud.fr> wrote: > I am manipulating univariate fractions in A[t] where A is a ring (say > QQ[x1,...,xn]), and all the denominators factor nicely in many small > terms like (1-x1 t) * (1 - 2*x2*t - (x3*x4) t^4) * ... I need to do > ring operations (products, sums, ...), and to have the result reduced > to the form A/B (if possible with A prime to B) > > So far, I am working in FractionField(A[t]). However, the expansion of > the denominators give many many terms, and is a computation killer. There is also a domain LocalAlgebra, that allows fraction as Nicolas wants them, but it would need (a tiny little bit of) work, because it requires that the numerators form an algebra over the denominators, and it is nowhere stated that Integer has Algebra Factored Integer. The code is in fricas/src/algebra/fraction.spad.pamphlet, in case it helps. I admit that I still do not understand the Sage model of types... Martin --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---