@c end concepts Number Theory
@menu
* Definitions for Number Theory::
@end menu
@node Definitions for Number Theory, , Number Theory, Number Theory
@section Definitions for Number Theory
@c @node BERN
@c @unnumberedsec phony
@defun BERN (x)
gives the Xth Bernoulli number for integer X.
ZEROBERN[TRUE] if set to FALSE excludes the zero BERNOULLI numbers.
(See also BURN).
@end defun
@c @node BERNPOLY
@c @unnumberedsec phony
@defun BERNPOLY (v, n)
generates the nth Bernoulli polynomial in the
variable v.
@end defun
@c @node BFZETA
@c @unnumberedsec phony
@defun BFZETA (exp,n)
BFLOAT version of the Riemann Zeta function. The 2nd
argument is how many digits to retain and return, it's a good idea to
request a couple of extra. This function is available by doing
LOAD(BFFAC); .
@end defun
@c @node BGZETA
@c @unnumberedsec phony
@defun BGZETA (S, FPPREC)
BGZETA is like BZETA, but avoids arithmetic
overflow errors on large arguments, is faster on medium size arguments
(say S=55, FPPREC=69), and is slightly slower on small arguments. It
may eventually replace BZETA. BGZETA is available by doing
LOAD(BFAC);.
@end defun
@c @node BHZETA
@c @unnumberedsec phony
@defun BHZETA (S,H,FPPREC)
gives FPPREC digits of
@example
SUM((K+H)^-S,K,0,INF)
@end example
This is available by doing LOAD(BFFAC);.
@end defun
@c @node BINOMIAL
@c @unnumberedsec phony
@defun BINOMIAL (X, Y)
the binomial coefficient X*(X-1)*...*(X-Y+1)/Y!. If X
and Y are integers, then the numerical value of the binomial
coefficient is computed. If Y, or the value X-Y, is an integer, the
binomial coefficient is expressed as a polynomial.
@end defun
@c @node BURN
@c @unnumberedsec phony
@defun BURN (N)
is like BERN(N), but without computing all of the uncomputed
Bernoullis of smaller index. So BURN works efficiently for large,
isolated N. (BERN(402) takes about 645 secs vs 13.5 secs for
BURN(402). BERN's time growth seems to be exponential, while BURN's
is about cubic. But if next you do BERN(404), it only takes 12 secs,
since BERN remembers all in an array, whereas BURN(404) will take
maybe 14 secs or maybe 25, depending on whether MACSYMA needs to
BFLOAT a better value of %PI.) BURN is available by doing LOAD(BFFAC);.
BURN uses an observation of WGD that (rational) Bernoulli numbers can be
approximated by (transcendental) zetas with tolerable efficiency.
@end defun
@c @node BZETA
@c @unnumberedsec phony
@defun BZETA
- This function is obsolete, see BFZETA.
@end defun
@c @node CF
@c @unnumberedsec phony
@defun CF (exp)
converts exp into a continued fraction. exp is an expression
composed of arithmetic operators and lists which represent continued
fractions. A continued fraction a+1/(b+1/(c+...)) is represented by
the list [a,b,c,...]. a,b,c,.. must be integers. Exp may also involve
SQRT(n) where n is an integer. In this case CF will give as many
terms of the continued fraction as the value of the variable
CFLENGTH[1] times the period. Thus the default is to give one period.
(CF binds LISTARITH to FALSE so that it may carry out its function.)
@end defun
@c @node CFDISREP
@c @unnumberedsec phony
@defun CFDISREP (list)
converts the continued fraction represented by list
into general representation.
@example
(C1) CF([1,2,-3]+[1,-2,1]);
(D1) [1, 1, 1, 2]
(C2) CFDISREP(%);
1
(D2) 1 + ---------
1
1 + -----
1
1 + -
2
@end example
@end defun
@c @node CFEXPAND
@c @unnumberedsec phony
@defun CFEXPAND (x)
gives a matrix of the numerators and denominators of the
next-to-last and last convergents of the continued fraction x.
@example
(C1) CF(SQRT(3));
(D1) [1, 1, 2, 1, 2, 1, 2, 1]
(C2) CFEXPAND(%);
[71 97]
(D2) [ ]
[41 56]
(C3) D2[1,2]/D2[2,2],NUMER;
(D3) 1.7321429
@end example
@end defun
@c @node CFLENGTH
@c @unnumberedsec phony
@defvar CFLENGTH
default: [1] controls the number of terms of the continued
fraction the function CF will give, as the value CFLENGTH[1] times the
period. Thus the default is to give one period.
@end defvar
@c @node CGAMMA
@c @unnumberedsec phony
@defun CGAMMA
- The Gamma function in the complex plane. Do LOAD(CGAMMA) to
use these functions. Functions Cgamma, Cgamma2, and LogCgamma2.
These functions evaluate the Gamma function over the complex plane
using the algorithm of Kuki, CACM algorithm 421. Calculations are
performed in single precision and the relative error is typically
around 1.0E-7; evaluation at one point costs less than 1 msec. The
algorithm provides for an error estimate, but the Macsyma
implementation currently does not use it.
Cgamma is the general function and may be called with a symbolic or
numeric argument. With symbolic arguments, it returns as is; with
real floating or rational arguments, it uses the Macsyma Gamma
function; and for complex numeric arguments, it uses the Kuki
algorithm.
Cgamma2 of two arguments, real and imaginary, is for numeric arguments
only; LogCgamma2 is the same, but the log-gamma function is
calculated. These two functions are somewhat more efficient.
@end defun
@c @node CGAMMA2
@c @unnumberedsec phony
@defun CGAMMA2
- See CGAMMA.
@end defun
@c @node DIVSUM
@c @unnumberedsec phony
@defun DIVSUM (n,k)
adds up all the factors of n raised to the kth power. If
only one argument is given then k is assumed to be 1.
@end defun
@c @node EULER
@c @unnumberedsec phony
@defun EULER (X)
gives the Xth Euler number for integer X. For the
Euler-Mascheroni constant, see %GAMMA.
@end defun
@c @node FACTORIAL
@c @unnumberedsec phony
@defun FACTORIAL (X)
The factorial function. FACTORIAL(X) = X! .
See also MINFACTORIAL and FACTCOMB. The factorial operator is !,
and the double factorial operator is !!.
@end defun
@c @node FIB
@c @unnumberedsec phony
@defun FIB (X)
the Xth Fibonacci number with FIB(0)=0, FIB(1)=1, and
FIB(-N)=(-1)^(N+1) *FIB(N). PREVFIB is FIB(X-1), the Fibonacci number
preceding the last one computed.
@end defun
@c @node FIBTOPHI
@c @unnumberedsec phony
@defun FIBTOPHI (exp)
converts FIB(n) to its closed form definition.
This involves the constant %PHI (= (SQRT(5)+1)/2 = 1.618033989).
If you want the Rational Function Package to know
About %PHI do TELLRAT(%PHI^2-%PHI-1)$ ALGEBRAIC:TRUE$ .
@end defun
@c @node INRT
@c @unnumberedsec phony
@defun INRT (X,n)
takes two integer arguments, X and n, and returns the
integer nth root of the absolute value of X.
@end defun
@c @node JACOBI
@c @unnumberedsec phony
@defun JACOBI (p,q)
is the Jacobi symbol of p and q.
@end defun
@c @node LCM
@c @unnumberedsec phony
@defun LCM (exp1,exp2,...)
returns the Least Common Multiple of its arguments.
Do LOAD(FUNCTS); to access this function.
@end defun
@c @node MAXPRIME
@c @unnumberedsec phony
@defvar MAXPRIME
default: [489318] - the largest number which may be given to
the PRIME(n) command, which returns the nth prime.
@end defvar
@c @node MINFACTORIAL
@c @unnumberedsec phony
@defun MINFACTORIAL (exp)
examines exp for occurrences of two factorials
which differ by an integer. It then turns one into a polynomial times
the other. If exp involves binomial coefficients then they will be
converted into ratios of factorials.
@example
(C1) N!/(N+1)!;
N!
(D1) --------
(N + 1)!
(C2) MINFACTORIAL(%);
1
(D2) -----
N + 1
@end example
@end defun
@c @node PARTFRAC
@c @unnumberedsec phony
@defun PARTFRAC (exp, var)
expands the expression exp in partial fractions
with respect to the main variable, var. PARTFRAC does a complete
partial fraction decomposition. The algorithm employed is based on
the fact that the denominators of the partial fraction expansion (the
factors of the original denominator) are relatively prime. The
numerators can be written as linear combinations of denominators, and
the expansion falls out. See EXAMPLE(PARTFRAC); for examples.
@end defun
@c @node PRIME
@c @unnumberedsec phony
@defun PRIME (n)
gives the nth prime. MAXPRIME[489318] is the largest number
accepted as argument. Note: The PRIME command does not work in
maxima, since it required a large file of primes, which most users
do not want. PRIMEP does work however.
@end defun
@c @node PRIMEP
@c @unnumberedsec phony
@defun PRIMEP (n)
returns TRUE if n is a prime, FALSE if not.
@end defun
@c @node QUNIT
@c @unnumberedsec phony
@defun QUNIT (n)
gives the principal unit of the real quadratic number field
SQRT(n) where n is an integer, i.e. the element whose norm is unity.
This amounts to solving Pell's equation A**2- n*B**2=1.
@example
(C1) QUNIT(17);
(D1) SQRT(17)+4
(C2) EXPAND(%*(SQRT(17)-4));
(D2) 1
@end example
@end defun
@c @node TOTIENT
@c @unnumberedsec phony
@defun TOTIENT (n)
is the number of integers less than or equal to n which
are relatively prime to n.
@end defun
@c @node ZEROBERN
@c @unnumberedsec phony
@defvar ZEROBERN
default: [TRUE] - if set to FALSE excludes the zero
BERNOULLI numbers. (See the BERN function.)
@end defvar
@c @node ZETA
@c @unnumberedsec phony
@defun ZETA (X)
gives the Riemann zeta function for certain integer values
of X.
@end defun
@c @node ZETA%PI
@c @unnumberedsec phony
@defvar ZETA%PI
default: [TRUE] - if FALSE, suppresses ZETA(n) giving
coeff*%PI^n for n even.
@end defvar