On Wednesday, April 22, 2015 at 9:06:16 AM UTC-7, Peter Mueller wrote:
>
> While that is what the doc of .coefficient tells, is there any *sane* 
> reason why the parent of a coefficient isn't the field (or ring) of 
> coefficients?
>

With your earlier definitions:

sage: (f+Y*f).coefficient({X:1})
2*a*Y^3 + 2*a*Y^2

As documented, the parent used is required to represent all possible 
outputs. It would be really bad for f.coefficient to change the parent of 
its return value depending on what the result happens to fit in.

I think in your case the most transparent way of obtaining the desired 
coefficient is to use the routine monomial_coefficient, which is referenced 
in the documentation of coefficient.

sage: f.monomial_coefficient(X*Y^2)
2*a

which should be roughly as efficient as f[2,1]. If you need to shave off 
more overhead, you'd probably have to drill into the implementation and 
work with the polynomials using the dictionaries via which they're 
implemented.

I agree that the documentation of sage (and all computer algebra packages I 
know) leaves a lot to be desired, but in this case it looks like the 
failure is in enticing the particular user into reading it properly, not in 
the information being present at the relevant point. So the question then 
becomes one of usability and access to the documentation. If someone at the 
moment is looking into the documentation, perhaps they would be interested 
in knowing from you:
 - what steps did you take to read the documentation on "coefficients"? 
Where did you read it (if at all)?
 - did you notice the phrase about "monomial_coefficient"? did you look it 
up? why (not)?
It might be that "monomial_coefficient" would stand out better if it were a 
hyperlink, but many of our ways of displaying documentation don't make use 
of hyperlinks.

A major problem is that great documentation takes a lot of work and I don't 
think that for anyone contributing to sage presently, there would be any 
professional credit in doing that work. In addition, other computer algebra 
packages that presumably do have a budget for documentation development 
still do a poor job too. It looks like an unsolved problem to me.

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

Reply via email to