I would go for the FormalSum by default. Users can get the list using list():
sage: s = FormalSum([(1,1/4),(1,-1/5)]) sage: s -1/5 + 1/4 sage: list(s) [(1, -1/5), (1, 1/4)] Or: sage: tuple(f for a,f in list(s)) (-1/5, 1/4) Since in this case all the multiplicities are 1, I would suggest adding (at least) a function to the FormalSum class called (perhaps) support(), returning a tuple, so that we would have sage: s.support() (-1/5, 1/4) John 2008/9/18 John H Palmieri <[EMAIL PROTECTED]>: > > The trac ticket <http://trac.sagemath.org/sage_trac/ticket/4039> > points out that there are two ways in Sage to do partial fraction > decompositions and recommends choosing only one of them. I might be > able to write a patch for this, but I don't know how to choose between > them, so I thought it would make sense to discuss the issue here > first. One way returns a formal sum: > > (x - 3)/((x +1)*(x-1)) --> 2/(x + 1) - 1/(x - 1) > > The other way returns a tuple: > > (x - 3)/((x +1)*(x-1)) --> (0, [-1/(x - 1), 2/(x + 1)]) > > (The '0' is the 'whole' piece, followed by a list of the fractional > parts.) > > So, which is preferable? I actually think it's reasonable to have > both, but I would suggest that f.partial_fraction_decomposition() > should return a formal sum, while > f.partial_fraction_whole_and_parts(), or f.partial_fraction_tuple(), > or something like that, should return a tuple. > > (The actual focus of the ticket is that there should be one name, not > two: partial_fraction and partial_fraction_decomposition. Patching > this is easy, of course, and I would suggest keeping the longer name. > The issue of list vs. formal sum is also mentioned, and that's what > needs discussing.) > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---