I'm not looking for a workaround.  I know it happens.  I can watch out for 
it.

I am really hoping that there is an improvement to make Sage behave better. 
 Sage should be a good Computer Algebra System, but for examples like this 
it really pretty poor.  Moreover, I am sure that other users will run into 
this same example and perhaps not notice that the coefficients 1 are 
disappearing (because in the case I first ran into it, the output was pages 
long).

Let me give you another example of how I think Sage is not good at being a 
CAS:
sage: (q,t)=QQ['q','t'].fraction_field().gens()
sage: a = (-q^5)/(-t^3)
sage: expand(a)
(-q^5)/(-t^3)
sage: simplify(a)
(-q^5)/(-t^3)

How do I get Sage to realize the output is not "right"?  There is correct 
output and there is output which is helpful.  Sage does the former very 
well, I think that there should be some effort put in the latter.
-Mike

On Friday, 17 April 2015 17:36:23 UTC-4, Travis Scrimshaw wrote:
>
> Hey Mike,
>    At least as a workaround you could do something like this:
>
> sage: s=SymmetricFunctions(QQ).s()
> sage: x = s[2,1] + 2*s[3]
> sage: for i,c in x: print i, factor(c)
> [3] 2
> [2, 1] 1
>
> Best,
> Travis
>
>
> On Wednesday, April 15, 2015 at 5:00:18 PM UTC-4, Mike Zabrocki wrote:
>>
>> Hi all,
>> There is very strange behavior if you want factored coefficients of a 
>> free module.  Let me give an example in the ring of symmetric functions:
>>
>> sage: s=SymmetricFunctions(QQ).s()
>> sage: (s[2,1] + 2*s[3]).map_coefficients(factor)
>> 2*s[3]
>>
>> What is happening here is that 'factor' returns a factorization object. 
>>  factor(1) is an empty list and hence is 'false'.  Now if you look at the 
>> code for 's._from_dict' it removes objects which are empty.
>>
>> If you look at the documentation for 'map_coefficients' you can see that 
>> this is not technically a bug because map_coefficients needs to be an 
>> endofunction on the coefficient ring.  In this case, factor is mapping from 
>> QQ to factor objects and so I wouldn't want to play with the result of that 
>> command.  On the other hand, in symmetric functions (especially with 
>> multiple parameters like Macdonald or Hall-Littlewood) one would frequently 
>> like to factor coefficients to know that the coefficients have a nice form.
>>
>> Does anyone have any suggestions about what should happen with this case?
>> I was discussing it with a few people, but we ruled out changing 
>> factor, map_coefficients or _from_dict.
>>
>> I find that to work with coefficients in a polynomial ring, the functions 
>> factor, simplify, expand are unsatisfactory because the output is rarely in 
>> a form that shows me what I want to see (Maple and Mathematica seem better 
>> at this).  Perhaps what I would like to have is a function 'niceify' that 
>> displays a coefficient in a pretty form.
>>
>

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

Reply via email to