• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

MakefileH A D03-May-202212.5 KiB473180

READMEH A D28-Dec-202146.2 KiB1,8371,249

alg_config.calH A D28-Dec-202142 KiB1,5251,419

beer.calH A D28-Dec-20211.5 KiB4741

bernoulli.calH A D28-Dec-20212.5 KiB9485

bernpoly.calH A D28-Dec-20211.4 KiB5647

bigprime.calH A D28-Dec-20211.2 KiB4642

bindingsH A D28-Dec-20211.8 KiB7267

brentsolve.calH A D28-Dec-20215.8 KiB255225

chi.calH A D28-Dec-20215.9 KiB248222

chrem.calH A D28-Dec-20215 KiB204195

constants.calH A D28-Dec-20212.5 KiB10187

deg.calH A D28-Dec-20212.4 KiB135112

dms.calH A D28-Dec-20217.1 KiB365285

dotest.calH A D28-Dec-20215.6 KiB190167

ellip.calH A D28-Dec-20215.9 KiB191173

factorial.calH A D28-Dec-20215.3 KiB201177

factorial2.calH A D28-Dec-202119.1 KiB720648

gvec.calH A D28-Dec-20212.6 KiB10494

hello.calH A D28-Dec-20211.1 KiB3329

hms.calH A D28-Dec-20217 KiB365285

infinities.calH A D28-Dec-20211.8 KiB8976

intfile.calH A D28-Dec-20214.8 KiB219194

intnum.calH A D28-Dec-202119.5 KiB729676

lambertw.calH A D28-Dec-20218.7 KiB285249

linear.calH A D28-Dec-20211.7 KiB5350

lnseries.calH A D28-Dec-20212.9 KiB10993

lucas.calH A D28-Dec-202148.6 KiB1,8471,781

lucas_chk.calH A D28-Dec-202113.7 KiB381363

mersenne.calH A D28-Dec-20211.5 KiB5849

mfactor.calH A D28-Dec-20218.6 KiB316303

mod.calH A D28-Dec-20213.2 KiB214169

natnumset.calH A D28-Dec-202112.3 KiB613545

palindrome.calH A D28-Dec-202113.5 KiB642554

pell.calH A D28-Dec-20211.9 KiB9183

pi.calH A D28-Dec-20213.2 KiB144131

pix.calH A D28-Dec-20211.8 KiB6862

pollard.calH A D28-Dec-20211.3 KiB4945

poly.calH A D28-Dec-202117.6 KiB720665

prompt.calH A D28-Dec-20213.6 KiB116110

psqrt.calH A D28-Dec-20211.7 KiB7166

qtime.calH A D28-Dec-20212.5 KiB8781

quat.calH A D28-Dec-20213.3 KiB224177

randbitrun.calH A D28-Dec-20213.2 KiB119105

randmprime.calH A D28-Dec-20213.6 KiB133123

randombitrun.calH A D28-Dec-20213.2 KiB119105

randomrun.calH A D28-Dec-20213.6 KiB128114

randrun.calH A D28-Dec-20213.6 KiB131116

regress.calH A D28-Dec-2021295.9 KiB8,7978,003

repeat.calH A D28-Dec-20211.6 KiB5045

screen.calH A D28-Dec-20211.5 KiB5856

seedrandom.calH A D28-Dec-20214.5 KiB158146

set8700.calH A D28-Dec-20212 KiB7462

set8700.lineH A D28-Dec-202116.4 KiB426379

smallfactors.calH A D28-Dec-20211.7 KiB7261

solve.calH A D28-Dec-20211.9 KiB6762

specialfunctions.calH A D28-Dec-202131.3 KiB1,4661,337

statistics.calH A D28-Dec-202111.9 KiB499411

strings.calH A D28-Dec-20211.2 KiB4234

sumsq.calH A D28-Dec-20211.6 KiB6257

sumtimes.calH A D28-Dec-20215.2 KiB183150

surd.calH A D28-Dec-20214.3 KiB287231

test1700.calH A D28-Dec-20211 KiB2926

test2300.calH A D28-Dec-20212.3 KiB11394

test2600.calH A D28-Dec-202113.1 KiB613560

test2700.calH A D28-Dec-20217.1 KiB328274

test3100.calH A D28-Dec-20211.4 KiB3734

test3300.calH A D28-Dec-20213 KiB141130

test3400.calH A D28-Dec-20216.8 KiB319292

test3500.calH A D28-Dec-20216.1 KiB292268

test4000.calH A D28-Dec-202110.2 KiB474437

test4100.calH A D28-Dec-202111.1 KiB491455

test4600.calH A D28-Dec-20216.3 KiB322297

test5100.calH A D28-Dec-20212.2 KiB6763

test5200.calH A D28-Dec-20211.5 KiB4945

test8400.calH A D28-Dec-20211.4 KiB4539

test8500.calH A D28-Dec-20215.9 KiB261229

test8600.calH A D28-Dec-202131.4 KiB1,4031,395

test8900.calH A D28-Dec-202171.8 KiB3,1223,036

toomcook.calH A D28-Dec-20217.1 KiB359280

unitfrac.calH A D28-Dec-20211.6 KiB5247

varargs.calH A D28-Dec-20211.3 KiB5145

xx_print.calH A D28-Dec-20214.9 KiB286237

zeta2.calH A D28-Dec-20213.3 KiB113105

README

