#9787: lagrange_polynomial(algorithm='divided_difference') fails over finite
fields
-------------------------------------+-------------------------------------
Reporter: mmezzarobba | Owner: AlexGhitza
Type: defect | Status: needs_review
Priority: minor | Milestone: sage-6.4
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: Peter Bruin | Reviewers: Miguel Marco
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/pbruin/9787-lagrange_polynomial | 57f432cfe194c56c1b258a2d37046d67b15b82ab
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by pbruin):
Replying to [comment:11 mmarco]:
> Well, you could have that even now:
>
> {{{
> sage: R.<x>=QQ[]
> sage: R.lagrange_polynomial(((1,1.75),(2,0.2),(3,1.5)))
> 1.42500000000000*x^2 - 5.82500000000000*x + 6.15000000000000
> }}}
Actually, with this branch, you get
{{{
sage: R.<x>=QQ[]
sage: R.lagrange_polynomial(((1,1.75),(2,0.2),(3,1.5)))
57/40*x^2 - 233/40*x + 123/20
}}}
This is not ideal from my point of view (I would prefer to use `coerce` to
put the coefficients into the base field of `R`, so this example would
raise an error), but a doctest in a published book unfortunately depends
on it.
> You can either catch that and raise an exception (which is probably the
mathematically strictly correct), or be more flexible and allow situations
like the previous (which, i think, can be useful in several cases).
I see that this could be the expected behaviour given the general
permissiveness in Sage with respect to extending parents, but I would
still find it strange if `R.lagrange_polynomial()` did not return a value
in `R` but in a different ring depending on the input. It would mean that
`lagrange_polynomial()` basically had no relation to `R`. If there were a
standalone function `lagrange_polynomial()`, then it would be logical if
`lagrange_polynomial()` returned a polynomial in a parent depending on the
input, but the explicit presence of `R` in the notation
`R.lagrange_polynomial()` does suggest to me that it should always return
a polynomial in `R`.
--
Ticket URL: <http://trac.sagemath.org/ticket/9787#comment:12>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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-trac.
For more options, visit https://groups.google.com/d/optout.