Currently, evaluating a polynomial ring element on a symbolic expression
returns a result in Horner form:
sage: pol = QQ['x'](range(10))
sage: pol(x)
((((((((9*x + 8)*x + 7)*x + 6)*x + 5)*x + 4)*x + 3)*x + 2)*x + 1)*x
This behavior is of course a side effect of the default generic
evaluation algorithm, and I don't think that's the result users would
expect. But it is also documented (well, somehow) as a feature, in the
sense that calculus/wester.py contains:
sage: # (YES) Convert the above to Horner's form.
sage: # Verify(Horner(p, x), ((((a[5]*x+a[4])*x
sage: # +a[3])*x+a[2])*x+a[1])*x);
sage: # We use the trick of evaluating the algebraic poly at a symbolic
variable:
sage: restore('x')
sage: p(x)
((((a4*x + a3)*x + a2)*x + a1)*x + a0)*x
And afaik there is no other way to put a symbolic polynomial in Horner
form.
So, what do you think: is it okay to change this behavior?
--
Marc
--
You received this message because you are subscribed to the Google Groups
"sage-devel" 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-devel.
For more options, visit https://groups.google.com/d/optout.