1 | initial version |
You want I.normal_basis(). The documentation is abysmal (both in Sage and for the underlying Singular routine). In practice it appears that the leading term g.lt() of the result of g=I.reduce(f) belongs to I.normal_basis(). So, you can subtract that off, reduce the result, pick off the next leading term, etc. to get the coefficients you're after. You can of course use a change of basis matrix to use your own preferred basis. For certain nice quotients I.reduce(f) yields an expression that's a linear combination of I.normal_basis(), but sometimes I've had to use the iterative approach. It's never been enough of a bottleneck for me to investigate what's actually going on (i.e. read Singular's kbase method's source code), and there's at least no correctness concerns with this approach.