Release calc version 2.12.5.5

This commit is contained in:
Landon Curt Noll
2017-05-20 19:24:06 -07:00
parent 2726ae9d23
commit 8dd7a3cd2a
23 changed files with 1126 additions and 422 deletions

View File

@@ -2,7 +2,7 @@
#
# help - makefile for calc help files
#
# Copyright (C) 1999-2006 Landon Curt Noll
# Copyright (C) 1999-2006,2017 Landon Curt Noll
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of the version 2.1 of the GNU Lesser General Public License
@@ -18,9 +18,9 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# @(#) $Revision: 30.10 $
# @(#) $Id: Makefile,v 30.10 2014/09/02 07:15:58 chongo Exp $
# @(#) $Source: /usr/local/src/bin/calc/help/RCS/Makefile,v $
# @(#) $Revision: 30.11 $
# @(#) $Id: Makefile,v 30.11 2017/05/19 16:09:14 chongo Exp $
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/Makefile,v $
#
# Under source code control: 1991/07/23 06:47:57
# File existed as early as: 1991
@@ -204,7 +204,7 @@ EXT=
STD_HELP_FILES_1= intro overview help
STD_HELP_FILES_2= assoc
BLT_HELP_FILES_3= builtin
BLT_HELP_FILES_3= builtin man
STD_HELP_FILES_4= command config custom define environment expression
@@ -283,36 +283,35 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
# to keep this list in nice sorted order and to check that these
# non-special help files are under RCS control.
#
DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address \
agd append appr arg argv arrow asec asech asin asinh assign atan \
atan2 atanh avg base base2 bernoulli bit blk blkcpy blkfree blocks \
bround btrunc calc_tty calclevel calcpath catalan ceil cfappr cfsim \
char cmdbuf cmp comb conj cos cosh cot coth count cp csc csch ctime \
delete den dereference det digit digits display dp epsilon errcount \
errmax errno error estr euler eval exp fact factor fclose fcnt \
feof ferror fflush fgetc fgetfield fgetfile fgetline fgets fgetstr \
fib files floor fopen forall fpathopen fprintf fputc fputs fputstr \
frac free freebernoulli freeeuler freeglobals freeredc freestatics \
frem freopen fscan fscanf fseek fsize ftell gcd gcdrem gd getenv \
hash head highbit hmean hnrmod hypot ilog ilog10 ilog2 im indices \
inputlevel insert int inverse iroot isalnum isalpha isassoc isatty \
isblk iscntrl isconfig isdefined isdigit iserror iseven isfile \
isgraph ishash isident isint islist islower ismat ismult isnull \
isnum isobj isobjtype isodd isprime isprint isptr ispunct isqrt \
isrand israndom isreal isrel issimple isspace issq isstr istype \
isupper isxdigit jacobi join lcm lcmfact lfactor ln log lowbit ltol \
makelist matdim matfill matmax matmin matsum mattrace mattrans max \
memsize meq min minv mmin mne mod modify name near newerror nextcand \
nextprime norm null num oldvalue ord param perm pfact pi pix places \
pmod polar poly pop popcnt pound power prevcand prevprime printf \
prompt protect ptest push putenv quo quomod rand randbit random \
randombit randperm rcin rcmul rcout rcpow rcsq re remove reverse \
rewind rm root round rsearch runtime saveval scale scan scanf \
search sec sech seed segment select sgn sha1 sin sinh size sizeof \
sleep sort sqrt srand srandom ssq stoponerror str strcasecmp strcat \
strcmp strcpy strerror strlen strncasecmp strncmp strncpy strpos \
strprintf strscan strscanf strtolower strtoupper substr sum swap \
system systime tail tan tanh test time trunc usertime version xor
DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd \
append appr arg argv arrow asec asech asin asinh assign atan atan2 \
atanh avg base base2 bernoulli bit blk blkcpy blkfree blocks bround \
btrunc calc_tty calclevel calcpath catalan ceil cfappr cfsim char \
cmdbuf cmp comb conj cos cosh cot coth count cp csc csch ctime delete \
den dereference det digit digits display dp epsilon errcount errmax \
errno error estr euler eval exp fact factor fclose fcnt feof ferror \
fflush fgetc fgetfield fgetfile fgetline fgets fgetstr fib files floor \
fopen forall fpathopen fprintf fputc fputs fputstr frac free \
freebernoulli freeeuler freeglobals freeredc freestatics frem freopen \
fscan fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert int \
inverse iroot isalnum isalpha isassoc isatty isblk iscntrl isconfig \
isdefined isdigit iserror iseven isfile isgraph ishash isident isint \
islist islower ismat ismult isnull isnum isobj isobjtype isodd isprime \
isprint isptr ispunct isqrt isrand israndom isreal isrel issimple \
isspace issq isstr istype isupper isxdigit jacobi join lcm lcmfact \
lfactor ln log lowbit ltol makelist matdim matfill matmax matmin \
matsum mattrace mattrans max memsize meq min minv mmin mne mod modify \
name near newerror nextcand nextprime norm null num oldvalue ord param \
perm pfact pi pix places pmod polar poly pop popcnt pound power \
prevcand prevprime printf prompt protect ptest push putenv quo quomod \
rand randbit random randombit randperm rcin rcmul rcout rcpow rcsq re \
remove reverse rewind rm root round rsearch runtime saveval scale scan \
scanf search sec sech seed segment select sgn sha1 sin sinh size \
sizeof sleep sort sqrt srand srandom ssq stoponerror str strcasecmp \
strcat strcmp strcpy strerror strlen strncasecmp strncmp strncpy \
strpos strprintf strscan strscanf strtolower strtoupper substr sum \
swap system systime tail tan tanh test time trunc usertime version xor
# This list is of files that are clones of DETAIL_HELP files. They are
# built from DETAIL_HELP files.
@@ -473,6 +472,18 @@ copy: blkcpy
${TRUE}; \
fi
man: help
${RM} -f $@
${CP} help $@
${CHMOD} 0444 $@
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
echo ''; \
else \
${TRUE}; \
fi
COPYING: ../COPYING
${RM} -f $@
${CP} ../COPYING $@
@@ -698,6 +709,10 @@ clean:
clobber: clean
${RM} -f ${BLT_HELP_FILES} full .all calc
${RM} -f ${SINGULAR_FILES} ${DETAIL_CLONE}
-${Q} if [ -e .DS_Store ]; then \
echo ${RM} -rf .DS_Store; \
${RM} -rf .DS_Store; \
fi
# install everything
#

