I found coeffs does not work with a general function. It would be of
great help for me to have it fixed. Thank you!
I tested 4.7.0, 4.7.2 and 4.8.0alpha5. None of them work, though 4.7.0
gives slightly different result:
# the following is result of 4.7.2 and 4.8alpha5.
sage: g = function('g', var('t'))
sage: f = 3*g + g**2 + t
sage: f.coeff(g)
3
sage: f.coeffs(g)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/wangyi/<ipython console> in <module>()
/opt/sage/local/lib/python2.6/site-packages/sage/symbolic/expression.so
in sage.symbolic.expression.Expression.coefficients
(sage/symbolic/expression.cpp:19003)()
/opt/sage/local/lib/python2.6/site-packages/sage/symbolic/ring.so in
sage.symbolic.ring.SymbolicRing.var (sage/symbolic/ring.cpp:6342)()
/opt/sage/local/lib/python2.6/site-packages/sage/symbolic/ring.so in
sage.symbolic.ring.SymbolicRing.var (sage/symbolic/ring.cpp:6069)()
ValueError: The name "g(t)" is not a valid Python identifier.
# the following is the result of 4.7.0
sage: f.coeffs(g)
[[g(t)^2 + t + 3*g(t), 0]]
I created a ticket for this,
http://trac.sagemath.org/sage_trac/ticket/12255
You should be able to CC yourself and be notified of any progress.
Oh, sorry, I didn't look very hard at the output, just that it didn't
throw an error.
I've updated the ticket.
If you're interested, anyone can request an account (instructions are on
the trac homepage[1]) and that would allow you to create/modify tickets.