On Thu, Sep 18, 2008 at 9:49 AM, John Cremona <[EMAIL PROTECTED]> wrote:
>
> This looks a bit like an additive version of what we already do with
> factorizations.   I wonder if you could clever use the factorization
> class for it?


It's possible somebody might find this useful:

sage: FormalSum([(1,1/4),(1,-1/5)])
-1/5 + 1/4



>
> John
>
> PS I didn't really mean to suggest that you were stuck on the
> mathematics of this!
>
> 2008/9/18 John H Palmieri <[EMAIL PROTECTED]>:
>>
>> On Sep 18, 7:41 am, John H Palmieri <[EMAIL PROTECTED]> wrote:
>>>
>>> It wasn't the mathematics I was looking for, but how to output the
>>> answer once I find it. If Sage computes that 1/20 = 1/4 - 1/5, how do
>>> I get it to print the expression 1/4 - 1/5 without simplifying it to
>>> 1/20?  For example, if I compute the various parts and store them in a
>>> list 'parts', then something naive like 'return sum(parts)' won't
>>> work. How do I return an expression made up of rational numbers, +'s,
>>> and -'s, with no simplification?
>>
>> One answer to my own question: I can define a new class whose
>> instances are rational numbers, but whose repr and latex methods are
>> in terms of their partial fraction decomposition.  Is there a better
>> way to do this?
>>
>>  John
>> >
>>
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@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-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to