View File

@@ -115,7 +115,15 @@ as the same effect as:
custom("help", "anything");
## Copyright (C) 1999-2007 Landon Curt Noll
The man command is an alias for the help command. For example:
man sin
Any help file that the help command is able to display may be
displayed by the man command. The man command may only display
calc help files.
## Copyright (C) 1999-2007,2017 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -131,9 +139,9 @@ as the same effect as:
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: help,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/help,v $
## @(#) $Revision: 30.2 $
## @(#) $Id: help,v 30.2 2017/05/19 16:09:14 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/help,v $
##
## Under source code control: 1991/07/21 04:37:20
## File existed as early as: 1991

View File

@@ -11,39 +11,186 @@ TYPES
return 1, -1, or 0
DESCRIPTION
If y is a positive odd prime and x is an integer not divisible
by y, jacobi(x,y) returns the Legendre symbol function, usually
denoted by (x/y) as if x/y were a fraction; this has the value
1 or -1 according as x is or is not a quadratic residue modulo y.
x is a quadratic residue modulo y if for some integer u,
x = u^2 (mod y); if for all integers u, x != u^2 (mod y), x
is said to be a quadratic nonresidue modulo y.
The jacobi builtin function of calc returns the value of the
Jacobi symbol.
If y is a positive odd prime and x is divisible by y, jacobi(x,y)
returns the value 1. (This differs from the zero value usually
given in number theory books for (x/y) when x and y
are not relatively prime.)
assigned to (x/y) O
If y is an odd prime, then the Legendre symbol (x/y) returns:
If y is an odd positive integer equal to p_1 * p_2 * ... * p_k,
where the p_i are primes, not necessarily distinct, the
jacobi symbol function is given by
(x/y) == 0 x is divisible by y (0 == x % y)
(x/y) == 1 if x is a quadratic residue modulo y
(x/y) == -1 if x is not a quadratic residue modulo y
jacobi(x,y) = (x/p_1) * (x/p_2) * ... * (x/p_k).
Legendre symbol often denoted as (x/y) as if x/y were a fraction.
where the functions on the right are Legendre symbol functions.
If there exists an integer u such that:
This is also often usually by (x/y).
x == u^2 modulo y (i.e., x == u^2 % y)
If jacobi(x,y) = -1, then x is a quadratic nonresidue modulo y.
Equivalently, if x is a quadratic residue modulo y, then
jacobi(x,y) = 1.
then x is a quadratic residue modulo y. However, if for all integers u:
If jacobi(x,y) = 1 and y is composite, x may be either a quadratic
residue or a quadratic nonresidue modulo y.
x != u^2 modulo y (i.e., x != u^2 % y)
If y is even or negative, jacobi(x,y) as defined by calc returns
the value 0.
x is said to be a quadratic non-residue modulo y.
When y is prime, Jacobi symbol is the same as the Legendre symbol.
That is, Jacobi symbol satisfies the same rules as the Legendre symbol.
Therefore, when y is an odd prime:
jacobi(x,y) == 0 x is divisible by y (x == 0 % y)
jacobi(x,y) == 1 if x is a quadratic residue modulo y
jacobi(x,y) == -1 if x is a quadratic non-residue modulo y
When y is even or y <= 0:
jacobi(x,y) == 0
When y is not prime, we may express y as the product of primes:
y == p0^a0 * p1^a1 * .. * pn^an
When y is odd and NOT prime, then:
jacobi(x,y) == (x/p0)^a0 * (x/p1)^a1 * .. * (x/pn)^an
where (x/y) is Legendre symbol.
If x is a quadratic residue modulo y, then jacobi(x,y) == 1.
If jacobi(x,y) == 1 and y is composite (y is not prime), x may
be either a quadratic residue or a quadratic non-residue modulo y.
If y is even or negative, jacobi(x,y) as defined by calc, returns 0.
Jacobi symbol details
---------------------
In the rest of this section we present for the curious, some
rules related to the jacobi symbol. Most of these rules are
used internally by calc to evaluate the jacobi symbol.
In this section, a and b are positive odd integers.
In this section, x and y are any integers.
We have these identities:
jacobi(x,y) == 0 if x <= 0
jacobi(x,y) == 0 if y <= 0
jacobi(x,y) == 0 if y is even
jacobi(x,b) == 0 if gcd(x,b) > 1
jacobi(0,b) == 0
jacobi(1,b) == 1
jacobi(x,b) == jacobi(y,b) if x == y % b
jacobi(a,b) == jacobi(2*a,b) if b == 1 % 8 OR b == 7 % 8
jacobi(a,b) == -jacobi(2*a,b) if b != 1 & 8 AND b != 7 % 8
jacobi(a,b) == jacobi(b,a) if a == 3 % 4 AND b == 3 % 4
jacobi(a,b) == -jacobi(b,a) if a != 3 % 4 OR b != 3 % 4
jacobi(-1,b) == 1 if b == 1 % 4
jacobi(-1,b) == -1 if b == 3 % 4
jacobi(x,b) * jacobi(y,b) == jacobi(x*y,b)
jacobi(x,a) * jacobi(x,b) == jacobi(x,a*b)
Technically the Jacobi symbol jacobi(x,y) is not defined when
x == 0, x < 0, y is even, y == 0, and when y < 0. So by convention:
jacobi(x,y) == 0 if x <= 0
jacobi(x,y) == 0 if y <= 0
jacobi(x,y) == 0 if y == 0 % 2
It is also worth noting that:
jacobi(x,y) == 0 if gcd(y,x) != 1
jacobi(y,y) == 0 if y > 1
Based on the generalization of the quadratic reciprocity theorem,
when a and b are odd, b >= 3, and gcd(a,b) == 1:
jacobi(a,b) == jacobi(b,a) * ((-1) ^ ((a-1) * (b-1) / 4))
Therefore, when a and b are odd, b >= 3, and gcd(a,b) == 1:
jacobi(a,b) == jacobi(b,a) if a == 1 % 4 OR b == 1 % 4
jacobi(a,b) == -jacobi(b,a) if a == 3 % 4 AND b == 3 % 4
Jacobi symbol satisfies the same rules as the Legendre symbol such as:
jacobi(x,y0*y1) == jacobi(x,y0) * jacobi(x,y1)
jacobi(x0*x1,y) == jacobi(x0,y) * jacobi(x1,y)
When b is odd:
jacobi(x^2,b) == 1 if gcd(x,b) == 1
jacobi(x,b^2) == 1 if gcd(x,b) == 1
jacobi(x0,b) == jacobi(x1,b) if x0 == x1 % b
jacobi(-1,b) == (-1) ^ ((b-1) / 2) == 1 if b == 1 % 4
jacobi(-1,b) == (-1) ^ ((b-1) / 2) == -1 if b == 3 % 4
jacobi(2,b) == (-1) ^ ((b^2 - 1) / 8) == 1 if b == 1 % 8 OR
b == 7 % 8
jacobi(2,b) == (-1) ^ ((b^2 - 1) / 8) == -1 if b == 3 % 8 OR
b == 5 % 8
jacobi(-3,b) == 1 if b == 1 % 6
jacobi(-3,b) == -1 if b == 5 % 6
jacobi(5,b) == 1 if b == 1 % 10 OR
b == 9 % 10
jacobi(5,b) == -1 if b == 3 % 10 OR
b == 7 % 10
If a and b are both odd primes, OR
if gcd(a,b) = 1 and, a > 0, and a is odd:
jacobi(a,b) == jacobi(b,a) * ((-1) ^ (((a-1)/2) * ((b-1)/2)))
jacobi(a,b) * jacobi(b,a) == ((-1) ^ (((a-1)/2) * ((b-1)/2)))
If b is an odd prime:
jacobi(a,b) == (a ^ ((b-1)/2)) % b
Combining all of the above, computing jacobi(x,b) may be expressed
in the following algorithm when b is odd and 0 < x < b:
j = 1;
while (x != 0) {
while (iseven(x)) {
x = x / 2;
t = b % 8;
if (t == 3 || t == 5) {
j = -j;
}
}
swap(x,b);
if (((x % 4) == 3) && ((b % 4) == 3)) {
j = -j;
}
x = x % b;
}
if (b == 1) {
return j;
} else {
return 0;
}
The above calc pseudo code is provided to help illustrate the
properties of the jacobi symbol only. The use of calc's jacobi
builtin is recommended for both speed as well as to handle
specical cases.
For more information on the Legendre symbol and the Jacobi symbol:
http://mathworld.wolfram.com/LegendreSymbol.html
http://mathworld.wolfram.com/JacobiSymbol.html
http://primes.utm.edu/glossary/xpage/JacobiSymbol.html
EXAMPLE
; print jacobi(2,3), jacobi(2,5), jacobi(2,15)
@@ -61,7 +208,7 @@ LINK LIBRARY
SEE ALSO
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999,2017 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -77,9 +224,9 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: jacobi,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/jacobi,v $
## @(#) $Revision: 30.2 $
## @(#) $Id: jacobi,v 30.2 2017/05/19 16:09:14 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/jacobi,v $
##
## Under source code control: 1995/12/18 12:34:57
## File existed as early as: 1995

