>> I don't think you can have automated conversion like C(a^2 + b^2) since it
>> makes sense to define:
>> sage: C = CombinatorialFreeModule(QQ, [ a^2, b^2, a*b, a^2+b^2 ])
>> sage: 2*C.basis()[a^2] + C.basis()[b^2]
>> B[b^2] + 2*B[a^2]
>> sage: 2*C.basis()[a^2] + C.basis()[b^2 + a^2]
>> 2*B[a^2] + B[a^2 + b^2]
>>
>> Then C(a^2 + b^2) would be ambiguous.
>
> I gathered some of this from the examples and documentation, but 
> unfortunately it makes this not so useful for my purpose, which is 
> realizing a finite-dimensional quotient QQ[x1, ... ,xn]/I as a vector space 
> over QQ.  One can do this by hand, but it gets old fast :(  Can one index 
> by infinite sets with this code?

Sure ! 
sage: C = CombinatorialFreeModule(QQ, Permutations())
sage: C.basis()[Permutation(range(1, 100))]
B[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 
62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 
82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]]

Note that here since Permutations() is more than a list (it a close to be a
parent with elements, and will become), a much simpler conversion syntax can
be used:

sage: C([1,2,3]) + C([1,2]) + C(range(1, 100))
B[[1, 2]] + B[[1, 2, 3]] + B[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 
75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 
95, 96, 97, 98, 99]]

So maybe this is was you want:

sage: MPR = a.parent(); MPR
Multivariate Polynomial Ring in a, b over Rational Field
sage: C = CombinatorialFreeModule(QQ, MPR)
sage: C(a^2)
B[a^2]
sage: C(a^2)+C(b^2)
B[b^2] + B[a^2]

Cheers,

Florent

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to