Determinant of Large Matrix

Dustan DustanGroups at gmail.com
Wed Jun 6 11:20:57 EDT 2007


On Jun 6, 6:47 am, Tommy Nordgren <tommy.nordg... at comhem.se> wrote:
> On 6 jun 2007, at 13.10, James Stroud wrote:
>
>
>
> > Hello All,
>
> > I'm using numpy to calculate determinants of matrices that look like
> > this (13x13):
>
> > [[ 0.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.]
> >   [ 1.  0.  1.  4.  1.  9.  4.  4.  1.  1.  4.  9.  4.  9.]
> >   [ 1.  1.  0.  1.  4.  4.  9.  9.  4.  4.  1.  4.  1.  4.]
> >   [ 1.  4.  1.  0.  9.  1.  4.  4.  9.  1.  4.  1.  4.  1.]
> >   [ 1.  1.  4.  9.  0.  4.  4.  4.  1.  4.  1.  9.  4.  9.]
> >   [ 1.  9.  4.  1.  4.  0.  4.  4.  9.  4.  1.  1.  4.  1.]
> >   [ 1.  4.  9.  4.  4.  4.  0.  1.  1.  1.  9.  1.  9.  4.]
> >   [ 1.  4.  9.  4.  4.  4.  1.  0.  4.  1.  9.  4.  4.  1.]
> >   [ 1.  1.  4.  9.  1.  9.  1.  4.  0.  4.  4.  4.  4.  9.]
> >   [ 1.  1.  4.  1.  4.  4.  1.  1.  4.  0.  9.  4.  9.  4.]
> >   [ 1.  4.  1.  4.  1.  1.  9.  9.  4.  9.  0.  4.  1.  4.]
> >   [ 1.  9.  4.  1.  9.  1.  1.  4.  4.  4.  4.  0.  4.  1.]
> >   [ 1.  4.  1.  4.  4.  4.  9.  4.  4.  9.  1.  4.  0.  1.]
> >   [ 1.  9.  4.  1.  9.  1.  4.  1.  9.  4.  4.  1.  1.  0.]]
>
> > For this matrix, I'm getting this with numpy:
>
> >   2774532095.9999971
>
> > But I have a feeling I'm exceeding the capacity of floats here. Does
> > anyone have an idea for how to treat this? Is it absurd to think I
> > could
> > get a determinant of this matrix? Is there a python package that could
> > help me?
>
> > Many thanks for any answers.
>
> > James
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
>         Are you sure NumPy return float results. As far as I know, it
> returns doubles

I don't know about NumPy, but in general, a python float is a double:
http://docs.python.org/lib/typesnumeric.html
"Floating point numbers are implemented using double in C. All bets on
their precision are off unless you happen to know the machine you are
working with."

> (about 16 digits)
> ------------------------------------------------------
> "Home is not where you are born, but where your heart finds peace" -
> Tommy Nordgren, "The dying old crone"
> tommy.nordg... at comhem.se





More information about the Python-list mailing list