View File

@@ -83,6 +83,12 @@
help full
The man command is an alias for the help command. Try:
man jacobi
Only calc help files may be displayed by the help and man commands.
By default, arguments to functions are passed by value (even
matrices). For speed, you can put an ampersand before any
variable argument in a function call, and that variable will be
@@ -169,7 +175,7 @@
to be calculated. Global variables which are numbers can be
saved to a file by using the 'write filename' command.
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999-2017 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -185,9 +191,9 @@
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: overview,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/overview,v $
## @(#) $Revision: 30.2 $
## @(#) $Id: overview,v 30.2 2017/05/19 16:09:14 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/overview,v $
##
## Under source code control: 1991/07/21 04:37:23
## File existed as early as: 1991

View File

@@ -319,8 +319,13 @@ Statements
help help
The man command is an alias for the help command. For example:
## Copyright (C) 1999-2007 Landon Curt Noll
man jacobi
Only calc help files may be displayed by the help and man commands.
## Copyright (C) 1999-2007,2017 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -336,9 +341,9 @@ Statements
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: statement,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/statement,v $
## @(#) $Revision: 30.2 $
## @(#) $Id: statement,v 30.2 2017/05/19 16:09:14 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/statement,v $
##
## Under source code control: 1991/07/21 04:37:23
## File existed as early as: 1991