1Calc standard resource files
2----------------------------
3
4To load a resource file, try:
5
6    read filename
7
8You do not need to add the .cal extension to the filename.  Calc
9will search along the $CALCPATH (see ``help environment'').
10
11Normally a resource file will simply define some functions.  By default,
12most resource files will print out a short message when they are read.
13For example:
14
15    ; read lucas
16    lucas(h,n) defined
17    gen_u2(h,n,v1) defined
18    gen_u0(h,n,v1) defined
19    rodseth_xhn(x,h,n) defined
20    gen_v1(h,n) defined
21    ldebug(funct,str) defined
22    legacy_gen_v1(h,n) defined
23
24will cause calc to load and execute the 'lucas.cal' resource file.
25Executing the resource file will cause several functions to be defined.
26Executing the lucas function:
27
28    ; lucas(149,60)
29	    1
30    ; lucas(146,61)
31	    0
32
33shows that 149*2^60-1 is prime whereas 146*2^61-1 is not.
34
35=-=
36
37Calc resource file files are provided because they serve as examples of
38how use the calc language, and/or because the authors thought them to
39be useful!
40
41=-=
42
43By convention, a resource file only defines and/or initializes functions,
44objects and variables.	(The regress.cal and testxxx.cal regression test
45suite is an exception.)	 Also by convention, an additional usage message
46regarding important object and functions is printed.
47
48If a resource file needs to load another resource file, it should use
49the -once version of read:
50
51    /* pull in needed resource files */
52    read -once "surd"
53    read -once "lucas"
54
55This will cause the needed resource files to be read once.  If these
56files have already been read, the read -once will act as a noop.
57
58The "resource_debug" parameter is intended for controlling the possible
59display of special information relating to functions, objects, and
60other structures created by instructions in calc resource files.
61Zero value of config("resource_debug") means that no such information
62is displayed.  For other values, the non-zero bits which currently
63have meanings are as follows:
64
65    n		Meaning of bit n of config("resource_debug")
66
67    0	When a function is defined, redefined or undefined at
68	interactive level, a message saying what has been done
69	is displayed.
70
71    1	When a function is defined, redefined or undefined during
72	the reading of a file, a message saying what has been done
73	is displayed.
74
75    2	Show func will display more information about a functions
76	arguments as well as more argument summary information.
77
78    3	During execution, allow calc standard resource files
79	to output additional debugging information.
80
81The value for config("resource_debug") in both oldstd and newstd is 3,
82but if calc is invoked with the -d flag, its initial value is zero.
83Thus, if calc is started without the -d flag, until config("resource_debug")
84is changed, a message will be output when a function is defined
85either interactively or during the reading of a file.
86
87Sometimes the information printed is not enough.  In addition to the
88standard information, one might want to print:
89
90	* useful obj definitions
91	* functions with optional args
92	* functions with optional args where the param() interface is used
93
94For these cases we suggest that you place at the bottom of your code
95something that prints extra information if config("resource_debug") has
96either of the bottom 2 bits set:
97
98	if (config("resource_debug") & 3) {
99		print "obj xyz defined";
100		print "funcA([val1 [, val2]]) defined";
101		print "funcB(size, mass, ...) defined";
102	}
103
104If your the resource file needs to output special debugging information,
105we recommend that you check for bit 3 of the config("resource_debug")
106before printing the debug statement:
107
108	if (config("resource_debug") & 8) {
109		print "DEBUG: This a sample debug statement";
110	}
111
112=-=
113
114The following is a brief description of some of the calc resource files
115that are shipped with calc.  See above for example of how to read in
116and execute these files.
117
118alg_config.cal
119
120    global test_time
121    mul_loop(repeat,x) defined
122    mul_ratio(len) defined
123    best_mul2() defined
124    sq_loop(repeat,x) defined
125    sq_ratio(len) defined
126    best_sq2() defined
127    pow_loop(repeat,x,ex) defined
128    pow_ratio(len) defined
129    best_pow2() defined
130
131    These functions search for an optimal value of config("mul2"),
132    config("sq2"), and config("pow2").  The calc default values of these
133    configuration values were set by running this resource file on a
134    1.8GHz AMD 32-bit CPU of ~3406 BogoMIPS.
135
136    The best_mul2() function returns the optimal value of config("mul2").
137    The best_sq2() function returns the optimal value of config("sq2").
138    The best_pow2() function returns the optimal value of config("pow2").
139    The other functions are just support functions.
140
141    By design, best_mul2(), best_sq2(), and best_pow2() take a few
142    minutes to run.  These functions increase the number of times a
143    given computational loop is executed until a minimum amount of CPU
144    time is consumed.  To watch these functions progress, one can set
145    the config("user_debug") value.
146
147    Here is a suggested way to use this resource file:
148
149	; read alg_config
150	; config("user_debug",2),;
151	; best_mul2(); best_sq2(); best_pow2();
152	; best_mul2(); best_sq2(); best_pow2();
153	; best_mul2(); best_sq2(); best_pow2();
154
155    NOTE: It is perfectly normal for the optimal value returned to differ
156    slightly from run to run.  Slight variations due to inaccuracy in
157    CPU timings will cause the best value returned to differ slightly
158    from run to run.
159
160    One can use a calc startup file to change the initial values of
161    config("mul2"), config("sq2"), and config("pow2").  For example one
162    can place into ~/.calcrc these lines:
163
164	config("mul2", 1780),;
165	config("sq2", 3388),;
166	config("pow2", 176),;
167
168    to automatically and silently change these config values.
169    See help/config and CALCRC in help/environment for more information.
170
171
172beer.cal
173
174    This calc resource is calc's contribution to the 99 Bottles of Beer
175    web page:
176
177	http://www.ionet.net/~timtroyr/funhouse/beer.html#calc
178
179     NOTE: This resource produces a lot of output.  :-)
180
181
182bernoulli.cal
183
184    B(n)
185
186    Calculate the nth Bernoulli number.
187
188    NOTE: There is now a bernoulli() builtin function.  This file is
189	  left here for backward compatibility and now simply returns
190	  the builtin function.
191
192
193bernpoly.cal
194
195    bernpoly(n,z)
196
197    Computes the nth Bernoulli polynomial at z for arbitrary n,z.  See:
198
199        http://en.wikipedia.org/wiki/Bernoulli_polynomials
200        http://mathworld.wolfram.com/BernoulliPolynomial.html
201
202    for further information
203
204
205bigprime.cal
206
207    bigprime(a, m, p)
208
209    A prime test, base a, on p*2^x+1 for even x>m.
210
211
212brentsolve.cal
213
214    brentsolve(low, high,eps)
215
216    A root-finder implemented with the Brent-Dekker trick.
217
218    brentsolve2(low, high,which,eps)
219
220    The second function, brentsolve2(low, high,which,eps) has some lines
221    added to make it easier to hard-code the name of the helper function
222    different from the obligatory "f".
223
224    See:
225
226        http://en.wikipedia.org/wiki/Brent%27s_method
227        http://mathworld.wolfram.com/BrentsMethod.html
228
229    to find out more about the Brent-Dekker method.
230
231
232constants.cal
233
234    e()
235    G()
236
237    An implementation of different constants to arbitrary precision.
238
239
240chi.cal
241
242    Z(x[, eps])
243    P(x[, eps])
244    chi_prob(chi_sq, v[, eps])
245
246    Computes the Probability, given the Null Hypothesis, that a given
247    Chi squared values >= chi_sq with v degrees of freedom.
248
249    The chi_prob() function does not work well with odd degrees of freedom.
250    It is reasonable with even degrees of freedom, although one must give
251    a sufficiently small error term as the degrees gets large (>100).
252
253    The Z(x) and P(x) are internal statistical functions.
254
255    eps is an optional epsilon() like error term.
256
257
258chrem.cal
259
260    chrem(r1,m1 [,r2,m2, ...])
261    chrem(rlist, mlist)
262
263    Chinese remainder theorem/problem solver.
264
265
266deg.cal
267
268    deg(deg, min, sec)
269    deg_add(a, b)
270    deg_neg(a)
271    deg_sub(a, b)
272    deg_mul(a, b)
273    deg_print(a)
274
275    Calculate in degrees, minutes, and seconds.  For a more functional
276    version see dms.cal.
277
278
279dms.cal
280
281    dms(deg, min, sec)
282    dms_add(a, b)
283    dms_neg(a)
284    dms_sub(a, b)
285    dms_mul(a, b)
286    dms_print(a)
287    dms_abs(a)
288    dms_norm(a)
289    dms_test(a)
290    dms_int(a)
291    dms_frac(a)
292    dms_rel(a,b)
293    dms_cmp(a,b)
294    dms_inc(a)
295    dms_dec(a)
296
297    Calculate in degrees, minutes, and seconds.  Unlike deg.cal, increments
298    are on the arc second level.  See also hms.cal.
299
300
301dotest.cal
302
303    dotest(dotest_file [,dotest_code [,dotest_maxcond]])
304
305    dotest_file
306
307	Search along CALCPATH for dotest_file, which contains lines that
308	should evaluate to 1.  Comment lines and empty lines are ignored.
309	Comment lines should use ## instead of the multi like /* ... */
310	because lines are evaluated one line at a time.
311
312    dotest_code
313
314	Assign the code number that is to be printed at the start of
315	each non-error line and after **** in each error line.
316	The default code number is 999.
317
318    dotest_maxcond
319
320	The maximum number of error conditions that may be detected.
321	An error condition is not a sign of a problem, in some cases
322	a line deliberately forces an error condition.	A value of -1,
323	the default, implies a maximum of 2147483647.
324
325    Global variables and functions must be declared ahead of time because
326    the dotest scope of evaluation is a line at a time.  For example:
327
328	read dotest.cal
329	read set8700.cal
330	dotest("set8700.line");
331
332
333factorial.cal
334
335    factorial(n)
336
337    Calculates the product of the positive integers up to and including n.
338
339    See:
340
341	http://en.wikipedia.org/wiki/Factorial
342
343    for information on the factorial. This function depends on the script
344    toomcook.cal.
345
346
347    primorial(a,b)
348
349    Calculates the product of the primes between a and b. If a is not prime
350    the next higher prime is taken as the starting point. If b is not prime
351    the next lower prime is taking as the end point b. The end point b must
352    not exceed 4294967291.  See:
353
354	http://en.wikipedia.org/wiki/Primorial
355
356    for information on the primorial.
357
358
359factorial2.cal
360
361    This file contents a small variety of integer functions that can, with
362    more or less pressure, be related to the factorial.
363
364    doublefactorial(n)
365
366    Calculates the double factorial n!! with different algorithms for
367        - n odd
368        - n even and positive
369        - n (real|complex) sans the negative half integers
370
371    See:
372
373        http://en.wikipedia.org/wiki/Double_factorial
374        http://mathworld.wolfram.com/DoubleFactorial.html
375
376    for information on the double factorial. This function depends on
377    the script toomcook.cal, factorial.cal and specialfunctions.cal.
378
379
380    binomial(n,k)
381
382    Calculates the binomial coefficients for n large and k = k \pm
383    n/2. Defaults to the built-in function for smaller and/or different
384    values. Meant as a complete replacement for comb(n,k) with only a
385    very small overhead.  See:
386
387        http://en.wikipedia.org/wiki/Binomial_coefficient
388
389    for information on the binomial. This function depends on the script
390    toomcook.cal factorial.cal and specialfunctions.cal.
391
392
393    bigcatalan(n)
394
395    Calculates the n-th Catalan number for n large. It is useful
396    above n~50,000 but defaults to the builtin function for smaller
397    values.Meant as a complete replacement for catalan(n) with only a
398    very small overhead.  See:
399
400        http://en.wikipedia.org/wiki/Catalan_number
401        http://mathworld.wolfram.com/CatalanNumber.html
402
403    for information on Catalan numbers. This function depends on the scripts
404    toomcook.cal, factorial.cal and specialfunctions.cal.
405
406
407    stirling1(n,m)
408
409    Calculates the Stirling number of the first kind. It does so with
410    building a list of all of the smaller results. It might be a good
411    idea, though, to run it once for the highest n,m first if many
412    Stirling  numbers are needed at once, for example in a series.  See:
413
414        http://en.wikipedia.org/wiki/Stirling_numbers_of_the_first_kind
415        http://mathworld.wolfram.com/StirlingNumberoftheFirstKind.html
416        Algorithm 3.17,  Donald Kreher and Douglas Simpson, "Combinatorial
417          Algorithms", CRC Press, 1998, page 89.
418
419    for information on Stirling numbers of the first kind.
420
421
422    stirling2(n,m)
423    stirling2caching(n,m)
424
425    Calculate the Stirling number of the second kind.
426    The first function stirling2(n,m) does it with the sum
427                       m
428                      ====
429                 1    \      n      m - k
430                 --    >    k  (- 1)      binomial(m, k)
431                 m!   /
432                      ====
433                      k = 0
434
435    The other function stirling2caching(n,m) does it by way of the
436    re-occurrence relation and keeps all earlier results. This function
437    is much slower for computing a single value than stirling2(n,m) but
438    is very useful if many Stirling numbers are needed, for example in
439    a series.  See:
440
441        http://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
442        http://mathworld.wolfram.com/StirlingNumberoftheSecondKind.html
443
444        Algorithm 3.17,  Donald Kreher and Douglas Simpson, "Combinatorial
445          Algorithms", CRC Press, 1998, page 89.
446
447    for information on Stirling numbers of the second kind.
448
449
450    bell(n)
451
452    Calculate the n-th Bell number. This may take some time for large n.
453    See:
454
455        http://oeis.org/A000110
456        http://en.wikipedia.org/wiki/Bell_number
457        http://mathworld.wolfram.com/BellNumber.html
458
459    for information on Bell numbers.
460
461
462    subfactorial(n)
463
464    Calculate the n-th subfactorial or derangement. This may take some
465    time for large n.  See:
466
467        http://mathworld.wolfram.com/Derangement.html
468        http://en.wikipedia.org/wiki/Derangement
469
470    for information on subfactorials.
471
472
473    risingfactorial(x,n)
474
475    Calculates the rising factorial or Pochammer symbol of almost arbitrary
476    x,n.  See:
477
478        http://en.wikipedia.org/wiki/Pochhammer_symbol
479        http://mathworld.wolfram.com/PochhammerSymbol.html
480
481    for information on rising factorials.
482
483    fallingfactorial(x,n)
484
485    Calculates the rising factorial of almost arbitrary x,n.  See:
486
487        http://en.wikipedia.org/wiki/Pochhammer_symbol
488        http://mathworld.wolfram.com/PochhammerSymbol.html
489
490    for information on falling factorials.
491
492
493ellip.cal
494
495    efactor(iN, ia, B, force)
496
497    Attempt to factor using the elliptic functions: y^2 = x^3 + a*x + b.
498
499
500gvec.cal
501
502    gvec(function, vector)
503
504    Vectorize any single-input function or trailing operator.
505
506
507hello.cal
508
509    Calc's contribution to the Hello World! page:
510
511	http://www.latech.edu/~acm/HelloWorld.shtml
512	http://www.latech.edu/~acm/helloworld/calc.html
513
514     NOTE: This resource produces a lot of output.  :-)
515
516
517hms.cal
518
519    hms(hour, min, sec)
520    hms_add(a, b)
521    hms_neg(a)
522    hms_sub(a, b)
523    hms_mul(a, b)
524    hms_print(a)
525    hms_abs(a)
526    hms_norm(a)
527    hms_test(a)
528    hms_int(a)
529    hms_frac(a)
530    hms_rel(a,b)
531    hms_cmp(a,b)
532    hms_inc(a)
533    hms_dec(a)
534
535    Calculate in hours, minutes, and seconds.  See also dmscal.
536
537
538infinities.cal
539
540    isinfinite(x)
541    iscinf(x)
542    ispinf(x)
543    isninf(x)
544    cinf()
545    ninf()
546    pinf()
547
548    The symbolic handling of infinities. Needed for intnum.cal but might be
549    useful elsewhere, too.
550
551
552intfile.cal
553
554    file2be(filename)
555
556	Read filename and return an integer that is built from the
557	octets in that file in Big Endian order.  The first octets
558	of the file become the most significant bits of the integer.
559
560    file2le(filename)
561
562	Read filename and return an integer that is built from the
563	octets in that file in Little Endian order.  The first octets
564	of the file become the most significant bits of the integer.
565
566    be2file(v, filename)
567
568	Write the absolute value of v into filename in Big Endian order.
569	The v argument must be on integer.  The most significant bits
570	of the integer become the first octets of the file.
571
572    le2file(v, filename)
573
574	Write the absolute value of v into filename in Little Endian order.
575	The v argument must be on integer.  The least significant bits
576	of the integer become the last octets of the file.
577
578
579intnum.cal
580
581    quadtsdeletenodes()
582    quadtscomputenodes(order, expo, eps)
583    quadtscore(a, b, n)
584    quadts(a, b, points)
585    quadglcomputenodes(N)
586    quadgldeletenodes()
587    quadglcore(a, b, n)
588    quadgl(a, b, points)
589    quad(a, b, points = -1, method = "tanhsinh")
590    makerange(start, end, steps)
591    makecircle(radius, center, points)
592    makeellipse(angle, a, b, center, points)
593    makepoints()
594
595    This file offers some methods for numerical integration. Implemented are
596    the Gauss-Legendre and the tanh-sinh quadrature.
597
598    All functions are useful to some extend but the main function for
599    quadrature is quad(), which is not much more than an abstraction layer.
600
601    The main workers are quadgl() for Gauss-Legendre and quadts() for the
602    tanh-sinh quadrature. The limits of the integral can be anything in the
603    complex plane and the extended real line. The latter means that infinite
604    limits are supported by way of the symbolic infinities implemented in the
605    file infinities.cal (automatically linked in by intnum.cal).
606
607    Integration in parts and contour is supported by the "points" argument
608    which takes either a number or a list. the functions starting with "make"
609    allow for a less error prone use.
610
611    The function to evaluate must have the name "f".
612
613    Examples (shamelessly stolen from mpmath):
614
615        ; define f(x){return sin(x);}
616        f(x) defined
617        ; quadts(0,pi())  -  2
618	    0.00000000000000000000
619        ; quadgl(0,pi())  -  2
620	    0.00000000000000000000
621
622    Sometimes rounding errors accumulate, it might be a good idea to crank up
623    the working precision a notch or two.
624
625        ; define f(x){ return exp(-x^2);}
626        f(x) redefined
627        ; quadts(0,pinf())  - pi()
628	    0.00000000000000000000
629        ; quadgl(0,pinf())  - pi()
630	    0.00000000000000000001
631
632        ; define f(x){ return exp(-x^2);}
633        f(x) redefined
634        ; quadgl(ninf(),pinf()) - sqrt(pi())
635	    0.00000000000000000000
636        ; quadts(ninf(),pinf()) - sqrt(pi())
637	   -0.00000000000000000000
638
639    Using the "points" parameter is a bit tricky
640
641        ; define f(x){ return 1/x;  }
642        f(x) redefined
643        ; quadts(1,1,mat[3]={1i,-1,-1i})  -  2i*pi()
644	    0.00000000000000000001i
645        ; quadgl(1,1,mat[3]={1i,-1,-1i})  -  2i*pi()
646	    0.00000000000000000001i
647
648    The make* functions make it a bit simpler
649
650        ; quadts(1,1,makepoints(1i,-1,-1i))  -  2i*pi()
651	    0.00000000000000000001i
652        ; quadgl(1,1,makepoints(1i,-1,-1i))  -  2i*pi()
653	    0.00000000000000000001i
654
655        ; define f(x){ return abs(sin(x));}
656        f(x) redefined
657        ; quadts(0,2*pi(),makepoints(pi()))  - 4
658	    0.00000000000000000000
659        ; quadgl(0,2*pi(),makepoints(pi()))  - 4
660	    0.00000000000000000000
661
662    The quad*core functions do not offer anything fancy but the third parameter
663    controls the so called "order" which is just the number of nodes computed.
664    This can be quite useful in some circumstances.
665
666        ; quadgldeletenodes()
667        ; define f(x){ return exp(x);}
668        f(x) redefined
669        ; s=usertime();quadglcore(-3,3)- (exp(3)-exp(-3));e=usertime();e-s
670	    0.00000000000000000001
671	    2.632164
672        ; s=usertime();quadglcore(-3,3)- (exp(3)-exp(-3));e=usertime();e-s
673	    0.00000000000000000001
674	    0.016001
675        ; quadgldeletenodes()
676        ; s=usertime();quadglcore(-3,3,14)- (exp(3)-exp(-3));e=usertime();e-s
677	   -0.00000000000000000000
678	    0.024001
679        ; s=usertime();quadglcore(-3,3,14)- (exp(3)-exp(-3));e=usertime();e-s
680	   -0.00000000000000000000
681	    0
682
683    It is not much but can sum up. The tanh-sinh algorithm is not optimizable
684    as much as the Gauss-Legendre algorithm but is per se much faster.
685
686        ; s=usertime();quadtscore(-3,3)- (exp(3)-exp(-3));e=usertime();e-s
687	    -0.00000000000000000001
688	     0.128008
689        ; s=usertime();quadtscore(-3,3)- (exp(3)-exp(-3));e=usertime();e-s
690	    -0.00000000000000000001
691	     0.036002
692        ; s=usertime();quadtscore(-3,3,49)- (exp(3)-exp(-3));e=usertime();e-s
693	    -0.00000000000000000000
694	     0.036002
695        ; s=usertime();quadtscore(-3,3,49)- (exp(3)-exp(-3));e=usertime();e-s
696	    -0.00000000000000000000
697	     0.01200
698
699
700lambertw.cal
701
702     lambertw(z,branch)
703
704     Computes Lambert's W-function at "z" at branch "branch". See
705
706         http://en.wikipedia.org/wiki/Lambert_W_function
707         http://mathworld.wolfram.com/LambertW-Function.html
708         https://cs.uwaterloo.ca/research/tr/1993/03/W.pdf
709         http://arxiv.org/abs/1003.1628
710
711     to get more information.
712
713     This file includes also an implementation for the series described in
714     Corless et al. (1996) eq. 4.22 (W-pdf) and Verebic (2010) (arxive link)
715     eqs.35-37.
716
717     The series has been implemented to get a different algorithm
718     for checking the results. This was necessary because the results
719     of the implementation in Maxima, the only program with a general
720     lambert-w implementation at hand at that time, differed slightly. The
721     Maxima versions tested were: Maxima 5.21.1 and 5.29.1. The current
722     version of this code concurs with the results of Mathematica`s(tm)
723     ProductLog[branch,z] with the tested values.
724
725     The series is only valid for the branches 0,-1, real z, converges
726     for values of z _very_ near the branch-point -exp(-1) only, and must
727     be given the branches explicitly.  See the code in lambertw.cal
728     for further information.
729
730
731linear.cal
732
733    linear(x0, y0, x1, y1, x)
734
735    Returns the value y such that (x,y) in on the line (x0,y0), (x1,y1).
736    Requires x0 != y0.
737
738
739lnseries.cal
740
741    lnseries(limit)
742    lnfromseries(n)
743    deletelnseries()
744
745    Calculates a series of n natural logarithms at 1,2,3,4...n. It
746    does so by computing the prime factorization of all of the number
747    sequence 1,2,3...n, calculates the natural logarithms of the primes
748    in 1,2,3...n and uses the above factorization to build the natural
749    logarithms of the rest of the sequence by adding the logarithms of
750    the primes in the factorization.  This is faster for high precision
751    of the logarithms and/or long sequences.
752
753    The sequence need to be initiated by running either lnseries(n) or
754    lnfromseries(n) once with n the upper limit of the sequence.
755
756
757lucas.cal
758
759    lucas(h, n)
760
761    Perform a primality test of h*2^n-1.
762
763    gen_u2(h, n, v1)
764
765    Generate u(2) for h*2^n-1.  This function is used by lucas(h, n),
766    as the first term in the lucas sequence that is needed to
767    prove that h*2^n-1 is prime or not prime.
768
769    NOTE: Some call this term u(0).  The function gen_u0(h, n, v1)
770	  simply calls gen_u2(h, n, v1) for such people.  :-)
771
772    gen_v1(h, v)
773
774    Generate v(1) for h*2^n-1.  This function is used by lucas(h, n),
775    via the gen_u2(h, n, v1), to supply the 3rd argument to gen_u2.
776
777    legacy_gen_v1(h, n)
778
779    Generate v(1) for h*2^n-1 using the legacy Amdahl 6 method.
780    This function sometimes returns -1 for a few cases when
781    h is a multiple of 3.  This function is NOT used by lucas(h, n).
782
783
784lucas_chk.cal
785
786    lucas_chk(high_n)
787
788    Test all primes of the form h*2^n-1, with 1<=h<200 and n <= high_n.
789    Requires lucas.cal to be loaded.  The highest useful high_n is 1000.
790
791    Used by regress.cal during the 2100 test set.
792
793
794mersenne.cal
795
796    mersenne(p)
797
798    Perform a primality test of 2^p-1, for prime p>1.
799
800
801mfactor.cal
802
803    mfactor(n [, start_k=1 [, rept_loop=10000 [, p_elim=17]]])
804
805    Return the lowest factor of 2^n-1, for n > 0.  Starts looking for factors
806    at 2*start_k*n+1.  Skips values that are multiples of primes <= p_elim.
807    By default, start_k == 1, rept_loop = 10000 and p_elim = 17.
808
809    The p_elim == 17 overhead takes ~3 minutes on an 200 MHz r4k CPU and
810    requires about ~13 Megs of memory.	The p_elim == 13 overhead
811    takes about 3 seconds and requires ~1.5 Megs of memory.
812
813    The value p_elim == 17 is best for long factorizations.  It is the
814    fastest even thought the initial startup overhead is larger than
815    for p_elim == 13.
816
817
818mod.cal
819
820    lmod(a)
821    mod_print(a)
822    mod_one()
823    mod_cmp(a, b)
824    mod_rel(a, b)
825    mod_add(a, b)
826    mod_sub(a, b)
827    mod_neg(a)
828    mod_mul(a, b)
829    mod_square(a)
830    mod_inc(a)
831    mod_dec(a)
832    mod_inv(a)
833    mod_div(a, b)
834    mod_pow(a, b)
835
836    Routines to handle numbers modulo a specified number.
837
838
839natnumset.cal
840
841    isset(a)
842    setbound(n)
843    empty()
844    full()
845    isin(a, b)
846    addmember(a, n)
847    rmmember(a, n)
848    set()
849    mkset(s)
850    primes(a, b)
851    set_max(a)
852    set_min(a)
853    set_not(a)
854    set_cmp(a, b)
855    set_rel(a, b)
856    set_or(a, b)
857    set_and(a, b)
858    set_comp(a)
859    set_setminus(a, b)
860    set_diff(a,b)
861    set_content(a)
862    set_add(a, b)
863    set_sub(a, b)
864    set_mul(a, b)
865    set_square(a)
866    set_pow(a, n)
867    set_sum(a)
868    set_plus(a)
869    interval(a, b)
870    isinterval(a)
871    set_mod(a, b)
872    randset(n, a, b)
873    polyvals(L, A)
874    polyvals2(L, A, B)
875    set_print(a)
876
877    Demonstration of how the string operators and functions may be used
878    for defining and working with sets of natural numbers not exceeding a
879    user-specified bound.
880
881
882palindrome.cal
883
884    digitof(val,place)
885    copalplace(d,place)
886    upperhalf(val)
887    mkpal(val)
888    mkpalmiddigit(val,digit)
889    ispal(val)
890    nextpal(val)
891    prevpal(val)
892    nextprimepal(val)
893    prevprimepal(val)
894
895    Functions to form and manipulate palindromes in base 10.
896
897    Important functions are:
898
899	Find the next / previous palindrome:
900
901	    nextpal(val)
902	    prevpal(val)
903
904	Test if a value is a palindrome:
905
906	    ispal(val)
907
908	Find the next / previous palindrome that is a (highly probable) prime:
909
910	    nextprimepal(val)
911	    prevprimepal(val)
912
913
914pell.cal
915
916    pellx(D)
917    pell(D)
918
919    Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1.
920    Type the solution to Pell's equation for a particular D.
921
922
923pi.cal
924
925    qpi(epsilon)
926    piforever()
927
928    The qpi() calculate pi within the specified epsilon using the quartic
929    convergence iteration.
930
931    The piforever() prints digits of pi, nicely formatted, for as long
932    as your free memory space and system up time allows.
933
934    The piforever() function (written by Klaus Alexander Seistrup
935    <klaus at seistrup dot dk>) was inspired by an algorithm conceived by
936    Lambert Meertens.  See also the ABC Programmer's Handbook, by Geurts,
937    Meertens & Pemberton, published by Prentice-Hall (UK) Ltd., 1990.
938
939
940pix.cal
941
942    pi_of_x(x)
943
944    Calculate the number of primes < x using A(n+1)=A(n-1)+A(n-2).  This
945    is a SLOW painful method ... the builtin pix(x) is much faster.
946    Still, this method is interesting.
947
948
949pollard.cal
950
951    pfactor(N, N, ai, af)
952
953    Factor using Pollard's p-1 method.
954
955
956poly.cal
957
958    Calculate with polynomials of one variable.	 There are many functions.
959    Read the documentation in the resource file.
960
961
962prompt.cal
963
964    adder()
965    showvalues(str)
966
967    Demonstration of some uses of prompt() and eval().
968
969
970psqrt.cal
971
972    psqrt(u, p)
973
974    Calculate square roots modulo a prime
975
976
977qtime.cal
978
979    qtime(utc_hr_offset)
980
981    Print the time as English sentence given the hours offset from UTC.
982
983
984quat.cal
985
986    quat(a, b, c, d)
987    quat_print(a)
988    quat_norm(a)
989    quat_abs(a, e)
990    quat_conj(a)
991    quat_add(a, b)
992    quat_sub(a, b)
993    quat_inc(a)
994    quat_dec(a)
995    quat_neg(a)
996    quat_mul(a, b)
997    quat_div(a, b)
998    quat_inv(a)
999    quat_scale(a, b)
1000    quat_shift(a, b)
1001
1002    Calculate using quaternions of the form: a + bi + cj + dk.	In these
1003    functions, quaternions are manipulated in the form: s + v, where
1004    s is a scalar and v is a vector of size 3.
1005
1006
1007randbitrun.cal
1008
1009    randbitrun([run_cnt])
1010
1011    Using randbit(1) to generate a sequence of random bits, determine if
1012    the number and length of identical bits runs match what is expected.
1013    By default, run_cnt is to test the next 65536 random values.
1014
1015    This tests the a55 generator.
1016
1017
1018randmprime.cal
1019
1020    randmprime(bits, seed [,dbg])
1021
1022    Find a prime of the form h*2^n-1 >= 2^bits for some given x.  The
1023    initial search points for 'h' and 'n' are selected by a cryptographic
1024    pseudo-random number generator.  The optional argument, dbg, if set
1025    to 1, 2 or 3 turn on various debugging print statements.
1026
1027
1028randombitrun.cal
1029
1030    randombitrun([run_cnt])
1031
1032    Using randombit(1) to generate a sequence of random bits, determine if
1033    the number and length of identical bits runs match what is expected.
1034    By default, run_cnt is to test the next 65536 random values.
1035
1036    This tests the Blum-Blum-Shub generator.
1037
1038
1039randomrun.cal
1040
1041    randomrun([run_cnt])
1042
1043    Perform the "G. Run test" (pp. 65-68) as found in Knuth's "Art of
1044    Computer Programming - 2nd edition", Volume 2, Section 3.3.2 on
1045    the builtin rand() function.  This function will generate run_cnt
1046    64 bit values.  By default, run_cnt is to test the next 65536
1047    random values.
1048
1049    This tests the Blum-Blum-Shub generator.
1050
1051
1052randrun.cal
1053
1054    randrun([run_cnt])
1055
1056    Perform the "G. Run test" (pp. 65-68) as found in Knuth's "Art of
1057    Computer Programming - 2nd edition", Volume 2, Section 3.3.2 on
1058    the builtin rand() function.  This function will generate run_cnt
1059    64 bit values.  By default, run_cnt is to test the next 65536
1060    random values.
1061
1062    This tests the a55 generator.
1063
1064repeat.cal
1065
1066    repeat(digit_set, repeat_count)
1067
1068    Return the value of the digit_set repeated repeat_count times.
1069    Both digit_set and repeat_count must be integers > 0.
1070
1071    For example repeat(423,5) returns the value 423423423423423,
1072    which is the digit_set 423 repeated 5 times.
1073
1074
1075regress.cal
1076
1077    Test the correct execution of the calculator by reading this resource
1078    file.  Errors are reported with '****' messages, or worse. :-)
1079
1080
1081screen.cal
1082
1083    up
1084    CUU	/* same as up */
1085    down = CUD
1086    CUD	/* same as down */
1087    forward
1088    CUF	/* same as forward */
1089    back = CUB
1090    CUB	/* same as back */
1091    save
1092    SCP	/* same as save */
1093    restore
1094    RCP	/* same as restore */
1095    cls
1096    home
1097    eraseline
1098    off
1099    bold
1100    faint
1101    italic
1102    blink
1103    rapidblink
1104    reverse
1105    concealed
1106    /* Lowercase indicates foreground, uppercase background */
1107    black
1108    red
1109    green
1110    yellow
1111    blue
1112    magenta
1113    cyan
1114    white
1115    Black
1116    Red
1117    Green
1118    Yellow
1119    Blue
1120    Magenta
1121    Cyan
1122    White
1123
1124    Define ANSI control sequences providing (i.e., cursor movement,
1125    changing foreground or background color, etc.) for VT100 terminals
1126    and terminal window emulators (i.e., xterm, Apple OS/X Terminal,
1127    etc.) that support them.
1128
1129    For example:
1130
1131	read screen
1132	print green:"This is green. ":red:"This is red.":black
1133
1134
1135seedrandom.cal
1136
1137    seedrandom(seed1, seed2, bitsize [,trials])
1138
1139    Given:
1140	seed1 - a large random value (at least 10^20 and perhaps < 10^93)
1141	seed2 - a large random value (at least 10^20 and perhaps < 10^93)
1142	size - min Blum modulus as a power of 2 (at least 100, perhaps > 1024)
1143	trials - number of ptest() trials (default 25) (optional arg)
1144
1145    Returns:
1146	the previous random state
1147
1148    Seed the cryptographically strong Blum generator.  This functions allows
1149    one to use the raw srandom() without the burden of finding appropriate
1150    Blum primes for the modulus.
1151
1152
1153set8700.cal
1154
1155    set8700_getA1() defined
1156    set8700_getA2() defined
1157    set8700_getvar() defined
1158    set8700_f(set8700_x) defined
1159    set8700_g(set8700_x) defined
1160
1161    Declare globals and define functions needed by dotest() (see
1162    dotest.cal) to evaluate set8700.line a line at a time.
1163
1164
1165set8700.line
1166
1167    A line-by-line evaluation file for dotest() (see dotest.cal).
1168    The set8700.cal file (and dotest.cal) should be read first.
1169
1170
1171smallfactors.cal
1172
1173    smallfactors(x0)
1174    printsmallfactors(flist)
1175
1176    Lists the prime factors of numbers smaller than 2^32. Try for example:
1177    printsmallfactors(smallfactors(10!)).
1178
1179
1180solve.cal
1181
1182    solve(low, high, epsilon)
1183
1184    Solve the equation f(x) = 0 to within the desired error value for x.
1185    The function 'f' must be defined outside of this routine, and the
1186    low and high values are guesses which must produce values with
1187    opposite signs.
1188
1189
1190specialfunctions.cal
1191
1192    beta(a,b)
1193
1194    Calculates the value of the beta function.  See:
1195
1196	https://en.wikipedia.org/wiki/Beta_function
1197        http://mathworld.wolfram.com/BetaFunction.html
1198        http://dlmf.nist.gov/5.12
1199
1200    for information on the beta function.
1201
1202
1203    betainc(a,b,z)
1204
1205    Calculates the value of the regularized incomplete beta function.  See:
1206
1207	https://en.wikipedia.org/wiki/Beta_function
1208        http://mathworld.wolfram.com/RegularizedBetaFunction.html
1209        http://dlmf.nist.gov/8.17
1210
1211    for information on the regularized incomplete beta function.
1212
1213
1214    expoint(z)
1215
1216    Calculates the value of the exponential integral Ei(z) function at z.
1217    See:
1218
1219	http://en.wikipedia.org/wiki/Exponential_integral
1220        http://www.cs.utah.edu/~vpegorar/research/2011_JGT/
1221
1222    for information on the exponential integral Ei(z) function.
1223
1224
1225    erf(z)
1226
1227    Calculates the value of the error function at z.  See:
1228
1229	http://en.wikipedia.org/wiki/Error_function
1230
1231    for information on the error function function.
1232
1233
1234    erfc(z)
1235
1236    Calculates the value of the complementary error function at z.  See:
1237
1238	http://en.wikipedia.org/wiki/Error_function
1239
1240    for information on the complementary error function function.
1241
1242
1243    erfi(z)
1244
1245    Calculates the value of the imaginary error function at z.  See:
1246
1247	http://en.wikipedia.org/wiki/Error_function
1248
1249    for information on the imaginary error function function.
1250
1251
1252    erfinv(x)
1253
1254    Calculates the inverse of the error function at x.  See:
1255
1256	http://en.wikipedia.org/wiki/Error_function
1257
1258    for information on the inverse of the error function function.
1259
1260
1261    faddeeva(z)
1262
1263    Calculates the value of the complex error function at z.  See:
1264
1265	http://en.wikipedia.org/wiki/Faddeeva_function
1266
1267    for information on the complex error function function.
1268
1269
1270    gamma(z)
1271
1272    Calculates the value of the Euler gamma function at z.  See:
1273
1274	http://en.wikipedia.org/wiki/Gamma_function
1275        http://dlmf.nist.gov/5
1276
1277    for information on the Euler gamma function.
1278
1279
1280    gammainc(a,z)
1281
1282    Calculates the value of the lower incomplete gamma function for
1283    arbitrary a, z.  See:
1284
1285	http://en.wikipedia.org/wiki/Incomplete_gamma_function
1286
1287    for information on the lower incomplete gamma function.
1288
1289    gammap(a,z)
1290
1291    Calculates the value of the regularized lower incomplete gamma
1292    function for a, z with a not in -N.  See:
1293
1294	http://en.wikipedia.org/wiki/Incomplete_gamma_function
1295
1296    for information on the regularized lower incomplete gamma function.
1297
1298    gammaq(a,z)
1299
1300    Calculates the value of the regularized upper incomplete gamma
1301    function for a, z with a not in -N.  See:
1302
1303	http://en.wikipedia.org/wiki/Incomplete_gamma_function
1304
1305    for information on the regularized upper incomplete gamma function.
1306
1307
1308    heavisidestep(x)
1309
1310    Computes the Heaviside stepp function (1+sign(x))/2
1311
1312
1313    harmonic(limit)
1314
1315    Calculates partial values of the harmonic series up to limit.  See:
1316
1317	http://en.wikipedia.org/wiki/Harmonic_series_(mathematics)
1318        http://mathworld.wolfram.com/HarmonicSeries.html
1319
1320    for information on the harmonic series.
1321
1322
1323    lnbeta(a,b)
1324
1325    Calculates the natural logarithm of the beta function.  See:
1326
1327	https://en.wikipedia.org/wiki/Beta_function
1328        http://mathworld.wolfram.com/BetaFunction.html
1329        http://dlmf.nist.gov/5.12
1330
1331    for information on the beta function.
1332
1333    lngamma(z)
1334
1335    Calculates the value of the logarithm of the Euler gamma function
1336    at z.  See:
1337
1338	http://en.wikipedia.org/wiki/Gamma_function
1339        http://dlmf.nist.gov/5.15
1340
1341    for information on the derivatives of the the Euler gamma function.
1342
1343
1344    polygamma(m,z)
1345
1346    Calculates the value of the m-th derivative of the Euler gamma
1347    function at z.  See:
1348
1349	http://en.wikipedia.org/wiki/Polygamma
1350        http://dlmf.nist.gov/5
1351
1352    for information on the n-th derivative of the Euler gamma function. This
1353    function depends on the script zeta2.cal.
1354
1355
1356    psi(z)
1357
1358    Calculates the value of the first derivative of the Euler gamma
1359    function at z.  See:
1360
1361	http://en.wikipedia.org/wiki/Digamma_function
1362        http://dlmf.nist.gov/5
1363
1364    for information on the first derivative of the Euler gamma function.
1365
1366
1367    zeta(s)
1368
1369    Calculates the value of the Riemann Zeta function at s.  See:
1370
1371	http://en.wikipedia.org/wiki/Riemann_zeta_function
1372        http://dlmf.nist.gov/25.2
1373
1374    for information on the Riemann zeta function. This function depends
1375    on the script zeta2.cal.
1376
1377
1378statistics.cal
1379
1380    gammaincoctave(z,a)
1381
1382    Computes the regularized incomplete gamma function in a way to
1383    correspond with the function in Octave.
1384
1385    invbetainc(x,a,b)
1386
1387    Computes the inverse of the regularized beta function. Does so the
1388    brute-force way which makes it a bit slower.
1389
1390    betapdf(x,a,b)
1391    betacdf(x,a,b)
1392    betacdfinv(x,a,b)
1393    betamedian(a,b)
1394    betamode(a,b)
1395    betavariance(a,b)
1396    betalnvariance(a,b)
1397    betaskewness(a,b)
1398    betakurtosis(a,b)
1399    betaentropy(a,b)
1400    normalpdf(x,mu,sigma)
1401    normalcdf(x,mu,sigma)
1402    probit(p)
1403    normalcdfinv(p,mu,sigma)
1404    normalmean(mu,sigma)
1405    normalmedian(mu,sigma)
1406    normalmode(mu,sigma)
1407    normalvariance(mu,sigma)
1408    normalskewness(mu,sigma)
1409    normalkurtosis(mu,sigma)
1410    normalentropy(mu,sigma)
1411    normalmgf(mu,sigma,t)
1412    normalcf(mu,sigma,t)
1413    chisquaredpdf(x,k)
1414    chisquaredpcdf(x,k)
1415    chisquaredmean(x,k)
1416    chisquaredmedian(x,k)
1417    chisquaredmode(x,k)
1418    chisquaredvariance(x,k)
1419    chisquaredskewness(x,k)
1420    chisquaredkurtosis(x,k)
1421    chisquaredentropy(x,k)
1422    chisquaredmfg(k,t)
1423    chisquaredcf(k,t)
1424
1425    Calculates a bunch of (hopefully) aptly named statistical functions.
1426
1427
1428strings.cal
1429
1430    isascii(c)
1431    isblank(c)
1432
1433    Implements some of the functions of libc's ctype.h and strings.h.
1434
1435    NOTE: A number of the ctype.h and strings.h functions are now builtin
1436          functions in calc.
1437
1438   WARNING: If the remaining functions in this calc resource file become
1439	    calc builtin functions, then strings.cal may be removed in
1440	    a future release.
1441
1442
1443sumsq.cal
1444
1445    ss(p)
1446
1447    Determine the unique two positive integers whose squares sum to the
1448    specified prime.  This is always possible for all primes of the form
1449    4N+1, and always impossible for primes of the form 4N-1.
1450
1451
1452sumtimes.cal
1453
1454    timematsum(N)
1455    timelistsum(N)
1456    timematsort(N)
1457    timelistsort(N)
1458    timematreverse(N)
1459    timelistreverse(N)
1460    timematssq(N)
1461    timelistssq(N)
1462    timehmean(N,M)
1463    doalltimes(N)
1464
1465    Give the user CPU time for various ways of evaluating sums, sums of
1466    squares, etc, for large lists and matrices.  N is the size of
1467    the list or matrix to use.  The doalltimes() function will run
1468    all of the sumtimes tests.  For example:
1469
1470	doalltimes(1e6);
1471
1472
1473surd.cal
1474
1475    surd(a, b)
1476    surd_print(a)
1477    surd_conj(a)
1478    surd_norm(a)
1479    surd_value(a, xepsilon)
1480    surd_add(a, b)
1481    surd_sub(a, b)
1482    surd_inc(a)
1483    surd_dec(a)
1484    surd_neg(a)
1485    surd_mul(a, b)
1486    surd_square(a)
1487    surd_scale(a, b)
1488    surd_shift(a, b)
1489    surd_div(a, b)
1490    surd_inv(a)
1491    surd_sgn(a)
1492    surd_cmp(a, b)
1493    surd_rel(a, b)
1494
1495    Calculate using quadratic surds of the form: a + b * sqrt(D).
1496
1497
1498test1700.cal
1499
1500    value
1501
1502    This resource files is used by regress.cal to test the read and
1503    use keywords.
1504
1505
1506test2600.cal
1507
1508    global defaultverbose
1509    global err
1510    testismult(str, n, verbose)
1511    testsqrt(str, n, eps, verbose)
1512    testexp(str, n, eps, verbose)
1513    testln(str, n, eps, verbose)
1514    testpower(str, n, b, eps, verbose)
1515    testgcd(str, n, verbose)
1516    cpow(x, n, eps)
1517    cexp(x, eps)
1518    cln(x, eps)
1519    mkreal()
1520    mkcomplex()
1521    mkbigreal()
1522    mksmallreal()
1523    testappr(str, n, verbose)
1524    checkappr(x, y, z, verbose)
1525    checkresult(x, y, z, a)
1526    test2600(verbose, tnum)
1527
1528    This resource files is used by regress.cal to test some of builtin
1529    functions in terms of accuracy and roundoff.
1530
1531
1532test2700.cal
1533
1534    global defaultverbose
1535    mknonnegreal()
1536    mkposreal()
1537    mkreal_2700()
1538    mknonzeroreal()
1539    mkposfrac()
1540    mkfrac()
1541    mksquarereal()
1542    mknonsquarereal()
1543    mkcomplex_2700()
1544    testcsqrt(str, n, verbose)
1545    checksqrt(x, y, z, v)
1546    checkavrem(A, B, X, eps)
1547    checkrounding(s, n, t, u, z)
1548    iscomsq(x)
1549    test2700(verbose, tnum)
1550
1551    This resource files is used by regress.cal to test sqrt() for real and
1552    complex values.
1553
1554
1555test3100.cal
1556
1557    obj res
1558    global md
1559    res_test(a)
1560    res_sub(a, b)
1561    res_mul(a, b)
1562    res_neg(a)
1563    res_inv(a)
1564    res(x)
1565
1566    This resource file is used by regress.cal to test determinants of
1567    a matrix.
1568
1569
1570test3300.cal
1571
1572    global defaultverbose
1573    global err
1574    testi(str, n, N, verbose)
1575    testr(str, n, N, verbose)
1576    test3300(verbose, tnum)
1577
1578    This resource file is used by regress.cal to provide for more
1579    determinant tests.
1580
1581
1582test3400.cal
1583
1584    global defaultverbose
1585    global err
1586    test1(str, n, eps, verbose)
1587    test2(str, n, eps, verbose)
1588    test3(str, n, eps, verbose)
1589    test4(str, n, eps, verbose)
1590    test5(str, n, eps, verbose)
1591    test6(str, n, eps, verbose)
1592    test3400(verbose, tnum)
1593
1594    This resource file is used by regress.cal to test trig functions.
1595    containing objects.
1596
1597test3500.cal
1598
1599    global defaultverbose
1600    global err
1601    testfrem(x, y, verbose)
1602    testgcdrem(x, y, verbose)
1603    testf(str, n, verbose)
1604    testg(str, n, verbose)
1605    testh(str, n, N, verbose)
1606    test3500(verbose, n, N)
1607
1608    This resource file is used by regress.cal to test the functions frem,
1609    fcnt, gcdrem.
1610
1611
1612test4000.cal
1613
1614    global defaultverbose
1615    global err
1616    global BASEB
1617    global BASE
1618    global COUNT
1619    global SKIP
1620    global RESIDUE
1621    global MODULUS
1622    global K1
1623    global H1
1624    global K2
1625    global H2
1626    global K3
1627    global H3
1628    plen(N) defined
1629    rlen(N) defined
1630    clen(N) defined
1631    ptimes(str, N, n, count, skip, verbose) defined
1632    ctimes(str, N, n, count, skip, verbose) defined
1633    crtimes(str, a, b, n, count, skip, verbose) defined
1634    ntimes(str, N, n, count, skip, residue, mod, verbose) defined
1635    testnextcand(str, N, n, cnt, skip, res, mod, verbose) defined
1636    testnext1(x, y, count, skip, residue, modulus) defined
1637    testprevcand(str, N, n, cnt, skip, res, mod, verbose) defined
1638    testprev1(x, y, count, skip, residue, modulus) defined
1639    test4000(verbose, tnum) defined
1640
1641    This resource file is used by regress.cal to test ptest, nextcand and
1642    prevcand builtins.
1643
1644
1645test4100.cal
1646
1647    global defaultverbose
1648    global err
1649    global K1
1650    global K2
1651    global BASEB
1652    global BASE
1653    rlen_4100(N) defined
1654    olen(N) defined
1655    test1(x, y, m, k, z1, z2) defined
1656    testall(str, n, N, M, verbose) defined
1657    times(str, N, n, verbose) defined
1658    powtimes(str, N1, N2, n, verbose) defined
1659    inittimes(str, N, n, verbose) defined
1660    test4100(verbose, tnum) defined
1661
1662    This resource file is used by regress.cal to test REDC operations.
1663
1664
1665test4600.cal
1666
1667    stest(str [, verbose]) defined
1668    ttest([m, [n [,verbose]]]) defined
1669    sprint(x) defined
1670    findline(f,s) defined
1671    findlineold(f,s) defined
1672    test4600(verbose, tnum) defined
1673
1674    This resource file is used by regress.cal to test searching in files.
1675
1676
1677test5100.cal
1678
1679    global a5100
1680    global b5100
1681    test5100(x) defined
1682
1683    This resource file is used by regress.cal to test the new code generator
1684    declaration scope and order.
1685
1686
1687test5200.cal
1688
1689    global a5200
1690    static a5200
1691    f5200(x) defined
1692    g5200(x) defined
1693    h5200(x) defined
1694
1695    This resource file is used by regress.cal to test the fix of a
1696    global/static bug.
1697
1698
1699test8400.cal
1700
1701    test8400() defined
1702
1703    This resource file is used by regress.cal to check for quit-based
1704    memory leaks.
1705
1706
1707test8500.cal
1708
1709    global err_8500
1710    global L_8500
1711    global ver_8500
1712    global old_seed_8500
1713    global cfg_8500
1714    onetest_8500(a,b,rnd) defined
1715    divmod_8500(N, M1, M2, testnum) defined
1716
1717    This resource file is used by regress.cal to the // and % operators.
1718
1719
1720test8600.cal
1721
1722    global min_8600
1723    global max_8600
1724    global hash_8600
1725    global hmean_8600
1726
1727    This resource file is used by regress.cal to test a change of
1728    allowing up to 1024 args to be passed to a builtin function.
1729
1730
1731test8900.cal
1732
1733    This function tests a number of calc resource functions contributed
1734    by Christoph Zurnieden.  These include:
1735
1736	bernpoly.cal
1737	brentsolve.cal
1738	constants.cal
1739	factorial2.cal
1740	factorial.cal
1741	lambertw.cal
1742	lnseries.cal
1743	specialfunctions.cal
1744	statistics.cal
1745	toomcook.cal
1746	zeta2.cal
1747
1748
1749unitfrac.cal
1750
1751    unitfrac(x)
1752
1753    Represent a fraction as sum of distinct unit fractions.
1754
1755
1756toomcook.cal
1757
1758
1759    toomcook3(a,b)
1760    toomcook4(a,b)
1761
1762    Toom-Cook multiplication algorithm.  Multiply two integers a,b by
1763    way of the Toom-Cook algorithm.  See:
1764
1765	http://en.wikipedia.org/wiki/Toom%E2%80%93Cook_multiplication
1766
1767    toomcook3square(a)
1768    toomcook4square(a)
1769
1770    Square the integer a by way of the Toom-Cook algorithm.  See:
1771
1772	http://en.wikipedia.org/wiki/Toom%E2%80%93Cook_multiplication
1773
1774    The function toomCook4(a,b) calls the function toomCook3(a,b) which
1775    calls built-in multiplication at a specific cut-off point. The
1776    squaring functions act in the same way.
1777
1778
1779varargs.cal
1780
1781    sc(a, b, ...)
1782
1783    Example program to use 'varargs'.  Program to sum the cubes of all
1784    the specified numbers.
1785
1786
1787xx_print.cal
1788
1789    is_octet(a) defined
1790    list_print(a) defined
1791    mat_print (a) defined
1792    octet_print(a) defined
1793    blk_print(a) defined
1794    nblk_print (a) defined
1795    strchar(a) defined
1796    file_print(a) defined
1797    error_print(a) defined
1798
1799    Demo for the xx_print object routines.
1800
1801
1802zeta2.cal
1803
1804    hurwitzzeta(s,a)
1805
1806    Calculate the value of the Hurwitz Zeta function.  See:
1807
1808	http://en.wikipedia.org/wiki/Hurwitz_zeta_function
1809        http://dlmf.nist.gov/25.11
1810
1811    for information on this special zeta function.
1812
1813
1814## Copyright (C) 2000,2014,2017,2021  David I. Bell and Landon Curt Noll
1815##
1816## Primary author: Landon Curt Noll
1817##
1818## Calc is open software; you can redistribute it and/or modify it under
1819## the terms of the version 2.1 of the GNU Lesser General Public License
1820## as published by the Free Software Foundation.
1821##
1822## Calc is distributed in the hope that it will be useful, but WITHOUT
1823## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1824## or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU Lesser General
1825## Public License for more details.
1826##
1827## A copy of version 2.1 of the GNU Lesser General Public License is
1828## distributed with calc under the filename COPYING-LGPL.  You should have
1829## received a copy with calc; if not, write to Free Software Foundation, Inc.
1830## 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
1831##
1832## Under source code control:	1990/02/15 01:50:32
1833## File existed as early as:	before 1990
1834##
1835## chongo <was here> /\oo/\	http://www.isthe.com/chongo/
1836## Share and enjoy!  :-)	http://www.isthe.com/chongo/tech/comp/calc/
1837