[SciPy-user] Characteristic polynomial
Fernando Perez
fperez.net@gmail....
Tue Dec 11 14:05:04 CST 2007
On Dec 11, 2007 9:45 AM, Matthieu Brucher <matthieu.brucher@gmail.com> wrote:
> You can't expect scipy to find the exact coefficients. sage is a symbolic
> package, it will find the correct answers, but scipy will find only an
> approximated one, up to the machine precision. This is what you see in your
> exemple.
> If you have integers, you could expect scipy to return long integers (exact
> result), but this is not the case as almost everything is converted into a
> float array before the actual C or Fortran routine is run.
In this case Sage isn't using anything symbolic though: the issue is
that Sage has from the ground up defined a type system where it knows
what field its inputs are being computed over. So if a matrix is made
up of only integers, it knows that computations are to be performed in
exact arithmetic over Z, and does so accordingly.
Sage's origins are actually number theory, not symbolic computing, and
its strongest area is precisely in exact arithmetic, with enormous
sophistication for some of its algorithms. Initially its (free)
symbolic capabilities were all obtained via calls to Maxima, though
now that Ondrej is actively helping with SymPy integration into Sage,
that is changing and SymPy is natively available as well, which means
that over time there will be more and more native (python) symbolic
support as well.
I'd agree though that for this kind of calculation, Sage is the tool to use.
Cheers,
f
More information about the SciPy-user
mailing list