[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
idiv
, irem
:: Integer quotient of i1 divided by i2.
:: Integer remainder of i1 divided by i2.
integer
integer
%
i2
for replacement of irem()
which only differs in the point that
the result is always normalized to non-negative values.
sdiv()
, srem()
for polynomial quotient.
[0] idiv(100,7); 14 [0] idiv(-100,7); -14 [1] irem(100,7); 2 [1] irem(-100,7); -2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
fac
:: The factorial of i.
integer
integer
[0] fac(50); 30414093201713378043612608166064768844377641568960512000000000000
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
igcd
,igcdcntl
:: The integer greatest common divisor of i1 and i2.
:: Selects an algorithm for integer GCD.
integer
integer
igcd()
returns the integer greatest common divisor of
the given two integers.
gcd()
, gcdz()
for polynomial GCD.
igcdcntl
.
0
Euclid algorithm (default)
1
binary GCD
2
bmod GCD
3
accelerated integer GCD
2
, 3
are due to [Weber]
.
In most cases 3
is the fastest, but there are exceptions.
[0] A=lrandom(10^4)$ [1] B=lrandom(10^4)$ [2] C=lrandom(10^4)$ [3] D=A*C$ [4] E=A*B$ [5] cputime(1)$ [6] igcd(D,E)$ 0.6sec + gc : 1.93sec(2.531sec) [7] igcdcntl(1)$ [8] igcd(D,E)$ 0.27sec(0.2635sec) [9] igcdcntl(2)$ [10] igcd(D,E)$ 0.19sec(0.1928sec) [11] igcdcntl(3)$ [12] igcd(D,E)$ 0.08sec(0.08023sec)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ilcm
:: The integer least common multiple of i1 and i2.
integer
integer
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
isqrt
:: The integer square root of n.
non-negative integer
non-negative integer
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
inv
:: the inverse (reciprocal) of i modulo m.
integer
integer
inv()
does not check it.
[71] igcd(1234,4321); 1 [72] inv(1234,4321); 3239 [73] irem(3239*1234,4321); 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
prime
, lprime
:: Returns a prime number.
integer
integer
prime()
and lprime()
, returns
an element stored in the system table of prime numbers.
Here, index
is a non-negative integer and be used as an index
for the prime tables.
The function prime()
can return one of 1900 primes
up to 16381 indexed so that the smaller one has smaller
index. The function lprime()
can return one of 999 primes which
are 8 digit sized and indexed so that the larger one has the smaller
index.
The two function always returns 0 for other indices.
PARI
function
pari(nextprime,number)
.
[95] prime(0); 2 [96] prime(1228); 9973 [97] lprime(0); 99999989 [98] lprime(999); 0
pari
.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
random
non-negative integer
mt_save
.
By loading the state file with mt_load
,
one can trace a single random number sequence arcoss multiple sessions.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
lrandom
:: Generates a long random number.
integer
random
.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mt_save
, mt_load
:: Saves the state of the random number generator.
:: Loads a saved state of the random number generator.
0 or 1
string
mt_save
.
By loading the state file with mt_load
,
one can trace a single random number sequence arcoss multiple
Asir sessions.
[340] random(); 3510405877 [341] mt_save("/tmp/mt_state"); 1 [342] random(); 4290933890 [343] quit; % asir This is Asir, Version 991108. Copyright (C) FUJITSU LABORATORIES LIMITED. 3 March 1994. All rights reserved. [340] mt_load("/tmp/mt_state"); 1 [341] random(); 4290933890
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
nm
, dn
:: Numerator of rat.
:: Denominator of rat.
integer or polynomial
rational number or rational expression
nm()
and dn()
return the numerator and the
denominator as it is, respectively.
[2] [nm(-43/8),dn(-43/8)]; [-43,8] [3] dn((x*z)/(x*y)); y*x [3] dn(red((x*z)/(x*y))); y
red
.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
conj
, real
, imag
:: Real part of comp.
:: Imaginary part of comp.
:: Complex conjugate of comp.
complex number
[111] A=(2+@i)^3; (2+11*@i) [112] [real(A),imag(A),conj(A)]; [2,11,(2-11*@i)]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
eval
, deval
:: Evaluate obj numerically.
number or expression
general expression
integer
deval
returns
double float. Rational numbers remain unchanged in results from eval
.
eval
the computation is done
by MPFR library. In deval
the computation is
done by the C math library.
deval
cannot handle complex numbers.
setbprec
, setprec
.)
sin
, cos
, tan
,
asin
, acos
, atan
,
sinh
, cosh
, tanh
,
asinh
, acosh
, atanh
,
exp
, log
, pow(a,b) (a^b)
@i
cannot be handled by deval
.
unit of imaginary number
the number pi, the ratio of circumference to diameter
Napier’s number (exp(1))
[118] eval(exp(@pi*@i)); -1.0000000000000000000000000000 [119] eval(2^(1/2)); 1.414213562373095048763788073031 [120] eval(sin(@pi/3)); 0.86602540378443864674620506632 [121] eval(sin(@pi/3)-3^(1/2)/2,50); -2.78791084448179148471 E-58 [122] eval(1/2); 1/2 [123] deval(sin(1)^2+cos(1)^2); 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
pari
:: Call PARI function func.
Depends on func.
Function name of PARI.
Arguments of func.
integer
[Batut et al.]
is developed at Bordeaux University, and
distributed as a free software. Though it has a certain facility to computer
algebra, its major target is the operation of numbers (bignum,
bigfloat) related to the number theory. It facilitates various
function evaluations as well as arithmetic operations at a remarkable
speed. It can also be used from other external programs as a library.
It provides a language interface named ‘gp’ to its library, which
enables a user to use PARI as a calculator which runs on UNIX.
setprec()
.
abs
,
adj
,
arg
,
bigomega
,
binary
,
ceil
,
centerlift
,
cf
,
classno
,
classno2
,
conj
,
content
,
denom
,
det
,
det2
,
detr
,
dilog
,
disc
,
discf
,
divisors
,
eigen
,
eintg1
,
erfc
,
eta
,
floor
,
frac
,
galois
,
galoisconj
,
gamh
,
gamma
,
hclassno
,
hermite
,
hess
,
imag
,
image
,
image2
,
indexrank
,
indsort
,
initalg
,
isfund
,
isprime
,
ispsp
,
isqrt
,
issqfree
,
issquare
,
jacobi
,
jell
,
ker
,
keri
,
kerint
,
kerintg1
,
kerint2
,
kerr
,
length
,
lexsort
,
lift
,
lindep
,
lll
,
lllg1
,
lllgen
,
lllgram
,
lllgramg1
,
lllgramgen
,
lllgramint
,
lllgramkerim
,
lllgramkerimgen
,
lllint
,
lllkerim
,
lllkerimgen
,
lllrat
,
lngamma
,
logagm
,
mat
,
matrixqz2
,
matrixqz3
,
matsize
,
modreverse
,
mu
,
nextprime
,
norm
,
norml2
,
numdiv
,
numer
,
omega
,
order
,
ordred
,
phi
,
pnqn
,
polred
,
polred2
,
primroot
,
psi
,
quadgen
,
quadpoly
,
real
,
recip
,
redcomp
,
redreal
,
regula
,
reorder
,
reverse
,
rhoreal
,
roots
,
rootslong
,
round
,
sigma
,
signat
,
simplify
,
smalldiscf
,
smallfact
,
smallpolred
,
smallpolred2
,
smith
,
smith2
,
sort
,
sqr
,
sqred
,
sqrt
,
supplement
,
trace
,
trans
,
trunc
,
type
,
unit
,
vec
,
wf
,
wf2
,
zeta
/* Eigen vectors of a numerical matrix */ [0] pari(eigen,newmat(2,2,[[1,1],[1,2]])); [ -1.61803398874989484819771921990 0.61803398874989484826 ] [ 1 1 ] /* Roots of a polynomial */ [1] pari(roots,t^2-2); [ -1.41421356237309504876 1.41421356237309504876 ]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
setbprec
, setprec
:: setbprec, setprec set the precision for bigfloat operations to n bits, n digits respectively.
integer
integer
ctrl()
for turning on the ‘bigfloat flag.’
[1] setprec(); 15 [2] setprec(100); 15 [3] setprec(100); 99 [4] setbprec(); 332
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
setround
:: Sets the rounding mode mode.
integer
integer
0
Round to nearest
1
Round toward 0
2
Round toward +infinity
3
Round toward -infinity
ctrl()
for turning on the ‘bigfloat flag.’
[1] setprec(); 15 [2] setprec(100); 15 [3] setprec(100); 99 [4] setbprec(); 332
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
setmod
:: Sets the ground field to GF(p).
integer
prime less than 2^27
[0] A=dp_mod(dp_ptod(2*x,[x]),3,[]); (2)*<<1>> [1] A+A; addmi : invalid modulus return to toplevel [1] setmod(3); 3 [2] A+A; (1)*<<1>>
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ntoint32
, int32ton
:: Type-conversion between a non-negative integer and an unsigned 32bit integer.
unsigned 32bit integer or non-negative integer
non-negative interger less than 2^32
unsigned 32bit integer
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] |
This document was generated on December 15, 2018 using texi2html 5.0.