📄 description of calc.htm
字号:
href="http://www.numbertheory.org/calc/krm_calc.html#[65]">ordercubicr</A>( )
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#[57]">convergents</A>(a[ ],&p[ ],&q[ ])
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#[58]">lagrange</A>(f(X),&a[ ],m)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#[60]">z=perfectpower</A>(n)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#[61]">axb</A>( )
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#[62]">addcubicm</A>( )
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#[63]">powercubicm</A>( )
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#[64]">ordercubicm</A>( )
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#[66]">leastqnr</A>(p)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#sturm">sturm</A>(f(X))
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#rootexp">rootexp</A>(f(X),
m)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#content">content</A>(f(X))
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#primitive">primitive</A>(f(X))
<!--<li> <a href="#log">log</a>(a,b,d,u,v,e)<li> <a href="#log1">log1</a>(a,b,r,e)-->
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#sqroot">sqroot</A>(a,n,&s[ ],&m)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#cornacchia">cornacchia</A>(a,b,m)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#[22]">z=surd</A>(d,t,u,v,&a[],&u[],&v[],&p[],&q[])
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#patz">patz</A>(d,n)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#congq">congq</A>(a,b,c,n,&s[])
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#binform">binform</A>(a,b,c,n,e)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#ceil">ceil</A>(a,b)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#log">log</A>(a,b,d,&a[],&l)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#testlog">testlog</A>(a,b,d,m,n)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#resultant">r=resultant</A>(p(X),q(X))
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#discriminant">r=discriminant</A>(p(X))
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#deriv">q=deriv</A>(p(X))
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#primes">c=primes</A>(m,n)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#sturmsequence">c=sturmsequence</A>(f(X),b,e)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#cyclotomic">p=cyclotomic</A>(n)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#classnop">h=classnop</A>(d)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#classnon">h=classnon</A>(d)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#nearint">z=nearint</A>(a,b)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#reduceneg">h=reduceneg</A>(a,b,c)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#reducepos">h=reducepos</A>(a,b,c)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#classnop0">h=classnop0</A>(d)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#tableneg">h=tableneg</A>(m,n)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#tablepos">h=tablepos</A>(m,n)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#davison">h=davison</A>(l,m,n)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#raney">h=raney</A>(p,q,r,s)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#unimodular">h=unimodular</A>(p,q,r,s)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#twoadicsqrt">twoadicsqrt</A>(b,n,&a[])
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#padicsqrt">padicsqrt</A>(b,n,p,&a[])
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#ramanujan">ramanujan</A>(n)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#repdefinite">repdefinite</A>(a,b,c,m,print_flag)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#powerd">powerd</A>(a,b,d,n,&aa,&bb)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#euclid1">z=euclid1</A>(a,b)
<LI><A
href="http://www.numbertheory.org/calc/krm_calc.html#cfracperiod">z=cfracperiod</A>(d)
</LI></OL>
<HR>
<A
name=[56]></A><TT>euclid(a,b,&q[ ],&r[ ],&s[ ],&t[ ],&m)</TT><BR>Here
m=n+1 and the arrays <BR>q[0]=NULL,...,q[n],q[n+1]=NULL,
<BR>r[0]=a,r[1]=b,...,r[n+1], <BR>s[0]=a,s[1]=[,...,s[n+1],
<BR>t[0]=a,t[1]=[,...,t[n+1], <BR>arising from Euclid's algorithm are returned
and printed in euclid.out. <BR>r[k]=r[k+1]*q[k+1]+r[k+2], 0 < r[k+2] <
r[k+1], <BR>s[k]=-q[k-1]*s[k-1]+s[k-2], <BR>t[k]=-q[k-1]*t[k-1]+t[k-2],
<BR>r[n]=gcd(a,b)=s[n]*a+t[n]*b.
<HR>
<A name=[1]></A><TT>z=gcd(x,y)</TT> <BR>This returns the gcd of x and y.
<HR>
<A name=[2]></A><TT>z=gcdv(x,y,&u,&v)</TT> <BR>As well as returning
z=gcd(x,y), it gives numbers u and v arising from Euclid's algorithm and
satisfying the equation z = ux+vy.
<HR>
<A name=[3]></A><TT>z=gcda(a[ ])</TT> <BR>z = gcd(a[0],...,a[n-1]), where
values for a[0],...,a[n-1] having been previously entered.
<HR>
<A name=[4]></A><TT>z=gcdav(a[ ],&b[ ])</TT> <BR>z =
gcd(a[0],...,a[n-1]). Also gives integers b[0],...,b[n-1] satisfying z =
b[0]a[0]+...+b[n-1]a[n-1].
<HR>
<A name=[5]></A><TT>egcd( )</TT> <BR>This is an implementation of Algorithm
1 of a recent <A
href="http://www.expmath.org/expmath/volumes/7/7.html">paper</A> by Havas,
Majewski and Matthews. <BR>Like lllgcd( ), it finds short multipliers for
the gcd of m numbers, using LLL ideas. It also finds <I>all</I> shortest
vectors, unlike lllgcd( ), which lists only one shortest multiplier. The
file of m integers should have as its first line m, then the integers should be
listed on separate lines. <BR>An m x m matrix whose rows are X[1],...,X[m-1],P
is sent to an output file egcdmat.out. <BR>Here X[1],...,X[m-1] form a LLL
reduced basis for the lattice L defined by the equation
x<SUB>1</SUB>d<SUB>1</SUB>+ ··· +x<SUB>m</SUB>d<SUB>m</SUB> = 0. <BR>The
multipliers are sent to an output file called egcdmult.out. <BR>Sometimes the
multipliers delivered by egcd() are shorter that those of lllgcd( ). There
is also an option to find all the shortest multipliers.
<HR>
<A name=[6]></A><TT>sgcd(N)</TT> <BR>This performs the LLL algorithm on
[I<SUB>n</SUB>|NA], where A is a column vector of positive integers. This is
Algorithm 2 of <A href="http://www.numbertheory.org/lll.html">paper</A>. If N is
sufficiently large, the last column will be reduced to ±NdE<SUB>n</SUB>, where d
= gcd(a[1],...,a[n]). Output is sent to sgcdbas.out.
<HR>
<A name=[49]></A><TT>lllgcd()</TT> <BR>This performs a modification of LLL which
is essentially a limiting form of sgcd(N) for large N. It is superior to egcd()
in that it avoids inputting a large initial unimodular matrix and instead builds
one from the identity matrix at the outset. This is Algorithm 3 of a recent <A
href="http://www.numbertheory.org/lll.html">paper</A> of Havas, Majewski and
Matthews. <BR>The file of m integers should have as its first line m, then the
integers should be listed on separate lines. <BR>An m x m matrix whose rows are
X[1],...,X[m] is sent to an output file lllgcdmat.out. <BR>Here X[1],...,X[m-1]
form a LLL reduced basis for the lattice L defined by the equation
x<SUB>1</SUB>d<SUB>1</SUB>+ ··· +x<SUB>m</SUB>d<SUB>m</SUB> = 0. <BR>The
inhomogeneous version of the Fincke-Pohst algorithm (see [<A
href="http://www.numbertheory.org/calc/krm_calc.html#[Po2]">Po2</A>][191]) can
then be used as an option to find a shortest multiplier vector by solving the
inequality
<P> ||X[m] - x<SUB>1</SUB>X[1]- ··· -x<SUB>m-1</SUB>X[m-1]||<SUP>2</SUP> ≤
||X[m]||<SUP>2</SUP>
<P> in integers x<SUB>1</SUB>,...,x<SUB>m-1</SUB>. <BR>Each time a shorter
multiplier vector Q = X[m]-x<SUB>1</SUB>X[1]- ··· -x<SUB>m-1</SUB>X[m-1] is
found, X[m] is replaced by Q, until the shortest Q is found. The multipliers are
sent to an output file called lllgcdmult.out. The unimodular matrix P of a <A
href="http://www.expmath.org/expmath/volumes/7/7.html">recent paper</A> of
Havas, Majewski and Matthews, is sent to lllgcdmat.out. In verbose mode, the
intermediate steps are printed. <BR>Note: if the shortest vector option is
chosen, the last row of P has been replaced by this vector.
<HR>
<A name=[53]></A><TT>lllgcd0( )</TT> <BR>This in general gives a better
multiplier than lllgcd and is based on an algorithm in <A
href="http://www.numbertheory.org/lll.html#lllgcd0">a recent manuscript</A> of
the author. <BR>
<HR>
<!--<a name="[53]"><tt>gcd3()</tt></a><br> This specialized function is an outgrowth of research with George Havas on small multipliers for the extended gcd problem. <br>We apply lllgcd() to all triples (i,j,k) in given ranges, where gcd(i,j,k)=1. We get a unimodular matrix with rows b[1],b[2],b[3], with b[3] a small multiplier. We then apply our crude Fincke-Pohst to get the shortest multiplier and express it as b[3]+e[1]b[1]+e[2]b[2]. The output is sent to a file gcd3.out. One has to choose the signs of mu[2][1],mu[3][1] and mu[3][2]. If the LLL parameter alpha >= 3/8, then |e[1]|,|e[2]| <= 1.<hr><a name="[54]"><tt>gcd4()</tt></a>, <a name="[55]"><tt>gcd5()</tt></a><br> These are similar to <tt>gcd3()</tt>, except there is no restriction on signs of the mu[i][j].<hr>--><A
name=[50]></A><TT>jacobigcd( )</TT> <BR>This performs Jacobi's extended gcd
algorithm of 1869. In verbose mode the intermediate steps are printed out. <BR>
<HR>
<A name=[7]></A><TT>z=lcm(x,y)</TT> <BR>
<HR>
<A name=[8]></A><TT>z=lcma(x)</TT> <BR>z = lcm(x[0],...,x[n-1]). (n is the size
of the array)
<HR>
<A name=[9]></A><TT>z=length(n)</TT> <BR>z is the number of decimal digits of n.
<HR>
<A name=[10]></A><TT>z=pollard(x)</TT> <BR>This attempts to return a factor of a
composite x using Pollard's p-1 method.
<HR>
<A name=[11]></A><TT>z=nprime(x)</TT> <BR>This finds the first integer after x
which passes the strong base 2 pseudoprime test and the Lucas pseudoprime test.
(See [<A href="http://www.numbertheory.org/calc/krm_calc.html#[Pom]">Pom</A>].)
This integer is likely to be prime.
<HR>
<A name=[12]></A><TT>z=nprimeap(a,b,m)</TT> <BR>This finds the first p, p=b(mod
a), m ≤ p, which passes the strong base 2 pseudoprime test and the Lucas
pseudoprime test. Here a must be even, b odd, 1 ≤ b < a, gcd(a,b)=1, b ≤ m.
<HR>
<A name=[13]></A><TT>z=jacobi(x,y)</TT> <BR>z is the value of the Jacobi symbol
(x/y).
<HR>
<A name=[14]></A><TT>z=peralta(a,p)</TT> <BR>Peralta's algorithm is used to
return a square root z of a (mod p). Here a is a quadratic residue mod p. (See
[<A href="http://www.numbertheory.org/calc/krm_calc.html#[Per]">Per</A>].)
<HR>
<A name=[15]></A><TT>x=congr(a,b,m,&n)</TT> <BR>Returns the solution x of
the congruence ax=b(mod m). Also n=m/gcd(a,m) is returned.
<HR>
<A name=[16]></A><TT>x=chinese(a,b,m,n,&l)</TT> <BR>Returns the solution
x(mod l) of the system of congruences x=a(mod m) and x=b(mod n). Also l=lcm(m,n)
is returned.
<HR>
<A name=[17]></A><TT>x=chinesea(a[ ],m[ ],&l)</TT> <BR>Returns the
solution x(mod l) of the system of congruences x=a[i](mod m[i]), 0 ≤ i < n.
Also l=lcm(m[0],...,m[n-1]) is returned. (n is the size of the array)
<HR>
<A name=[18]></A><TT>z=mthroot(x,m)</TT> <BR>The integer part of the m-th root
of x is returned. (See [<A
href="http://www.numbertheory.org/calc/krm_calc.html#[Mat]">Mat</A>].)
<HR>
<A name=[19]></A><TT>mthrootr(x,y,m,r)</TT> <BR>The m-th root of x/y is computed
to r decimal places.
<HR>
<A name=[20]></A><TT>z=fund(d,&x,&y)</TT> <BR>x and y are returned,
where x+y <IMG alt=omega src="DESCRIPTION OF CALC.files/omega.gif"> is the
fundamental unit of Q(√d). z=Norm(x+y <IMG alt=omega
src="DESCRIPTION OF CALC.files/omega.gif">) is also returned.
<HR>
<A name=[21]></A><TT>z=pell(d,e,&x,&y)</TT> <BR>The continued fraction
expansion of √d is periodic after the first term:
<BR>a[0],a[1],...,a[n-1],2a[0],a[1],...,a[n-1],2a[0],.... Also the section
a[1],...,a[n-1] is palindromic. We print a[0] and half the palindrome, iff e is
nonzero, sending the output to a file called pell.out. <BR>The least solution x
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -