On Tuesday 30 April 2002 08:34, you wrote:
> Osman:
> > How about if we adapt pari-gp for number theory calcs (primality
> > etc). It is written in c and very fast. This way maxima can
> > concentrate on symbolic calculations. I thought Bill was working on
> > this.
>
> That would be a good idea, although IMO, primality tests are simple
> enough to require very little lisp coding, and we would avoid foreign
> function calls.
Have a look what you are up to, then. (It's quite lengthy but I think it's
also quite impressive):
jt@Bachue:~$ gp
Reading GPRC: /etc/gprc ...Done.
GP/PARI CALCULATOR Version 2.1.3 (released)
i686 running linux (ix86 kernel) 32-bit version
(readline v4.2a enabled, extended help available)
Copyright (C) 2000 The PARI Group
PARI/GP is free software, covered by the GNU General Public License, and
comes WITHOUT ANY WARRANTY WHATSOEVER.
Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.
realprecision = 28 significant digits
seriesprecision = 16 significant terms
format = g0.28
parisize = 4000000, primelimit = 500000
? ?isprime
isprime(x,{flag=0}): if flag is omitted or 0 true(1) if x is a strong
pseudoprime for 10 random bases, false(0) if not. If flag is 1 the
primality is certified by Pocklington-Lehmer Test. If flag is 2 a
primality certificate is output(see manual).
? #
timer = 1 (on) ?
isprime(340282366762482138434845932244680310783)
time = 0 ms. %1 = 1
? isprime(340282366762482138434845932244680310783,2) time
= 30 ms. %2 =
[2 3 1]
[3 3 1]
[7 2 1]
[2700653704464143955832110573370478657 2 [2, 3, 1; 11, 2, 1; 31, 2, 1; 151,
2, 1; 331, 2, 1; 11131, 2, 1; 222431055585633101740979, 2, [2, 2, 1; 67, 2,
1; 367565879, 2, 1; 4516015619173, 2, 1]]]
?
nextprime(340282366762482138434845932244680310783340282366762482138434845932244680310783)
time = 90 ms.
%3 =
340282366762482138434845932244680310783340282366762482138434845932244680311131
? isprime(%3)
time = 10 ms.
%4 = 1
? isprime(%3,2)
time = 5,520 ms. %5 =
[2 2 1]
[5 2 1]
[29 2 1]
[40461636951543654986307483025526790818470901589389117971276438279696156993 2
[2, 5, 1; 3, 2, 1; 11, 3, 1; 17, 2, 1; 313, 2, 1; 417511, 2, 1; 3804613, 2,
1; 2266615563735703965159207059875397677533703572174753247, 2, [2, 3, 1; 3,
2, 1; 19, 2, 1; 29, 2, 1; 59, 2, 1; 56516137616683, 2, 1;
205612981998617840474316116940995803, 2, [2, 2, 1; 3, 2, 1; 7, 2, 1; 58741,
2, 1; 1444615979, 2, 1; 57690923535881936479, 2, [2, 3, 1; 3, 2, 1; 31, 2, 1;
149, 2, 1; 383, 2, 1; 1130281, 2, 1]]]]]
?
nextprime(340282366762482138434845932244680310783340282366762482138434845932244680310783340282366762482138434845932244680310783)
time = 80 ms.
%6 =
340282366762482138434845932244680310783340282366762482138434845932244680310783340282366762482138434845932244680310871
? isprime(%6)
time = 30 ms.
%7 = 1
? isprime(%6,2)
time = 1mn, 480 ms. %8 =
[2 3 1]
[3 2 1]
[5 2 1]
[53 2 1]
[9743 2 1]
[186679 2 1]
[39222285572291267824909827170910862369006457905572783654873455907907423543064484605710650380734201509523
2 [2, 2, 1; 3, 2, 1; 71, 2, 1; 9209, 2, 1; 3644591216965781, 2, [2, 2, 1; 5,
2, 1; 19, 2, 1; 9591029518331, 2, 1];
914409535750728686313946245317032361442035056899307632427176843547626857490260531,
2, [2, 2, 1; 5, 5, 1;
91440953575072868631394624531703236144203505689930763242717684354762685749026053,
2, [2, 2, 1; 3, 2, 1; 8498987407, 2, 1;
896586746123814526000613166650611127955786149904994629621976451242853, 2, [2,
2, 1; 347, 2, 1; 4004832194199029, 2, [2, 2, 1; 29, 2, 1; 61, 2, 1; 227, 2,
1; 85975091, 2, 1]; 161294116118260018661232913858066359658988806001551, 2,
[2, 3, 1; 3, 3, 1; 5, 3, 1; 7, 2, 1; 6121, 2, 1; 3577597, 2, 1;
7014802186857898911739622615733407303, 2, [2, 5, 1; 11, 2, 1; 17, 2, 1;
15437060381, 2, 1; 1215008241006759997427533, 2, [2, 2, 1; 3, 2, 1; 7, 2, 1;
7927, 2, 1; 8429, 2, 1; 24053180819309, 2, 1]]]]]]]]
> If this approach looks interesting for enough people,
> I am eager to start working on this (I am trying to learn lisp by now,
> and anyway the gurus in the list are surely kind enough to correct
> my mistakes).
>
> That is what I think. I guess Bill was trying to include pari-gp into
> gcl more than maxima, and that is pretty-hard-coding job! My suggestion
> right now is: stick to lisp and add things by little and little.
>
> Any other opinions?
How about calling gp from maxima. Those who need the stuff from pari I'm
sure are willing to learn what they need (pari has an excellent help
system), and one could avoid (nearly) all the trouble with every new version
of pari. And i don't think it eats up to much RAM (I sorted by age, so there
should be no hidden pari call):
12578 jt 9 0 4092 4092 1572 S 0.0 0.7 0:00 gp
12573 jt 9 0 4436 4436 1096 S 0.0 0.8 0:00 lisp.run
12572 jt 9 0 1044 1044 804 S 0.0 0.2 0:00 maxima-run-lisp
Jürgen