On Thu, Nov 26, 2009 at 05:29:47AM -0800, YannLC wrote:
> If you only want linear terms, you can also use an univariate
> polynomial ring
> 
> just treat x^i as x_i.
> 
> it's lightning fast and allow you to easily access coefficients.

Variant:

sage: F =CombinatorialFreeModule(QQ, NonNegativeIntegers())
sage: x = F.basis()
sage: x[3] + 2* x[8]
B[3] + 2*B[8]
sage: f = x[3] + 2* x[8]
sage: f[8]
2

This models more straightforwardly your problem. However, it's
currently (by far) not as fast as polynomials. This slowness will be
fixed as soon as the sparse free module code will have been
generalized to handle FreeModule(QQ, infinity).

Best,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

-- 
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