📄 bugfixes and updates to calc.htm
字号:
<LI>3rd January 2001. Added <TT>absmod(a,b)</TT>. Also fixed a small error in
<TT>binform</TT> (in three places, just after the calls to <B>EUCLID</B> in
<TT>lagrange.c</TT>) where <B>n</B> was outputted with the wrong sign.
<LI>23rd December 2000. Withdrew <TT>binform(a,b,c,n)</TT>, as John Robertson
has uncovered bugs. Subsequently fixed a small bug - shifted lines 721,722 to
line 712.
<LI>22nd December 2000. Redesigned and improved <TT>congq</TT>.
<LI>21st December 2000. Fixed bugs in <TT>congq</TT>. Also changed e to l in
lines 1625 and 1655 of primes1.c. This had caused a bus error when typing
sqroot(33,96,&s[],&a,&m) twice in succession! Also noticed a
memory leak at line 1644 because of the argument ZEROI().<BR>Added
<TT>binform(a,b,c,n)</TT>, which solves the diophantine equation
ax<SUP>2</SUP>+bxy+cy<SUP>2</SUP>=n, where b<SUP>2</SUP>-4ac > 0 and is not
a perfect square.
<LI>14th December 2000. Added <TT>congq(a,b,c,n,&s[])</TT>, which solves
the congruence ax<SUP>2</SUP>+bx+c=0(mod n).
<LI>13th December 2000. Tightened up <B>SQROOT_W(...)</B> by creating
<B>SQROOTX(...)</B>.<BR>Also realised that the fix on 7th November was too
severe and would occasionally result in not testing all the ±P<SUB>0</SUB>.
This necessitated a fix starting at line 86 of <TT>lagrange.c</TT>.
<LI>10th December 2000. While investigating a leak of 20 bytes in
<B>SQROOT</B>, I stumbled on a serious error on line 282 of <TT>qres.c</TT>,
where I had freed x!. This had caused CALC to hang on typing
<TT>sqroot(1,105,&s[],&m,&n)</TT>.<BR>I fixed the leak in the
<B>else if (tt == 0){...}</B> starting at line 1573 of <TT>primes1.c</TT>.
<LI>5th December 2000.
<LI>28th November 2000. I had somehow overlooked the degenerate case N=1 in
<B>SQROOT(MPI *A, MPI *N, MPIA *SOL, MPI **MODULUS, USI *lptr)</B>. This
caused a core-dump when calling <TT>patz(15,1)</TT>, for example. Easily fixed
by inserting a few lines of code at line 1520 of <TT>primes1.c</TT>.
<LI>26th November 2000. In <TT>collatz.c</TT>, deleted the <B>fopen</B> of
line 109 and the <B>fclose</B> of line 206. (This was causing a core to be
dumped under linux and possibly dos.)
<LI>10th November 2000.
<LI>7th November 2000. After noticing that <TT>patz(27,18)</TT> was testing
P0=3,9 and 15, instead of just 3 and 9, I inserted a test at line 85 of
<TT>lagrange.c</TT> to pass over any QQ > Q0.
<LI>23rd October 2000. Fixed a bug in <TT>sqroot()</TT> in primes1.c by
replacing line 1565 by <B>S[0]=E;</B>. (The error only manifested itself on a
Linux platform when calling <TT>patz(8,8)</TT>, even though S[0] was
subsequently accessed on line 1580 without possibly having been initialised.)
I also inserted some <B>FREEMPI(S[i])</B> loops inside the <B>if(l==1){}</B>
block.
<LI>3rd September 2000. Fixed an error on line 98 of <TT>lagrange.c</TT>,
where I had Q0_2 instead of Q0. The error showed up in patz(67,89).
<LI>7th August. Changed <TT>log1(a,b,r,e)</TT> to <TT>log1(a,b,d,r,e)</TT>, so
as to give the user the chance to input any positive base d > 1.
<LI>13th July 2000. Replaces "4" by "5" on line 72 of init.c.
<LI>4th July 2000. While checking the numerical examples at the end of <EM>On
the Diophantine equation u<SUP>2</SUP>-Dv<SUP>2</SUP>=±4N</EM>, Bengt Stolt,
Arkiv för Matematik, <B>2</B> 1-23, 1952, I uncovered three simple but
important bugs in CALC: (i) in <TT>primes1.c</TT>: line 1651, <B>*lptr=1;</B>
changed to <B>*lptr=2;</B>, (ii) in <TT>lagrange.c</TT>: line 56, formerly I
had freed <B>M0</B>, then used it on line 83! Moreover I should have been
using <B>M</B> instead of <B>M0</B> in <B>TMP2 = MULT_I(M0, j);</B> in line
83!
<LI>2nd June 2000. Fixed a bug in <TT>sqroot</TT>, which arose in the example
<TT>sqroot(79,42,&[],&m,&l)</TT>. (It returned 8 instead of 4).
The fix was to insert an "if" statement at line 1825 of primes1.c. Could have
corrupted <TT>patz(d,n)</TT>.
<LI>29th May 2000. John Robertson raised doubts concerning about my claim that
a fundamental solution would be found by examining only up to the first period
in the continued fractions for the quadratic irrationalities used in patz(d,n)
in the case where the period length is odd. I now use the second period in
this case. The changes were minimal: an extra parameter <TT>surd_flag</TT> was
added to <TT>SURD()</TT>, so that an extra period is done if and only if
surd_flag = 1. Changes were also made to <TT>SURDX()</TT> and <TT>PATZ()</TT>.
<LI>25th May 2000. Removed two errors in two print statements, improved
printing of output and added printing to a file <TT>patz.out</TT>.
<LI>24th May 2000. Removed a bug on line 93 of lagrange.c, replacing
<STRONG>if ( tmp)</STRONG> by <STRONG>if ((Q0_2)->V[0]) % 2 == 0 &&
tmp)</STRONG>. The bug had caused <TT>patz(5,19)</TT> to declare (12,5) to be
a fundamental solution, whereas the correct answer is (8,3). Also removed the
part of the code made redundant by my new proof of necessity in <A
href="http://www.numbertheory.org/pdfs/patz5.pdf">patz5.pdf</A>, which
rendered unnecessary the need to look at the cases D=2 and 3, N < 0
separately.
<LI>22nd May 2000. Tightened up wrappers for <TT>patz</TT> and
<TT>cornacchia</TT>.
<LI>17th May 2000. Fixed a harmless memory leak of 20 bytes in CONVERGENTS,
where in cases n==0 and n==1, I forgot to FREEMPI(ONE). It propagated through
SURD and thence to PATZ. (This took me over 3 hours to solve!)
<LI>16th May 2000. Fixed a a bug in <TT>patz(d,n)</TT> which occurred when N=1
(pell's equation). Only the fundamental solution with Norm(eta)=-1 had been
printed.
<LI>15th May 2000. Fixed a bug in <TT>sqroot</TT>. (The global variable
<STRONG>sqroot2_number</STRONG> in <TT>SQROOT2()</TT> was not always
reinitialised to a default value zero after use.<BR>Installed <TT>patz</TT>.
This returns the positive fundamental solutions of the diophantine equation
x<SUP>2</SUP>-d*y<SUP>2</SUP>=±1, d > 1, not a perfect square. The
algorithm is from a <A
href="http://www.numbertheory.org/pdfs/patz5.pdf">paper</A> of the author and
is in essence due to Lagrange 1770.
<LI>6th May 2000. Fixed a bug in <TT>surd</TT>.
<LI>4th May 2000. Improved <TT>surd</TT>. Also took some wrapper
functiondeclarations out of fun.h and put them in wrappers.h. Changed SURD,
SURDX, SURDW_W and REDUCED. Also put global MPIA variables A_SURD, U_SURD,
V_SURD in nfunc.c.
<LI>18th April 2000. Added <TT>cornacchia</TT>. Also fixed a bug in
<TT>sqroot</TT> (on line 1532 of primes1.c <TT>e</TT> should have been
<TT>e+1</TT>).
<LI>15th April 2000.
<LI>14th April 2000. Made <TT>sqroot(a,n,&s[ ],&m)</TT> available.
<LI>27th March 2000. Made <TT>log1(a,b,r,e)</TT> available. This is Algorithm
1 of <A href="http://www.numbertheory.org/pdfs/log.pdf">(manuscript-pdf
152K)</A>.
<LI>25th March 2000. Improved the algorithm for <TT>log(a,b,d,u,v,e)</TT>.
This is Algorithm 3 of <A
href="http://www.numbertheory.org/pdfs/log.pdf">(manuscript pdf-152K)</A>.
<LI>20th March 2000. Changed the algorithm for <TT>log()</TT>, as I realised
the earlier algorithm, admittedly heuristic in nature, was not giving the
right answers for log(2<SUP>10</SUP>+1,2,2,1). (See algorithm on page 7 of <!-- <a href="../../pdfs/log.pdf">(pdf 120K)</a>--><A
href="http://www.math.uwaterloo.ca/JIS/VOL5/Jackson/matthews3.html"><EM>On
Shanks' algorithm for computing the continued fraction of
log<SUB>b</SUB>a</EM></A>, Journal of Integer Sequences <B>5</B> 2002, article
02.2.7. .)
<LI>13th March 2000. Added <TT>log()</TT>.
<LI>9th March 2000.
<LI>8th March 2000. Slight alteration to <TT>rootexp()</TT> so as to allow the
user to enter a not necessarily squarefree polynomial. (The polynomial f(X)
entered is replaced by f(X)/gcd(f(X),f'(X)).) calc.tar.gz updated.
<LI>18th February 2000. Sean Seefried fixed a bug in the error recovery for
some functions when not all arguments were entered. This caused a subsequent
crash when the function was subsequently called with the correct number of
arguments. Files parse.y (and parse.c), calc.h and symbol.c were changed.
calc.tar.gz and calc.exe.gz were updated.
<LI>8th February 2000. Fixed a bug in <TT>nprimeap</TT> which arose in the
recent updating of CALC: on line 387 of wrappers.c, FREEMPI(B) should have
been FREEM PI(M). I also noticed a missing "return(NULL);" after line 749 of
func.c. calc.e xe.gz was also updated.
<LI>26th January 2000. Updated the readme in calc.exe.gz. (The description of
<TT>euclid</TT> contained some inaccuracies.)
<LI>23rd January 2000. I updated calc.exe.gz. In so doing I realised that in
the 20th January update, I had forgotten to include some files! Also
Makefile_dos was incorrect. I believe that this is now fixed in the current
version of calc.tar.gz. Also it is possible some bugs have slipped in during
Sean's recent improvements to CALC. Please let me know if any are found.
<LI>20th January 2000. Sean has finished his work on CALC. calc.tar.gz has
been updated. This now includes a DOS makefile based on the djgpp C compiler)
and a file ytab.h=y.tab.h. calc.exe.gz will be updated soon.
<LI>14th January 2000. Progress report: Since mid-December 1999, vacation
scholar Sean Seefried has been working on CALC to improve error recovery. This
has now essentially been finished. Sean has also written a Sturm's algorithm
and in a week's time will have used this to improve <TT>lagrange</TT> so as to
find the simple continued fraction of all roots of a squarefree polynomial
with integer coefficients with no rational roots, using the initial part of a
paper of D.G. Cantor, P.H. Galyean and H.G. Zimmer.
<LI>26th November 1999. Some cosmetic improvements to output were made. In
<TT>surd.out</TT>, the periodic part is now separated from the initial segment
by a colon. Also the quadratic irrational is listed at the top of the
file.<BR>The function <TT>convergents</TT> now outputs the arrays p[ ] and q[
] to a file <TT>convergents.out</TT>.<BR>In parse.y, line 398, <= 0 was
changed to < 0.<BR>
<LI>28th October 1999. Removed the dependence on external files title.dat and
readme, which relied on the <TT>more</TT> command. title.dat has been
incorporated into trial.c, while readme has been turned into readme.c,
accessible inside CALC by typing <TT>help</TT>. A list of all CALC functions
comes up and one can make a selection of a function name. <BR>Also now when a
syntax error happens, CALC now recovers better and appears no longer to hang
after a serious syntax error. All that was done was to insert a call to
execerror(s, ""); in yyerror(s) in parse.c. This returns the user to the
command line prompt. However one is still advised to exit CALC if a syntax
error occurs.<BR>The MSDOS version calc.exe was also updated. <BR>Also files
<TT>title.dat</TT> and <TT>readme</TT> are now incorporated in the executable.
<LI>19th October 1999. Improved <TT>euclid</TT>. It now returns the quotients,
remainders and also the s<SUB>k</SUB> and t<SUB>k</SUB>, as well as the number
of steps. Files i5I.c, parse.y, parse.c and fun.h were altered.<BR>MSDOS
version was also updated.
<LI>28th September 1999. Added <TT>leastqnr(p)</TT> to CALC. This returns
n<SUB>p</SUB>, the least quadratic non-residue (mod p), if n<SUB>p</SUB><
65536, otherwise returns 0. MSDOS version also updated.
<LI>2nd September 1999. Fixed a small bug in <TT>surd()</TT> at line 742 of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -