On 01/08/2010 03:51 AM, Waldek Hebisch wrote:
Ralf Hemmecke wrote:
Should I apply the following patch?:
prime? n ==
n< 0 => n := -n
n< two => false
Why not just write
prime? x == prime?(abs x)$IntegerPrimesPackage(%)
Your way would make 'prime?$Integer' and 'prime?$IntegerPrimesPackage'
incompatible, which may be confusing.
Then you have misunderstood my note in
http://groups.google.com/group/fricas-devel/msg/8101eaff595fb5f8?hl=en
These two function must be different. By definition, i.e. documentation.
Yes, there is confusion. One of the confusing things is that the
function in IntegerPrimesPackage is called prime?. It should better be
called
rabinPrime?
or something that makes a bit more clear that it is a probabilistic test
on numbers > 0.
Note that IntegerPrimesPackage is just a package and thus functions need
not have names that one would expect in a mathematical context.
A different name would make it also more obvious that
prime? x == rabinPrime?(x)$IntegerPrimesPackage(%)
is a bug because of different documentation of
prime?$UniqueFactorizationDomain and rabinPrime?$IntegerPrimesPackage.
I even disregard here that rabinPrime? is probabilistic. Just the lines
++ \spad{prime?(n)} returns true if n is prime and false if not.
++ (reference: Knuth Volume 2 Semi Numerical Algorithms).
. But how is "n is prime" in I: IntegerNumberSystem actually defined?
I'm not sure that every mathematician in the world would immediately say
that -5 is a prime integer.
If Martin's patch goes in, also the documentation in
IntegerPrimesPackage should be changed appropriately. Currently it says
nothing about negative numbers, but an appropriate note would clarify
the situation.
Side remark: Note that according to
http://mathworld.wolfram.com/PrimeElement.html
the documentation for prime?$UniqueFactorizationDomain is actually
testing for irreducibility.
That
x irreducible implies x prime
in unique factorization domains is a theorem.
Ralf
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.