Maxima Manual. Node: Definitions for Number Theory
28.1: Definitions for Number Theory
- Function: BERN
gives the Xth Bernoulli number for integer X.
ZEROBERN[TRUE] if set to FALSE excludes the zero BERNOULLI numbers.
(See also BURN).
- Function: BERNPOLY
generates the nth Bernoulli polynomial in the
- Function: BFZETA
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
- Function: BGZETA
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
- Function: BHZETA
gives FPPREC digits of
This is available by doing LOAD(BFFAC);.
- Function: BINOMIAL
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.
- Function: BURN
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.
- Function: BZETA
- This function is obsolete, see BFZETA.
- Function: CF
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 times the period. Thus the default is to give one period.
(CF binds LISTARITH to FALSE so that it may carry out its function.)
- Function: CFDISREP
converts the continued fraction represented by list
into general representation.
(D1) [1, 1, 1, 2]
(D2) 1 + ---------
1 + -----
1 + -
- Function: CFEXPAND
gives a matrix of the numerators and denominators of the
next-to-last and last convergents of the continued fraction x.
(D1) [1, 1, 2, 1, 2, 1, 2, 1]
(D2) [ ]
- Variable: CFLENGTH
default:  controls the number of terms of the continued
fraction the function CF will give, as the value CFLENGTH times the
period. Thus the default is to give one period.
- Function: 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
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.
- Function: CGAMMA2
- See CGAMMA.
- Function: DIVSUM
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.
- Function: EULER
gives the Xth Euler number for integer X. For the
Euler-Mascheroni constant, see %GAMMA.
- Function: FACTORIAL
The factorial function. FACTORIAL(X) = X! .
See also MINFACTORIAL and FACTCOMB. The factorial operator is !,
and the double factorial operator is !!.
- Function: FIB
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.
- Function: FIBTOPHI
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$ .
- Function: INRT
takes two integer arguments, X and n, and returns the
integer nth root of the absolute value of X.
- Function: JACOBI
is the Jacobi symbol of p and q.
- Function: LCM
returns the Least Common Multiple of its arguments.
Do LOAD(FUNCTS); to access this function.
- Variable: MAXPRIME
default:  - the largest number which may be given to
the PRIME(n) command, which returns the nth prime.
- Function: MINFACTORIAL
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.
(N + 1)!
N + 1
- Function: PARTFRAC
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.
- Function: PRIME
gives the nth prime. MAXPRIME 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.
- Function: PRIMEP
returns TRUE if n is a prime, FALSE if not.
- Function: QUNIT
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.
- Function: TOTIENT
is the number of integers less than or equal to n which
are relatively prime to n.
- Variable: ZEROBERN
default: [TRUE] - if set to FALSE excludes the zero
BERNOULLI numbers. (See the BERN function.)
- Function: ZETA
gives the Riemann zeta function for certain integer values
- Variable: ZETA%PI
default: [TRUE] - if FALSE, suppresses ZETA(n) giving
coeff*%PI^n for n even.