Re: Re: Bug in Det[ ], once more

• To: mathgroup at smc.vnet.net
• Subject: [mg15684] Re: [mg15651] Re: [mg15592] Bug in Det[ ], once more
• From: Daniel Lichtblau <danl>
• Date: Sun, 31 Jan 1999 03:06:07 -0500 (EST)
• References: <199901300928.EAA08936@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Andrzej Kozlowski wrote:
>
> Mathematica's entire mod p arithmetic seems to break down for primes of
> about this magnitude. For example, recently Ted Ersek wrote to point
> out that Together[ ,Modulus->p] breaks down for p larger than 46337 and
> we noticed that most other algebraic functions suffer from the same
> defect. Daniel Lichtblau explained that all this is due to limitations
> of the current inplementation of modular arithmetic. The bug noticed
> buy you appears to be somewhat different (its a "bug" rather than a
> "limitation") but the closeness of the value of p at which it occurs to
> the one where  functions like Factor, PolynomialGCD etc  fail suggests
> that there may be a relationship. Definitely Mathematica's modular
> arithmetic is not useable and should be fixed.
>
> As to whether there are any ways round this problem: I think it depends
> on the concrete problem you are trying to solve. In the example you
> mention the way round is obvious: just do it by hand. In some other
> cases I can imagine it might be possible to use the
> ChineseRemainedrTheorem from the NumberTheoryFunctions package.
>
> On Thu, Jan 28, 1999, David Jedelsky <david.jedelsky at vsb.cz> wrote:
>
> >In Mathematica 3.0
> >
> >Det[{{1,1},{1,1}},Modulus->48611]
> >
> >gives the result 1 instead of 0.
> >It probably holds for all Modulus equal to other primes grater or equal
> >to Prime[4793] and for all matrices with some equal rows.
> >
> >I need this type of computations and I waste a lot of time on this bug.
> >I cannot find any help in Wolfram documents.
> >
> >Is there any patch or other possibility to correct this bug? (
> >Mod[Det[m],p] is really no help )
> >
> >Thanks
> >  David Jedelsky
> >
> >------------
> >david.jedelsky at vsb.cz
>
> Andrzej Kozlowski
> Toyama International University
> JAPAN
> http://sigma.tuins.ac.jp/
> http://eri2.tuins.ac.jp/

I guess I should comment...

>Daniel Lichtblau explained that all this is due to limitations
>of the current inplementation of modular arithmetic.

Actually it is limitations in modular polynomial algebra e.g. taking
gcds and factoring. Modular arithmetic per se is not suffering from
bugs or limitations of any kind so far as I am aware.

The specific problem with

Det[{{1,1},{1,1}},Modulus->48611]

is unrelated. It was an old bug in modular linear algebra, and it was
fixed for our next release. To the best of my recollection it only
afflicts the singular case. Moreover it is not in RowReduce, hence you
can check for singularity by using RowReduce[matrix, Modulus->p]. I'll
grant you this is cumbersome.

It is not entirely coincidental that these issues arise at the same
prime modulus. It has to do with the fact that there are efficient ways
to work for smaller moduli, taking into account the fact that one can
use machine arithmetic to multiply and then reduce mod p when p is
smaller than half the size of a machine integer.

>Definitely Mathematica's modular
>arithmetic is not useable and should be fixed.

Some of the limitations are unfortunate and we should correct them. But
the bug itself was fairly isolated, and as mentioned above it will be
gone after our next release.

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: speed
• Previous by thread: Re: Bug in Det[ ], once more
• Next by thread: use pathname for SetDirectory