On Jun 21, 2010, at 10:53 PM, Matthias Meulien wrote:
I guess that the problem comes from the type of p1, not
being an Expression. So is it possible to cast this p1 to the
Expression class?
A direct conversion like the following works:
sage: p3 = 0
sage: for c in p1.coeffs():
: p3 =
Thanks for helping. I am trying to compute (not numericaly!) the roots
of a quadratic equation build from lagrange_polynomial()...
sage: p2 = SR(-3/4*pi)*x^2 + SR(7/4*pi)*x
sage: p2.roots(x)
[(7/3, 1), (0, 1)]
Now we are back to the original question: Why the following rise a
type error?? I
I guess that the problem comes from the type of p1, not
being an Expression. So is it possible to cast this p1 to the
Expression class?
A direct conversion like the following works:
sage: p3 = 0
sage: for c in p1.coeffs():
: p3 = x*p3 + c
:
sage: p3
-3/4*pi + 7/4*pi*x
sage:
Thanks for helping. I am trying to compute (not numericaly!) the roots
of a quadratic equation build from lagrange_polynomial()...
sage: p2 = SR(-3/4*pi)*x^2 + SR(7/4*pi)*x
sage: p2.roots(x)
[(7/3, 1), (0, 1)]
Now we are back to the original question: Why the following rise a
type error?? I
It works for me in Sage 4.3.3 and in 4.4.2.
--
| Sage Version 4.3.3, Release Date: 2010-02-21 |
| Type notebook() for the GUI, and license() for information.|
On 21 juin, 08:56, Wilfried Huss h...@finanz.math.tugraz.at wrote:
It works for me in Sage 4.3.3 and in 4.4.2.
You mean the call to polynomial.roots(x) did not launch any
exceptions?
It is not clear from your answer: I can't find a call to
polynomial.roots(x) in your session...
--
To post to
On Jun 20, 6:50 pm, Matthias Meulien oron...@gmail.com wrote:
Hi,
I can't figure out why the following commands ends with a TypeError
exception.
sage: basering = PolynomialRing(SR, 'x')
sage: polynomial = basering.lagrange_polynomial([(0,0), (1,pi), (2, pi/
2)])
sage: