mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Fix many spelling errors
This commit is contained in:
@@ -181,14 +181,14 @@ FMT= fmt
|
||||
|
||||
# The calc files to install
|
||||
#
|
||||
# This list is prodiced by the detaillist rule when no WARNINGS are detected.
|
||||
# This list is produced by the detaillist rule when no WARNINGS are detected.
|
||||
#
|
||||
# Please use:
|
||||
#
|
||||
# make calc_files_list
|
||||
#
|
||||
# to keep this list in nice sorted order and to check that these
|
||||
# deailed help files are under RCS control.
|
||||
# detailed help files are under RCS control.
|
||||
#
|
||||
CALC_FILES= README alg_config.cal beer.cal bernoulli.cal \
|
||||
bernpoly.cal bigprime.cal bindings brentsolve.cal chi.cal chrem.cal \
|
||||
@@ -236,7 +236,7 @@ all: ${CALC_FILES} ${MAKE_FILE} .all
|
||||
# sub-directory called calc/cal.
|
||||
#
|
||||
# NOTE: Due to bogus shells found on one common system we must have
|
||||
# an non-emoty else clause for every if condition. *sigh*
|
||||
# an non-empty else clause for every if condition. *sigh*
|
||||
#
|
||||
##
|
||||
|
||||
@@ -391,7 +391,7 @@ uninstall:
|
||||
if [ -f "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
else \
|
||||
echo "uninstalled ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
echo "un-installed ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
fi; \
|
||||
fi; \
|
||||
done
|
||||
|
34
cal/README
34
cal/README
@@ -213,12 +213,12 @@ brentsolve.cal
|
||||
|
||||
brentsolve(low, high,eps)
|
||||
|
||||
A root-finder implementwed with the Brent-Dekker trick.
|
||||
A root-finder implemented with the Brent-Dekker trick.
|
||||
|
||||
brentsolve2(low, high,which,eps)
|
||||
|
||||
The second function, brentsolve2(low, high,which,eps) has some lines
|
||||
added to make it easier to hardcode the name of the helper function
|
||||
added to make it easier to hard-code the name of the helper function
|
||||
different from the obligatory "f".
|
||||
|
||||
See:
|
||||
@@ -392,7 +392,7 @@ factorial2.cal
|
||||
|
||||
bigcatalan(n)
|
||||
|
||||
Calculates the n-th Catalan number for n large. It is usefull
|
||||
Calculates the n-th Catalan number for n large. It is useful
|
||||
above n~50,000 but defaults to the builtin function for smaller
|
||||
values.Meant as a complete replacement for catalan(n) with only a
|
||||
very small overhead. See:
|
||||
@@ -433,9 +433,9 @@ factorial2.cal
|
||||
k = 0
|
||||
|
||||
The other function stirling2caching(n,m) does it by way of the
|
||||
reccurence relation and keeps all earlier results. This function
|
||||
re-occurrence relation and keeps all earlier results. This function
|
||||
is much slower for computing a single value than stirling2(n,m) but
|
||||
is very usefull if many Stirling numbers are needed, for example in
|
||||
is very useful if many Stirling numbers are needed, for example in
|
||||
a series. See:
|
||||
|
||||
http://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
|
||||
@@ -546,7 +546,7 @@ infinities.cal
|
||||
pinf()
|
||||
|
||||
The symbolic handling of infinities. Needed for intnum.cal but might be
|
||||
usefull elsewhere, too.
|
||||
useful elsewhere, too.
|
||||
|
||||
|
||||
intfile.cal
|
||||
@@ -595,13 +595,13 @@ intnum.cal
|
||||
This file offers some methods for numerical integration. Implemented are
|
||||
the Gauss-Legendre and the tanh-sinh quadrature.
|
||||
|
||||
All functions are usefull to some extend but the main function for
|
||||
All functions are useful to some extend but the main function for
|
||||
quadrature is quad(), which is not much more than an abstraction layer.
|
||||
|
||||
The main workers are quadgl() for Gauss-legendre and quadts() for the
|
||||
The main workers are quadgl() for Gauss-Legendre and quadts() for the
|
||||
tanh-sinh quadrature. The limits of the integral can be anything in the
|
||||
complex plane and the extended real line. The latter means that infinite
|
||||
limits are supported by way of the smbolic infinities implemented in the
|
||||
limits are supported by way of the symbolic infinities implemented in the
|
||||
file infinities.cal (automatically linked in by intnum.cal).
|
||||
|
||||
Integration in parts and contour is supported by the "points" argument
|
||||
@@ -661,7 +661,7 @@ intnum.cal
|
||||
|
||||
The quad*core functions do not offer anything fancy but the third parameter
|
||||
controls the so called "order" which is just the number of nodes computed.
|
||||
This can be quite usefull in some circumstances.
|
||||
This can be quite useful in some circumstances.
|
||||
|
||||
; quadgldeletenodes()
|
||||
; define f(x){ return exp(x);}
|
||||
@@ -723,7 +723,7 @@ lambertw.cal
|
||||
ProductLog[branch,z] with the tested values.
|
||||
|
||||
The series is only valid for the branches 0,-1, real z, converges
|
||||
for values of z _very_ near the branchpoint -exp(-1) only, and must
|
||||
for values of z _very_ near the branch-point -exp(-1) only, and must
|
||||
be given the branches explicitly. See the code in lambertw.cal
|
||||
for further information.
|
||||
|
||||
@@ -746,7 +746,7 @@ lnseries.cal
|
||||
does so by computing the prime factorization of all of the number
|
||||
sequence 1,2,3...n, calculates the natural logarithms of the primes
|
||||
in 1,2,3...n and uses the above factorization to build the natural
|
||||
logarithms of the rest of the sequence by sadding the logarithms of
|
||||
logarithms of the rest of the sequence by adding the logarithms of
|
||||
the primes in the factorization. This is faster for high precision
|
||||
of the logarithms and/or long sequences.
|
||||
|
||||
@@ -806,7 +806,7 @@ mfactor.cal
|
||||
at 2*start_k*n+1. Skips values that are multiples of primes <= p_elim.
|
||||
By default, start_k == 1, rept_loop = 10000 and p_elim = 17.
|
||||
|
||||
The p_elim == 17 overhead takes ~3 minutes on an 200 Mhz r4k CPU and
|
||||
The p_elim == 17 overhead takes ~3 minutes on an 200 MHz r4k CPU and
|
||||
requires about ~13 Megs of memory. The p_elim == 13 overhead
|
||||
takes about 3 seconds and requires ~1.5 Megs of memory.
|
||||
|
||||
@@ -1317,7 +1317,7 @@ specialfunctions.cal
|
||||
http://en.wikipedia.org/wiki/Polygamma
|
||||
http://dlmf.nist.gov/5
|
||||
|
||||
for information on the n-th derivative ofthe Euler gamma function. This
|
||||
for information on the n-th derivative of the Euler gamma function. This
|
||||
function depends on the script zeta2.cal.
|
||||
|
||||
|
||||
@@ -1334,7 +1334,7 @@ specialfunctions.cal
|
||||
|
||||
zeta(s)
|
||||
|
||||
Calculates the value of the Rieman Zeta function at s. See:
|
||||
Calculates the value of the Riemann Zeta function at s. See:
|
||||
|
||||
http://en.wikipedia.org/wiki/Riemann_zeta_function
|
||||
http://dlmf.nist.gov/25.2
|
||||
@@ -1353,7 +1353,7 @@ statistics.cal
|
||||
invbetainc(x,a,b)
|
||||
|
||||
Computes the inverse of the regularized beta function. Does so the
|
||||
brute-force way wich makes it a bit slower.
|
||||
brute-force way which makes it a bit slower.
|
||||
|
||||
betapdf(x,a,b)
|
||||
betacdf(x,a,b)
|
||||
@@ -1433,7 +1433,7 @@ sumtimes.cal
|
||||
Give the user CPU time for various ways of evaluating sums, sums of
|
||||
squares, etc, for large lists and matrices. N is the size of
|
||||
the list or matrix to use. The doalltimes() function will run
|
||||
all fo the sumtimes tests. For example:
|
||||
all of the sumtimes tests. For example:
|
||||
|
||||
doalltimes(1e6);
|
||||
|
||||
|
@@ -33,7 +33,7 @@ static test_time; /* try for this many seconds in loop test */
|
||||
* given:
|
||||
* ratio the ratio of time between two algorithms
|
||||
*
|
||||
* retuns:
|
||||
* returns:
|
||||
* 1 When ratio is near 1.0
|
||||
* 0 otherwise
|
||||
*
|
||||
@@ -354,7 +354,7 @@ define best_mul2()
|
||||
local high; /* high loop value tested */
|
||||
local mid; /* between low and high */
|
||||
local best_val; /* value found with ratio closest to unity */
|
||||
local best_ratio; /* cloest ratio found to unity */
|
||||
local best_ratio; /* closest ratio found to unity */
|
||||
local expand; /* how fast to expand the length */
|
||||
|
||||
/*
|
||||
@@ -363,7 +363,7 @@ define best_mul2()
|
||||
printf("WARNING: This tool may not be computing the correct best value\n");
|
||||
test_time = 5.0;
|
||||
printf("The best_mul2() function will take a LONG time to run!\n");
|
||||
printf("It is important that best_mul2() run on an othwewise idle host!\n");
|
||||
printf("It is important that best_mul2() run on an otherwise idle host!\n");
|
||||
if (config("user_debug") <= 0) {
|
||||
printf("To monitor progress, set user_debug to 2: "
|
||||
"config(\"user_debug\", 2)\n");
|
||||
@@ -392,7 +392,7 @@ define best_mul2()
|
||||
*/
|
||||
do {
|
||||
/*
|
||||
* determine the paramters of the next ratio test
|
||||
* determine the parameters of the next ratio test
|
||||
*
|
||||
* We will multiplicatively expand our test level until
|
||||
* the ratio drops below 1.0.
|
||||
@@ -419,7 +419,7 @@ define best_mul2()
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
@@ -442,7 +442,7 @@ define best_mul2()
|
||||
high /= 2;
|
||||
low = high / 2;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("retesting multiply alg1/alg2 ratio for len = %d\n",
|
||||
printf("re-testing multiply alg1/alg2 ratio for len = %d\n",
|
||||
high);
|
||||
}
|
||||
ratio = mul_ratio(high);
|
||||
@@ -450,7 +450,8 @@ define best_mul2()
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
printf(" len %d has a new closest ratio "
|
||||
"to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
@@ -483,7 +484,7 @@ define best_mul2()
|
||||
best_val = mid;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
@@ -535,7 +536,7 @@ define best_mul2()
|
||||
printf("config(\"mul2\", %d),;\n", best_val);
|
||||
printf("WARNING: It is believed that the output "
|
||||
"of this resource file is bogus!\n");
|
||||
printf("WARNING: You may NOT wish to follow the above suggeston.\n");
|
||||
printf("WARNING: You may NOT wish to follow the above suggestion.\n");
|
||||
}
|
||||
return mid;
|
||||
}
|
||||
@@ -835,7 +836,7 @@ define best_sq2()
|
||||
local high; /* high loop value tested */
|
||||
local mid; /* between low and high */
|
||||
local best_val; /* value found with ratio closest to unity */
|
||||
local best_ratio; /* cloest ratio found to unity */
|
||||
local best_ratio; /* closest ratio found to unity */
|
||||
local expand; /* how fast to expand the length */
|
||||
|
||||
/*
|
||||
@@ -844,7 +845,7 @@ define best_sq2()
|
||||
printf("WARNING: This tool may not be computing the correct best value\n");
|
||||
test_time = 5.0;
|
||||
printf("The best_sq2() function will take a LONG time to run!\n");
|
||||
printf("It is important that best_sq2() run on an othwewise idle host!\n");
|
||||
printf("It is important that best_sq2() run on an otherwise idle host!\n");
|
||||
if (config("user_debug") <= 0) {
|
||||
printf("To monitor progress, set user_debug to 2: "
|
||||
"config(\"user_debug\", 2)\n");
|
||||
@@ -873,7 +874,7 @@ define best_sq2()
|
||||
*/
|
||||
do {
|
||||
/*
|
||||
* determine the paramters of the next ratio test
|
||||
* determine the parameters of the next ratio test
|
||||
*
|
||||
* We will multiplicatively expand our test level until
|
||||
* the ratio drops below 1.0.
|
||||
@@ -900,7 +901,7 @@ define best_sq2()
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
@@ -923,7 +924,7 @@ define best_sq2()
|
||||
high /= 2;
|
||||
low = high / 2;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("retesting multiply alg1/alg2 ratio for len = %d\n",
|
||||
printf("re-testing multiply alg1/alg2 ratio for len = %d\n",
|
||||
high);
|
||||
}
|
||||
ratio = mul_ratio(high);
|
||||
@@ -931,7 +932,8 @@ define best_sq2()
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
printf(" len %d has a new closest ratio "
|
||||
"to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
@@ -964,7 +966,7 @@ define best_sq2()
|
||||
best_val = mid;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
@@ -1017,7 +1019,7 @@ define best_sq2()
|
||||
printf("config(\"sq2\", %d),;\n", best_val);
|
||||
printf("WARNING: It is believed that the output "
|
||||
"of this resource file is bogus!\n");
|
||||
printf("WARNING: You may NOT wish to follow the above suggeston.\n");
|
||||
printf("WARNING: You may NOT wish to follow the above suggestion.\n");
|
||||
}
|
||||
return mid;
|
||||
}
|
||||
@@ -1337,7 +1339,7 @@ define best_pow2()
|
||||
local high; /* high loop value tested */
|
||||
local mid; /* between low and high */
|
||||
local best_val; /* value found with ratio closest to unity */
|
||||
local best_ratio; /* cloest ratio found to unity */
|
||||
local best_ratio; /* closest ratio found to unity */
|
||||
local expand; /* how fast to expand the length */
|
||||
local looped; /* 1 ==> we have expanded lengths before */
|
||||
|
||||
@@ -1347,7 +1349,7 @@ define best_pow2()
|
||||
printf("WARNING: This tool may not be computing the correct best value\n");
|
||||
test_time = 60.0;
|
||||
printf("The best_pow2() function will take a LONG time to run!\n");
|
||||
printf("It is important that best_pow2() run on an othwewise idle host!\n");
|
||||
printf("It is important that best_pow2() run on an otherwise idle host!\n");
|
||||
if (config("user_debug") <= 0) {
|
||||
printf("To monitor progress, set user_debug to 2: "
|
||||
"config(\"user_debug\", 2)\n");
|
||||
@@ -1358,7 +1360,7 @@ define best_pow2()
|
||||
* firewall - must have a >1.02 ratio for the initial length
|
||||
*
|
||||
* We select 1.02 because of the precision of the CPU timing. We
|
||||
* want to firt move into an area where the 1st algoritm clearly
|
||||
* want to first move into an area where the 1st algorithm clearly
|
||||
* dominates.
|
||||
*/
|
||||
low = 4;
|
||||
@@ -1375,7 +1377,7 @@ define best_pow2()
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
@@ -1397,7 +1399,7 @@ define best_pow2()
|
||||
looped = 0;
|
||||
do {
|
||||
/*
|
||||
* determine the paramters of the next ratio test
|
||||
* determine the parameters of the next ratio test
|
||||
*
|
||||
* We will multiplicatively expand our test level until
|
||||
* the ratio drops below 1.0.
|
||||
@@ -1435,7 +1437,7 @@ define best_pow2()
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
@@ -1463,7 +1465,7 @@ define best_pow2()
|
||||
best_val = mid;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
@@ -1516,7 +1518,7 @@ define best_pow2()
|
||||
printf("config(\"pow2\", %d),;\n", best_val);
|
||||
printf("WARNING: It is believed that the output "
|
||||
"of this resource file is bogus!\n");
|
||||
printf("WARNING: You may NOT wish to follow the above suggeston.\n");
|
||||
printf("WARNING: You may NOT wish to follow the above suggestion.\n");
|
||||
}
|
||||
return mid;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* bernoulli - clculate the Nth Bernoulli number B(n)
|
||||
* bernoulli - calculate the Nth Bernoulli number B(n)
|
||||
*
|
||||
* Copyright (C) 2000 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
@@ -26,9 +26,9 @@
|
||||
/*
|
||||
* Calculate the Nth Bernoulli number B(n).
|
||||
*
|
||||
* NOTE: This is now a bulitin function.
|
||||
* NOTE: This is now a builtin function.
|
||||
*
|
||||
* The non-buildin code used the following symbolic formula to calculate B(n):
|
||||
* The non-builtin code used the following symbolic formula to calculate B(n):
|
||||
*
|
||||
* (b+1)^(n+1) - b^(n+1) = 0
|
||||
*
|
||||
@@ -42,7 +42,7 @@
|
||||
* B(3) = -(6*B(2) + 4*B(1) + 1) / 4
|
||||
*
|
||||
* The combinatorial factors in the expansion of the above formula are
|
||||
* calculated interatively, and we use the fact that B(2i+1) = 0 if i > 0.
|
||||
* calculated interactively, and we use the fact that B(2i+1) = 0 if i > 0.
|
||||
* Since all previous B(n)'s are needed to calculate a particular B(n), all
|
||||
* values obtained are saved in an array for ease in repeated calculations.
|
||||
*/
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* bernpoly - Bernoully polynomials B_n(z) for arbitrary n,z..
|
||||
* bernpoly - Bernoulli polynomials B_n(z) for arbitrary n,z..
|
||||
*
|
||||
* Copyright (C) 2013 Christoph Zurnieden
|
||||
*
|
||||
|
@@ -143,7 +143,7 @@ define brentsolve2(low, high,which,eps){
|
||||
|
||||
switch(param(0)){
|
||||
case 0:
|
||||
case 1: return newerror("brentsolve2: not enough argments");
|
||||
case 1: return newerror("brentsolve2: not enough arguments");
|
||||
case 2: eps = epsilon(epsilon()*1e-2);
|
||||
which = 0;break;
|
||||
case 3: eps = epsilon(epsilon()*1e-2);break;
|
||||
|
@@ -51,7 +51,7 @@ define Z(x, eps_term)
|
||||
|
||||
|
||||
/*
|
||||
* P(x[, eps]) asymtotic P(x) expansion for x>0 to an given epsilon error term
|
||||
* P(x[, eps]) asymptotic P(x) expansion for x>0 to an given epsilon error term
|
||||
*
|
||||
* NOTE: If eps is omitted, the stored epsilon value is used.
|
||||
*
|
||||
@@ -99,7 +99,7 @@ define P(x, eps_term)
|
||||
}
|
||||
|
||||
/*
|
||||
* aproximate sum(n=0; n < infinity){x^(2*n+1)/(1*3*5*...(2*n+1)}
|
||||
* approximate sum(n=0; n < infinity){x^(2*n+1)/(1*3*5*...(2*n+1)}
|
||||
*/
|
||||
x2 = x*x;
|
||||
x_term = x;
|
||||
@@ -130,7 +130,7 @@ define P(x, eps_term)
|
||||
*
|
||||
* The chi_prob() function does not work well with odd degrees of freedom.
|
||||
* It is reasonable with even degrees of freedom, although one must give
|
||||
* a sifficently small error term as the degress gets large (>100).
|
||||
* a sufficiently small error term as the degrees gets large (>100).
|
||||
*
|
||||
* NOTE: This function does not work well with odd degrees of freedom.
|
||||
* Can somebody help / find a bug / provide a better method of
|
||||
@@ -186,7 +186,7 @@ define chi_prob(chi_sq, v, eps_term)
|
||||
local r; /* index in finite sum */
|
||||
local r_lim; /* limit value for r */
|
||||
local s; /* sum */
|
||||
local d; /* demoninator (2*4*6*... or 1*3*5...) */
|
||||
local d; /* denominator (2*4*6*... or 1*3*5...) */
|
||||
local chi_term; /* chi_sq^r */
|
||||
local ret; /* return value */
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* chrem - chinese remainder theorem/problem solver
|
||||
* chrem - Chinese remainder theorem/problem solver
|
||||
*
|
||||
* Copyright (C) 1999 Ernest Bowen and Landon Curt Noll
|
||||
*
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* When possible, chrem finds solutions for x of a set of congruences
|
||||
* When possible, chrem finds solutions for x of a set of congruence
|
||||
* of the form:
|
||||
*
|
||||
* x = r1 (mod m1)
|
||||
@@ -35,7 +35,7 @@
|
||||
*
|
||||
* where the residues r1, r2, ... and the moduli m1, m2, ... are
|
||||
* given integers. The Chinese remainder theorem states that if
|
||||
* m1, m2, ... are relatively prime in pairs, the above congruences
|
||||
* m1, m2, ... are relatively prime in pairs, the above congruence
|
||||
* have a unique solution modulo m1 * m2 * ... If m1, m2, ...
|
||||
* are not relatively prime in pairs, it is possible that no solution
|
||||
* exists. If solutions exist, the general solution is expressible as:
|
||||
|
@@ -53,7 +53,7 @@ define dms_add(a, b)
|
||||
{
|
||||
local obj dms ans; /* return value */
|
||||
|
||||
/* initalize value to 1st arg */
|
||||
/* initialize value to 1st arg */
|
||||
if (istype(a, ans)) {
|
||||
/* 1st arg is dms object, load it */
|
||||
ans.deg = a.deg;
|
||||
@@ -110,7 +110,7 @@ define dms_sub(a, b)
|
||||
{
|
||||
local obj dms ans; /* return value */
|
||||
|
||||
/* initalize value to 1st arg */
|
||||
/* initialize value to 1st arg */
|
||||
if (istype(a, ans)) {
|
||||
/* 1st arg is dms object, load it */
|
||||
ans.deg = a.deg;
|
||||
@@ -352,11 +352,11 @@ define fixdms(a)
|
||||
quit "attempt to fix a non dms object";
|
||||
}
|
||||
|
||||
/* force minutes to be intergral */
|
||||
/* force minutes to be integral */
|
||||
a.min += frac(a.deg) * 60;
|
||||
a.deg = int(a.deg);
|
||||
|
||||
/* force degrees to be intergral */
|
||||
/* force degrees to be integral */
|
||||
a.sec += frac(a.min) * 60;
|
||||
a.min = int(a.min);
|
||||
|
||||
|
@@ -8,8 +8,8 @@
|
||||
* copyright this dotest_code.
|
||||
*
|
||||
* ERNEST BOWEN AND LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY AND FITNESS. IN NO EVENT SHALL LANDON CURT
|
||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY AND FITNESS. IN NO EVENT SHALL LANDON CURT
|
||||
* NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
@@ -173,7 +173,7 @@ define dotest(dotest_file, dotest_code = 0, dotest_maxcond = -1)
|
||||
}
|
||||
|
||||
/*
|
||||
* preppare to return to the caller environment
|
||||
* prepare to return to the caller environment
|
||||
*
|
||||
* We increase the caller's error count by the number
|
||||
* of line tests that failed, not the number of internal
|
||||
|
@@ -281,10 +281,10 @@ define __CZ__multiply_factored_factorial(matrix,stop){
|
||||
}
|
||||
|
||||
/*
|
||||
Compute binomial coeficients n!/(k!(n-k)!)
|
||||
Compute binomial coefficients n!/(k!(n-k)!)
|
||||
|
||||
One of the rare cases where a formula once meant to ease manual computation
|
||||
is actually the (aymptotically) fastest way to do it (in July 2013) for
|
||||
is actually the (asymptotically) fastest way to do it (in July 2013) for
|
||||
the extreme case binomial(2N,N) but for a high price, the memory
|
||||
needed is pi(N)--theoretically.
|
||||
*/
|
||||
@@ -626,7 +626,7 @@ define subfactorialrecursive(n){
|
||||
return n * subfactorialrecursive(n-1) + (-1)^n;
|
||||
}
|
||||
|
||||
/* This is, quite amusingely, faster than the very same algorithm in
|
||||
/* This is, quite amusingly, faster than the very same algorithm in
|
||||
PARI/GP + GMP*/
|
||||
define subfactorialiterative(n){
|
||||
local k temp1 temp2 ret;
|
||||
|
@@ -53,7 +53,7 @@ define hms_add(a, b)
|
||||
{
|
||||
local obj hms ans; /* return value */
|
||||
|
||||
/* initalize value to 1st arg */
|
||||
/* initialize value to 1st arg */
|
||||
if (istype(a, ans)) {
|
||||
/* 1st arg is hms object, load it */
|
||||
ans.hour = a.hour;
|
||||
@@ -110,7 +110,7 @@ define hms_sub(a, b)
|
||||
{
|
||||
local obj hms ans; /* return value */
|
||||
|
||||
/* initalize value to 1st arg */
|
||||
/* initialize value to 1st arg */
|
||||
if (istype(a, ans)) {
|
||||
/* 1st arg is hms object, load it */
|
||||
ans.hour = a.hour;
|
||||
@@ -352,11 +352,11 @@ define fixhms(a)
|
||||
quit "attempt to fix a non hms object";
|
||||
}
|
||||
|
||||
/* force minutes to be intergral */
|
||||
/* force minutes to be integral */
|
||||
a.min += frac(a.hour) * 60;
|
||||
a.hour = int(a.hour);
|
||||
|
||||
/* force hours to be intergral */
|
||||
/* force hours to be integral */
|
||||
a.sec += frac(a.min) * 60;
|
||||
a.min = int(a.min);
|
||||
|
||||
|
@@ -27,20 +27,20 @@
|
||||
|
||||
/*
|
||||
* NOTE: Because leading HALF values are trimmed from integer, a file
|
||||
* that begins with lots of 0 bits (in the case of big endian)
|
||||
* or that ends with lots of 0 bits (in the case of little endian)
|
||||
* that begins with lots of 0 bits (in the case of big Endian)
|
||||
* or that ends with lots of 0 bits (in the case of little Endian)
|
||||
* will be changed when the subsequent integer is written back.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* file2be - convert a file into an big endian integer
|
||||
* file2be - convert a file into an big Endian integer
|
||||
*
|
||||
* given:
|
||||
* filename filename to read
|
||||
*
|
||||
* returns:
|
||||
* integer read from its contents on big endian order
|
||||
* integer read from its contents on big Endian order
|
||||
*/
|
||||
define file2be(filename)
|
||||
{
|
||||
@@ -75,13 +75,13 @@ define file2be(filename)
|
||||
|
||||
|
||||
/*
|
||||
* file2le - convert a file into an little endian integer
|
||||
* file2le - convert a file into an little Endian integer
|
||||
*
|
||||
* given:
|
||||
* filename filename to read
|
||||
*
|
||||
* returns:
|
||||
* integer read from its contents on little endian order
|
||||
* integer read from its contents on little Endian order
|
||||
*/
|
||||
define file2le(filename)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ define file2le(filename)
|
||||
|
||||
|
||||
/*
|
||||
* be2file - convert a big endian integer into a file
|
||||
* be2file - convert a big Endian integer into a file
|
||||
*
|
||||
* given:
|
||||
* v integer to write to the file
|
||||
@@ -168,7 +168,7 @@ define be2file(v, filename)
|
||||
|
||||
|
||||
/*
|
||||
* le2file - convert a little endian integer into a file
|
||||
* le2file - convert a little Endian integer into a file
|
||||
*
|
||||
* given:
|
||||
* v integer to write to the file
|
||||
|
@@ -295,7 +295,7 @@ define quadts(a, b, points)
|
||||
* as the number of equally spaced intervals on a straight line
|
||||
* connecting a and b. Computing the segments here is a bit
|
||||
* more complicated but not much, it should have been taught in
|
||||
* highschool.
|
||||
* high school.
|
||||
* Other contours by way of a list of points */
|
||||
slope = (im(b) - im(a)) / (re(b) - re(a));
|
||||
C = (im(a) + slope) * re(a);
|
||||
|
@@ -83,7 +83,7 @@ define __CZ__lambertw_m1(z,eps){
|
||||
or by using the function lambertw_series_print() after running
|
||||
lambertw_series(z,eps,branch,terms) at least once with the wanted number of
|
||||
terms and z = 1 (which might throw an error because the series will not
|
||||
converge in anybodies lifetime for something that far from the branchpoint).
|
||||
converge in anybodies lifetime for something that far from the branch point).
|
||||
|
||||
|
||||
*/
|
||||
@@ -105,7 +105,7 @@ define lambertw_series_print(){
|
||||
}
|
||||
|
||||
/*
|
||||
The series is fast but only if _very_ close to the branchpoint
|
||||
The series is fast but only if _very_ close to the branch point
|
||||
The exact branch must be given explicitly, e.g.:
|
||||
|
||||
; lambertw(-exp(-1)+.001)-lambertw_series(-exp(-1)+.001,epsilon()*1e-10,0)
|
||||
|
@@ -29,7 +29,7 @@
|
||||
*
|
||||
* given:
|
||||
* x0, y0 first known point on the line
|
||||
* x1, y1 second knonw point on the line
|
||||
* x1, y1 second known point on the line
|
||||
* x a given point to interpolate on
|
||||
*
|
||||
* returns:
|
||||
|
@@ -947,7 +947,7 @@ rodseth_xhn(x, h, n)
|
||||
*
|
||||
* Without Jacobi symbol value caching, it requires on average
|
||||
* 4.851377 Jacobi symbol evaluations. With Jacobi symbol value caching
|
||||
* cacheing, an averare of 4.348820 Jacobi symbol evaluations is needed.
|
||||
* cacheing, an average of 4.348820 Jacobi symbol evaluations is needed.
|
||||
*
|
||||
* Given this information, when odd h is a multiple of 3 we try, in order,
|
||||
* these odd values of X:
|
||||
@@ -961,7 +961,7 @@ rodseth_xhn(x, h, n)
|
||||
* jacobi(X-2, h*2^n-1) == 1
|
||||
* jacobi(X+2, h*2^n-1) == -1
|
||||
*
|
||||
* Less than 1 case out of 1000000 will not be satisifed by the above list.
|
||||
* Less than 1 case out of 1000000 will not be satisfied by the above list.
|
||||
* If no value in that list works, we start simple search starting with X = 167
|
||||
* and incrementing by 2 until a value of X is found.
|
||||
*
|
||||
@@ -1049,7 +1049,7 @@ next_x = 167; /* must be 2 more than the largest value in x_tbl[] */
|
||||
* else
|
||||
* v(1) = 4
|
||||
*
|
||||
* HOTE: The above "if then else" works only of h is not a multiple of 3.
|
||||
* NOTE: The above "if then else" works only of h is not a multiple of 3.
|
||||
*
|
||||
***
|
||||
*
|
||||
@@ -1234,10 +1234,10 @@ gen_v1(h, n)
|
||||
* jacobi(X-2, h*2^n-1) == 1 part 1
|
||||
* jacobi(X+2, h*2^n-1) == -1 part 2
|
||||
*
|
||||
* NOTE: If we wanted to be super optimial, we would cache
|
||||
* NOTE: If we wanted to be super optimal, we would cache
|
||||
* jacobi(X+2, h*2^n-1) that that when we increment X
|
||||
* to the next odd value, the now jacobi(X-2, h*2^n-1)
|
||||
* does not need to be re-evaluted.
|
||||
* does not need to be re-evaluated.
|
||||
*/
|
||||
testval = h*2^n-1;
|
||||
for (i=0; i < x_tbl_len; ++i) {
|
||||
@@ -1285,7 +1285,7 @@ gen_v1(h, n)
|
||||
/*
|
||||
* We are in that rare case (less than 1 in 1 000 000) where none of the
|
||||
* common X values satisfy Ref4 condition 1. We start a linear search
|
||||
* of odd vules at next_x from here on.
|
||||
* of odd values at next_x from here on.
|
||||
*/
|
||||
x = next_x;
|
||||
while (rodseth_xhn(x, h, n) != 1) {
|
||||
|
@@ -303,7 +303,7 @@ read -once "lucas.cal";
|
||||
* [quiet] if given and != 0, then do not print individual test results
|
||||
*
|
||||
* returns:
|
||||
* 1 all is ok
|
||||
* 1 all is OK
|
||||
* 0 something went wrong
|
||||
*/
|
||||
define
|
||||
|
@@ -79,7 +79,7 @@
|
||||
* hindx = 0;
|
||||
* } while (test_factor < some_limit);
|
||||
*
|
||||
* The test, mfactor(67, 1, 10000) took on an 200 Mhz r4k (user CPU seconds):
|
||||
* The test, mfactor(67, 1, 10000) took on an 200 MHz r4k (user CPU seconds):
|
||||
*
|
||||
* 210.83 (prior to use of hset[])
|
||||
* 78.35 (hset[] for p_elim = 7)
|
||||
@@ -99,7 +99,7 @@
|
||||
* 57.78 (hset[] for p_elim = 17)
|
||||
* p_elim == 19 rejected because of memory size
|
||||
*
|
||||
* The p_elim == 17 overhead takes ~3 minutes on an 200 Mhz r4k CPU and
|
||||
* The p_elim == 17 overhead takes ~3 minutes on an 200 MHz r4k CPU and
|
||||
* requires about ~13 Megs of memory. The p_elim == 13 overhead
|
||||
* takes about 3 seconds and requires ~1.5 Megs of memory.
|
||||
*
|
||||
@@ -256,7 +256,7 @@ define mfactor(n, start_k, rept_loop, p_elim)
|
||||
return q;
|
||||
} else {
|
||||
/* report this loop */
|
||||
printf("at 2*%d*%d+1, cpu: %f\n",
|
||||
printf("at 2*%d*%d+1, CPU: %f\n",
|
||||
(q-1)/(2*n), n, usertime());
|
||||
fflush(files(1));
|
||||
loop = 0;
|
||||
@@ -269,14 +269,14 @@ define mfactor(n, start_k, rept_loop, p_elim)
|
||||
*/
|
||||
if (rept_loop <= ++loop) {
|
||||
/* report this loop */
|
||||
printf("at 2*%d*%d+1, cpu: %f\n",
|
||||
printf("at 2*%d*%d+1, CPU: %f\n",
|
||||
(q-1)/(2*n), n, usertime());
|
||||
fflush(files(1));
|
||||
loop = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* skip if divisable by a prime <= 449
|
||||
* skip if divisible by a prime <= 449
|
||||
*
|
||||
* The value 281 was determined by timing loops
|
||||
* which found that 281 was at or near the
|
||||
@@ -285,7 +285,7 @@ define mfactor(n, start_k, rept_loop, p_elim)
|
||||
* The addition of the do { ... } while (factor(q, 449)>1);
|
||||
* loop reduced the factoring loop time (36504 k values with
|
||||
* the hset[] initialization time removed) from 25.69 sec to
|
||||
* 15.62 sec of CPU time on a 200Mhz r4k.
|
||||
* 15.62 sec of CPU time on a 200MHz r4k.
|
||||
*/
|
||||
do {
|
||||
/*
|
||||
|
@@ -76,7 +76,7 @@
|
||||
* A \ B = set difference, integers in A but not in B
|
||||
*
|
||||
* ~A = complement of A, integers not in A
|
||||
* #A = number ofintegers in A
|
||||
* #A = number of integers in A
|
||||
* !A = 1 or 0 according as A is empty or not empty
|
||||
* +A = sum of the members of A
|
||||
*
|
||||
@@ -100,7 +100,7 @@
|
||||
* A >= B = (B <= A)
|
||||
* A > B = (B < A)
|
||||
*
|
||||
* Expresssions may be formed from the above "arithmetic" operations in
|
||||
* Expressions may be formed from the above "arithmetic" operations in
|
||||
* the usual way, with parentheses for variations from the usual precedence
|
||||
* rules. For example
|
||||
*
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
/*
|
||||
* Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1.
|
||||
* Type the solution to pells equation for a particular D.
|
||||
* Type the solution to Pell's equation for a particular D.
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -35,7 +35,7 @@
|
||||
* variable has only one name. For some purposes, a name like
|
||||
* "sin(t)" or "(a + b)" or "\lambda" might be useful;
|
||||
* names like "*" or "-27" are legal but might give expressions
|
||||
* that are difficult to intepret.
|
||||
* that are difficult to interpret.
|
||||
*
|
||||
* Polynomial expressions may be constructed from numbers and the
|
||||
* independent variable and other polynomials by the algebraic
|
||||
@@ -43,7 +43,7 @@
|
||||
* The operations // and % are defined to have the quotient and
|
||||
* remainder meanings as usually defined for polynomials.
|
||||
*
|
||||
* When polynomials are assigned to idenfifiers, it is convenient to
|
||||
* When polynomials are assigned to identifiers, it is convenient to
|
||||
* think of the polynomials as values. For example, p = (x - 1)^2
|
||||
* assigns to p a polynomial value in the same way as q = (7 - 1)^2
|
||||
* would assign to q a number value. As with number expressions
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* prompt - eemonstration of some uses of prompt() and eval()
|
||||
* prompt - demonstration of some uses of prompt() and eval()
|
||||
*
|
||||
* Copyright (C) 1999 Ernest Bowen
|
||||
*
|
||||
@@ -61,9 +61,9 @@
|
||||
* nothing to sum. The last line returns the value 3, i.e. the last
|
||||
* non-null value found for the expressions separated by semicolons,
|
||||
* so sum will be increased by 3 after the "print sum^2;" command
|
||||
* is executed. xxx The terminating semicolon is essential in the
|
||||
* is executed. XXX The terminating semicolon is essential in the
|
||||
* last two lines. A command like eval("print 7;") is acceptable to
|
||||
* calc but eval("print 7") causes an exit from calc. xxx)
|
||||
* calc but eval("print 7") causes an exit from calc. XXX)
|
||||
*
|
||||
* If the value returned is not a number (e.g. the name of a list or matrix,
|
||||
* or if the string has syntax errors as in "2 + ", in which case the
|
||||
@@ -75,7 +75,7 @@
|
||||
* "sin(x)", "x^2 + 3*x", "exp(x, 1e-5)".
|
||||
*
|
||||
* Values of the function so defined are returned for values of x
|
||||
* entered in reponse to the ? prompt. Operation is terminated by
|
||||
* entered in response to the ? prompt. Operation is terminated by
|
||||
* entering "end", "exit" or "quit".
|
||||
*/
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* quat - alculate using quaternions of the form: a + bi + cj + dk
|
||||
* quat - calculate using quaternions of the form: a + bi + cj + dk
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
*
|
||||
|
@@ -45,9 +45,9 @@ randmprime(bits, seed, dbg)
|
||||
local n; /* n as in h*2^n-1 */
|
||||
local h; /* h as in h*2^n-1 */
|
||||
local plush; /* value added to h since the beginning */
|
||||
local init; /* initial cpu time */
|
||||
local start; /* cpu time before last test */
|
||||
local stop; /* cpu time afte last test */
|
||||
local init; /* initial CPU time */
|
||||
local start; /* CPU time before last test */
|
||||
local stop; /* CPU time after last test */
|
||||
local tmp; /* just a tmp place holder value */
|
||||
local ret; /* h*2^n-1 that is prime */
|
||||
|
||||
|
@@ -43,7 +43,7 @@ global prob; /* libregress.cal problem counter */
|
||||
prob = 0; /* clear problem counter */
|
||||
|
||||
errcount(0),; /* clear error count */
|
||||
errmax(-1),; /* prevent errcount from abouting */
|
||||
errmax(-1),; /* prevent errcount from aborting */
|
||||
|
||||
global ecnt; /* expected value of errcount() */
|
||||
ecnt = 0; /* clear expected errcount() value */
|
||||
@@ -453,7 +453,7 @@ define test_config()
|
||||
'539: config("more", ">> ") == ";; "');
|
||||
vrfy(config("all") == oldcfg, '540: config("all") == oldcfg');
|
||||
|
||||
/* restore the configation at the start of this function */
|
||||
/* restore the configuration at the start of this function */
|
||||
vrfy(config("all",callcfg) == oldcfg,
|
||||
'541: config("all",callcfg) == oldcfg');
|
||||
|
||||
@@ -3156,7 +3156,7 @@ print '047: parsed test_poly()';
|
||||
|
||||
|
||||
/*
|
||||
* test_det - more determinent testing
|
||||
* test_det - more determinant testing
|
||||
*/
|
||||
read -once "test3300";
|
||||
print '048: read -once test3300';
|
||||
@@ -3473,7 +3473,7 @@ print '065: parsed test_param()';
|
||||
|
||||
|
||||
/*
|
||||
* test_noarg - test missing argment functionality
|
||||
* test_noarg - test missing argument functionality
|
||||
*/
|
||||
define test_noarg()
|
||||
{
|
||||
@@ -5183,7 +5183,7 @@ define test_size()
|
||||
'5715: sizeof(17^139 + 674)*2 == sizeof(q)');
|
||||
|
||||
/*
|
||||
* recipricals are the same size of their integer inverses
|
||||
* reciprocals are the same size of their integer inverses
|
||||
*/
|
||||
q = 1/13;
|
||||
print '5716: q = 1/13';
|
||||
@@ -5261,7 +5261,7 @@ define test_size()
|
||||
|
||||
/*
|
||||
* size of a matrix is the sum of the sizes of the elements
|
||||
* sizeof of a matrix is the sum of the sizeofs of the elements
|
||||
* sizeof of a matrix is the sum of the sizeof's of the elements
|
||||
*/
|
||||
mat m[] = {z,q,c};
|
||||
print '5752: mat m[] = {z,q,c}';
|
||||
@@ -5381,7 +5381,7 @@ define test_is()
|
||||
{
|
||||
local loc; /* unassigned local variable */
|
||||
local a; /* assoc */
|
||||
local ofd; /* open file desriptor */
|
||||
local ofd; /* open file descriptor */
|
||||
local cfd; /* closed file descriptor */
|
||||
local blk; /* unnamed block */
|
||||
local nblk; /* named block */
|
||||
@@ -5398,7 +5398,7 @@ define test_is()
|
||||
local object; /* object */
|
||||
local rand; /* rand seed */
|
||||
local random; /* random seed */
|
||||
local real; /* real non-intger value */
|
||||
local real; /* real non-integer value */
|
||||
local prime; /* odd prime */
|
||||
local square; /* square of an odd prime */
|
||||
local string; /* string */
|
||||
@@ -7482,7 +7482,7 @@ print '190: parsed test_somenew()';
|
||||
|
||||
|
||||
/*
|
||||
* test_exponentiation - test new exponentiation functionaltiy
|
||||
* test_exponentiation - test new exponentiation functionality
|
||||
*/
|
||||
define test_exponentiation()
|
||||
{
|
||||
@@ -7573,7 +7573,7 @@ define test_quit()
|
||||
quit;
|
||||
prob('quit did not end the test_quit() function');
|
||||
|
||||
/* 8400 serise continued after return, do not print end here */
|
||||
/* 8400 series continued after return, do not print end here */
|
||||
}
|
||||
print '191: parsed test_quit()';
|
||||
|
||||
@@ -7874,7 +7874,7 @@ print '8406: Ending test_quit';
|
||||
|
||||
|
||||
/*
|
||||
* test_divmod - psuedo-random tests on the // and % with various rounding modes
|
||||
* test_divmod - pseudo-random tests on the // and % with various rounding modes
|
||||
*/
|
||||
print;
|
||||
print '8500: Starting test of divmod'
|
||||
@@ -7900,7 +7900,7 @@ vrfy(config("redecl_warn",0), '8651: config("redecl_warn",0)');
|
||||
vrfy(config("dupvar_warn",0), '8652: config("dupvar_warn",0)');
|
||||
vrfy(u_glob == 6, '8653: u_glob == 6');
|
||||
global u_glob = 555;
|
||||
print '8654: reclare u_glob';
|
||||
print '8654: declare u_glob';
|
||||
vrfy(u_glob == 555, '8655: u_glob == 555');
|
||||
define func_8650(u_glob) { local u_glob; return u_glob; }
|
||||
print '8656: u_glob as both local and parameter';
|
||||
@@ -7928,7 +7928,7 @@ vrfy(dotest("set8700.line", 8703) == 0,
|
||||
|
||||
|
||||
/*
|
||||
* new exponentiation functionaltiy
|
||||
* new exponentiation functionality
|
||||
*/
|
||||
print;
|
||||
return test_exponentiation();
|
||||
@@ -8074,7 +8074,7 @@ return test_functions2();
|
||||
*
|
||||
* beer.cal - prints a bunch of things when loaded
|
||||
* hello.cal - designed to go into an infinite loop
|
||||
* lucal.cal - already read by this file
|
||||
* lucas.cal - already read by this file
|
||||
* lucas_chk.cal - already read by this file
|
||||
* regress.cal - this file
|
||||
* surd.cal - already read by this file
|
||||
|
@@ -442,8 +442,8 @@ define lngamma(z)
|
||||
if (tmp2 < tmp) {
|
||||
return
|
||||
newerror(strcat
|
||||
("lngamma(1): something happend that ",
|
||||
"should not have happend"));
|
||||
("lngamma(1): something happened ",
|
||||
"that shouldn't have happened"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -519,8 +519,8 @@ define lngamma(z)
|
||||
if (tmp2 < tmp) {
|
||||
return
|
||||
newerror(strcat
|
||||
("lngamma(1): something happend ",
|
||||
"that should not have happend"));
|
||||
("lngamma(1): something happened ",
|
||||
"that should not have happened"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -576,8 +576,8 @@ define lngamma(z)
|
||||
if (tmp2 < tmp) {
|
||||
return
|
||||
newerror(strcat
|
||||
("lngamma(1): something happend ",
|
||||
"that should not have happend"));
|
||||
("lngamma(1): something happened ",
|
||||
"that should not have happened"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1047,7 +1047,7 @@ define __CZ__ibeta_cf_var_dm(a, b, z, max)
|
||||
}
|
||||
}
|
||||
if (m > max) {
|
||||
return newerror("ibeta: continous fraction does not converge");
|
||||
return newerror("ibeta: continuous fraction does not converge");
|
||||
}
|
||||
return f;
|
||||
}
|
||||
@@ -1290,7 +1290,7 @@ define __CZ__erfinvapprox(x)
|
||||
- (2 / (pi() * a) + (ln(1 - x ^ 2)) / 2));
|
||||
}
|
||||
|
||||
/* complementary inverse errror function, faster at about x < 1-.91
|
||||
/* complementary inverse error function, faster at about x < 1-.91
|
||||
Henry E. Fettis. "A stable algorithm for computing the inverse error function
|
||||
in the 'tail-end' region" Math. Comp., 28:585-587, 1974.
|
||||
*/
|
||||
@@ -1324,7 +1324,7 @@ define __CZ__fettiscf(y, n)
|
||||
return t / (1 + r);
|
||||
}
|
||||
|
||||
/* inverse errror function, faster at about x<=.91*/
|
||||
/* inverse error function, faster at about x<=.91*/
|
||||
define __CZ__inverfbin(x)
|
||||
{
|
||||
local places approx flow fhigh eps high low mid fmid epsilon;
|
||||
@@ -1370,7 +1370,7 @@ define erfinv(x)
|
||||
x = -x;
|
||||
flag = 1;
|
||||
}
|
||||
/* No need for full pecision */
|
||||
/* No need for full precision */
|
||||
eps = epsilon(1e-20);
|
||||
if (eps >= 1e-40) {
|
||||
/* Winitzki, Sergei (6 February 2008). "A handy approximation for the
|
||||
|
@@ -106,7 +106,7 @@ define invbetainc_slow(x,a,b){
|
||||
GW Cran, KJ Martin, GE Thomas,
|
||||
Remark AS R19 and Algorithm AS 109:
|
||||
A Remark on Algorithms AS 63: The Incomplete Beta Integral
|
||||
and AS 64: Inverse of the Incomplete Beta Integeral,
|
||||
and AS 64: Inverse of the Incomplete Beta integral,
|
||||
Applied Statistics,
|
||||
Volume 26, Number 1, 1977, pages 111-114.
|
||||
|
||||
|
@@ -50,7 +50,7 @@
|
||||
* of b in power(a, b, eps) is large, the computation required for
|
||||
* a test may be very heavy.
|
||||
*
|
||||
* Test funcations are called as:
|
||||
* Test functions are called as:
|
||||
*
|
||||
* testabc(str, ..., verbose)
|
||||
*
|
||||
|
@@ -84,7 +84,7 @@ define mkfrac() = rand(2) ? mkposfrac() : -mkposfrac();
|
||||
define mksquarereal() = mknonnegreal()^2;
|
||||
|
||||
/*
|
||||
* We might be able to do better than the following. For nonsquare
|
||||
* We might be able to do better than the following. For non-square
|
||||
* positive integer less than 1e6, could use:
|
||||
* x = rand(1, 1000);
|
||||
* return rand(x^2 + 1, (x + 1)^2);
|
||||
|
@@ -35,7 +35,7 @@ defaultverbose = 1; /* default verbose value */
|
||||
* with zero value, when the definition is read.
|
||||
*
|
||||
* The variable a5100 is initialized with the value x if and when this
|
||||
* function is first called with a positive even x. The varable b5100
|
||||
* function is first called with a positive even x. The variable b5100
|
||||
* is similarly initialized if and when this function is first called positive
|
||||
* odd x.
|
||||
*
|
||||
|
@@ -169,7 +169,7 @@ define divmod_8500(N = 10, M1 = 2^128, M2 = 2^64, testnum = 0)
|
||||
}
|
||||
|
||||
/*
|
||||
* seelect one of the 32 rounding modes at random
|
||||
* select one of the 32 rounding modes at random
|
||||
*/
|
||||
rnd = rand(32);
|
||||
|
||||
|
@@ -26,7 +26,7 @@ static __CZ__eps = 1e-20;
|
||||
|
||||
|
||||
/*
|
||||
* load once, the calc resource functions contribued by Christoph Zurnieden
|
||||
* load once, the calc resource functions contributed by Christoph Zurnieden
|
||||
*/
|
||||
read -once bernpoly.cal;
|
||||
read -once brentsolve.cal;
|
||||
@@ -45,7 +45,7 @@ read -once intnum.cal;
|
||||
/*
|
||||
* tests of correctness of the functions implemented by the above listed
|
||||
* author. All values tested against have been computed with at least two
|
||||
* independant algorithms where possible (indicated if not).
|
||||
* independent algorithms where possible (indicated if not).
|
||||
*/
|
||||
define t01()
|
||||
{
|
||||
@@ -1649,7 +1649,7 @@ define t03()
|
||||
/* test 04 tests polygamma(m,z) for the following values (m==0 gets computed
|
||||
* by psi()).
|
||||
* Values tested against were computed with Mathematica(TM) only
|
||||
* (z in the left complex halfplane does not get computed yet)
|
||||
* (z in the left complex half plane does not get computed yet)
|
||||
*/
|
||||
define t04()
|
||||
{
|
||||
|
@@ -320,16 +320,16 @@ define toomcook4square(a){
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Implement the asymmetric variations
|
||||
*/
|
||||
* TODO: Implement the asymmetric variations
|
||||
*/
|
||||
|
||||
/*
|
||||
produce_long_random_number(n) returns large pseudorandom numbers. Really large
|
||||
numbers, e.g.:
|
||||
produce_long_random_number(16)
|
||||
is ca 4,128,561 bits (ca 1,242,821 dec. digits) large. Exact length is not
|
||||
predeterminable because of the chaotic output of the function random().
|
||||
*/
|
||||
* produce_long_random_number(n) returns large pseudo-random numbers.
|
||||
* Really large numbers, e.g.:
|
||||
* produce_long_random_number(16)
|
||||
* is ca 4,128,561 bits (ca 1,242,821 dec. digits) large. Exact length is not
|
||||
* pre-determinable because of the chaotic output of the function random().
|
||||
*/
|
||||
define __CZ__produce_long_random_number(n)
|
||||
{
|
||||
local ret k;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* unixfrac - represent a fraction as a sum of distince unit fractions
|
||||
* unixfrac - represent a fraction as a sum of distance unit fractions
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
*
|
||||
|
@@ -34,7 +34,7 @@ define hurwitzzeta(s,a){
|
||||
/*
|
||||
According to Linas Vepstas' "An efficient algorithm for accelerating
|
||||
the convergence of oscillatory series, useful for computing the
|
||||
polylogarithm and Hurwitz zeta functions" the Euler-Maclaurin series
|
||||
poly-logarithm and Hurwitz zeta functions" the Euler-Maclaurin series
|
||||
is the fastest in most cases.
|
||||
|
||||
With a lot of help of the PARI/GP implementation by Prof. Henri Cohen,
|
||||
@@ -78,7 +78,7 @@ define hurwitzzeta(s,a){
|
||||
print "limit = " limit;
|
||||
print "prec = " precision;
|
||||
}
|
||||
/* Full precison plus 5 digits angstzuschlag*/
|
||||
/* Full precision plus 5 digits angstzuschlag*/
|
||||
epsilon( (10^(-precision)) * 1e-5);
|
||||
tmp3=(a+limit_function+0.)^(-s);
|
||||
sum3 = tmp3/2;
|
||||
|
Reference in New Issue
Block a user