diff --git a/dev/about/index.html b/dev/about/index.html index 8e2a87040..f9ea16d42 100644 --- a/dev/about/index.html +++ b/dev/about/index.html @@ -1,2 +1,2 @@ -About Nemo · Nemo.jl

About Nemo

Nemo is a library for fast basic arithmetic in various commonly used rings, for the Julia programming language. Our aim is to provide a highly performant package covering

  • Commutative Algebra
  • Number Theory
  • Group Theory

Nemo consists of wrappers of specialised C/C++ libraries:

Nemo also uses AbstractAlgebra.jl to provide generic constructions over the basic rings provided by the above packages.

Why Julia?

Julia is a sophisticated, modern programming language which is designed to be both performant and flexible. It was written by mathematicians, for mathematicians.

The benefits of Julia include

  • Familiar imperative syntax
  • JIT compilation (provides near native performance, even for highly generic code)
  • REPL console (cuts down on development time)
  • Parametric types (allows for fast generic constructions over other data types)
  • Powerful metaprogramming facilities
  • Operator overloading
  • Multiple dispatch (dispatch on every argument of a function)
  • Efficient native C interface (little or no wrapper overhead)
  • Experimental C++ interface
  • Dynamic type inference
  • Built-in bignums
  • Able to be embedded in C programs
  • High performance collection types (dictionaries, iterators, arrays, etc.)
  • Jupyter support (for web based notebooks)

The main benefits for Nemo are the parametric type system and JIT compilation. The former allows us to model many mathematical types, e.g. generic polynomial rings over an arbitrary base ring. The latter speeds up the runtime performance, even of highly generic mathematical procedures.

+About Nemo · Nemo.jl

About Nemo

Nemo is a library for fast basic arithmetic in various commonly used rings, for the Julia programming language. Our aim is to provide a highly performant package covering

  • Commutative Algebra
  • Number Theory
  • Group Theory

Nemo consists of wrappers of specialised C/C++ libraries:

Nemo also uses AbstractAlgebra.jl to provide generic constructions over the basic rings provided by the above packages.

Why Julia?

Julia is a sophisticated, modern programming language which is designed to be both performant and flexible. It was written by mathematicians, for mathematicians.

The benefits of Julia include

  • Familiar imperative syntax
  • JIT compilation (provides near native performance, even for highly generic code)
  • REPL console (cuts down on development time)
  • Parametric types (allows for fast generic constructions over other data types)
  • Powerful metaprogramming facilities
  • Operator overloading
  • Multiple dispatch (dispatch on every argument of a function)
  • Efficient native C interface (little or no wrapper overhead)
  • Experimental C++ interface
  • Dynamic type inference
  • Built-in bignums
  • Able to be embedded in C programs
  • High performance collection types (dictionaries, iterators, arrays, etc.)
  • Jupyter support (for web based notebooks)

The main benefits for Nemo are the parametric type system and JIT compilation. The former allows us to model many mathematical types, e.g. generic polynomial rings over an arbitrary base ring. The latter speeds up the runtime performance, even of highly generic mathematical procedures.

diff --git a/dev/acb/index.html b/dev/acb/index.html index a33b78bdc..c8713c31e 100644 --- a/dev/acb/index.html +++ b/dev/acb/index.html @@ -12,7 +12,7 @@ 0.50000000000000000000 julia> d = CC(12) -12.000000000000000000

Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.

If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.

If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.

Constructors

Nemo.oneiMethod
onei(r::AcbField)

Return exact one times $i$ in the given Arb complex field.

source

Examples

julia> CC = AcbField(64)
+12.000000000000000000

Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.

If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.

If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.

Constructors

Nemo.oneiMethod
onei(r::AcbField)

Return exact one times $i$ in the given Arb complex field.

source

Examples

julia> CC = AcbField(64)
 Complex Field with 64 bits of precision and error bounds
 
 julia> c = onei(CC)
@@ -42,7 +42,7 @@
 nan
 
 julia> g = CC(RR(3))
-3.0000000000000000000

In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::AcbField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::acb) to return the parent object of a complex field element.

Basic manipulation

Base.isfiniteMethod
isfinite(x::acb)

Return true if $x$ is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return false.

source
Nemo.is_exactMethod
is_exact(x::acb)

Return true if $x$ is exact, i.e. has its real and imaginary parts have zero radius, otherwise return false.

source
Base.isintegerMethod
isinteger(x::acb)

Return true if $x$ is an exact integer, otherwise return false.

source
Nemo.accuracy_bitsMethod
accuracy_bits(x::acb)

Return the relative accuracy of $x$ measured in bits, capped between typemax(Int) and -typemax(Int).

source

Examples

julia> CC = AcbField(64)
+3.0000000000000000000

In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::AcbField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::acb) to return the parent object of a complex field element.

Basic manipulation

Base.isfiniteMethod
isfinite(x::acb)

Return true if $x$ is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return false.

source
Nemo.is_exactMethod
is_exact(x::acb)

Return true if $x$ is exact, i.e. has its real and imaginary parts have zero radius, otherwise return false.

source
Base.isintegerMethod
isinteger(x::acb)

Return true if $x$ is an exact integer, otherwise return false.

source
Nemo.accuracy_bitsMethod
accuracy_bits(x::acb)

Return the relative accuracy of $x$ measured in bits, capped between typemax(Int) and -typemax(Int).

source

Examples

julia> CC = AcbField(64)
 Complex Field with 64 bits of precision and error bounds
 
 julia> a = CC("1.2 +/- 0.001")
@@ -68,7 +68,7 @@
 
 julia> f = accuracy_bits(a)
 9
-

Containment

It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::acb, y::acb)

Returns true if any part of the box $x$ overlaps any part of the box $y$, otherwise return false.

source
Base.containsMethod
contains(x::acb, y::acb)

Returns true if the box $x$ contains the box $y$, otherwise return false.

source
Base.containsMethod
contains(x::acb, y::Integer)

Returns true if the box $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::acb, y::ZZRingElem)

Returns true if the box $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::acb, y::QQFieldElem)

Returns true if the box $x$ contains the given rational value, otherwise return false.

source

The following functions are also provided for determining if a box intersects a certain part of the complex number plane.

Nemo.contains_zeroMethod
contains_zero(x::acb)

Returns true if the box $x$ contains zero, otherwise return false.

source

Examples

julia> CC = AcbField(64)
+

Containment

It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::acb, y::acb)

Returns true if any part of the box $x$ overlaps any part of the box $y$, otherwise return false.

source
Base.containsMethod
contains(x::acb, y::acb)

Returns true if the box $x$ contains the box $y$, otherwise return false.

source
Base.containsMethod
contains(x::acb, y::Integer)

Returns true if the box $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::acb, y::ZZRingElem)

Returns true if the box $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::acb, y::QQFieldElem)

Returns true if the box $x$ contains the given rational value, otherwise return false.

source

The following functions are also provided for determining if a box intersects a certain part of the complex number plane.

Nemo.contains_zeroMethod
contains_zero(x::acb)

Returns true if the box $x$ contains zero, otherwise return false.

source

Examples

julia> CC = AcbField(64)
 Complex Field with 64 bits of precision and error bounds
 
 julia> x = CC("1 +/- 0.001")
@@ -90,7 +90,7 @@
 false
 
 julia> contains_zero(x)
-false

Comparison

Nemo provides a full range of comparison operations for Arb complex boxes.

In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.

Base.isequalMethod
isequal(x::acb, y::acb)

Return true if the boxes $x$ and $y$ are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii.

source

A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.

Function
==(x::acb, y::Integer)
==(x::Integer, y::acb)
==(x::acb, y::ZZRingElem)
==(x::ZZRingElem, y::acb)
==(x::arb, y::ZZRingElem)
==(x::ZZRingElem, y::arb)
==(x::acb, y::Float64)
==(x::Float64, y::acb)

Examples

julia> CC = AcbField(64)
+false

Comparison

Nemo provides a full range of comparison operations for Arb complex boxes.

In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.

Base.isequalMethod
isequal(x::acb, y::acb)

Return true if the boxes $x$ and $y$ are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii.

source

A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.

Function
==(x::acb, y::Integer)
==(x::Integer, y::acb)
==(x::acb, y::ZZRingElem)
==(x::ZZRingElem, y::acb)
==(x::arb, y::ZZRingElem)
==(x::ZZRingElem, y::arb)
==(x::acb, y::Float64)
==(x::Float64, y::acb)

Examples

julia> CC = AcbField(64)
 Complex Field with 64 bits of precision and error bounds
 
 julia> x = CC("1 +/- 0.001")
@@ -129,7 +129,7 @@
 [-2.52e+7 +/- 4.26e+4]
 
 julia> b = ldexp(x, -ZZ(15))
-[-9.16e-5 +/- 7.78e-8]

Miscellaneous operations

Nemo.trimMethod
trim(x::acb)

Return an acb box containing $x$ but which may be more economical, by rounding off insignificant bits from midpoints.

source
Nemo.unique_integerMethod
unique_integer(x::acb)

Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.

source

Examples

julia> CC = AcbField(64)
+[-9.16e-5 +/- 7.78e-8]

Miscellaneous operations

Nemo.trimMethod
trim(x::acb)

Return an acb box containing $x$ but which may be more economical, by rounding off insignificant bits from midpoints.

source
Nemo.unique_integerMethod
unique_integer(x::acb)

Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.

source

Examples

julia> CC = AcbField(64)
 Complex Field with 64 bits of precision and error bounds
 
 julia> x = CC("-3 +/- 0.001", "0.1")
@@ -145,11 +145,11 @@
 [-3.00 +/- 1.01e-3] + [-0.100000000000000000 +/- 1.22e-20]*im
 
 julia> f = angle(x)
-[3.1083 +/- 3.95e-5]

Constants

Nemo.const_piMethod
const_pi(r::AcbField)

Return $\pi = 3.14159\ldots$ as an element of $r$.

source

Examples

julia> CC = AcbField(200)
+[3.1083 +/- 3.95e-5]

Constants

Nemo.const_piMethod
const_pi(r::AcbField)

Return $\pi = 3.14159\ldots$ as an element of $r$.

source

Examples

julia> CC = AcbField(200)
 Complex Field with 200 bits of precision and error bounds
 
 julia> a = const_pi(CC)
-[3.14159265358979323846264338327950288419716939937510582097494 +/- 5.73e-60]

Mathematical and special functions

Nemo.rsqrtMethod
rsqrt(x::acb)

Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$.

source
Base.cispiMethod
cispi(x::acb)

Return the exponential of $\pi i x$.

source
Nemo.root_of_unityMethod
root_of_unity(C::AcbField, k::Int)

Return $\exp(2\pi i/k)$.

source
Nemo.log_sinpiMethod
log_sinpi(x::acb)

Return $\log\sin(\pi x)$, constructed without branch cuts off the real line.

source
Nemo.gammaMethod
gamma(x::acb)

Return the Gamma function evaluated at $x$.

source
Nemo.lgammaMethod
lgamma(x::acb)

Return the logarithm of the Gamma function evaluated at $x$.

source
Nemo.rgammaMethod
rgamma(x::acb)

Return the reciprocal of the Gamma function evaluated at $x$.

source
Nemo.digammaMethod
digamma(x::acb)

Return the logarithmic derivative of the gamma function evaluated at $x$, i.e. $\psi(x)$.

source
Nemo.zetaMethod
zeta(x::acb)

Return the Riemann zeta function evaluated at $x$.

source
Nemo.barnes_gMethod
barnes_g(x::acb)

Return the Barnes $G$-function, evaluated at $x$.

source
Nemo.log_barnes_gMethod
log_barnes_g(x::acb)

Return the logarithm of the Barnes $G$-function, evaluated at $x$.

source
Nemo.erfMethod
erf(x::acb)

Return the error function evaluated at $x$.

source
Nemo.erfiMethod
erfi(x::acb)

Return the imaginary error function evaluated at $x$.

source
Nemo.exp_integral_eiMethod
exp_integral_ei(x::acb)

Return the exponential integral evaluated at $x$.

source
Nemo.sin_integralMethod
sin_integral(x::acb)

Return the sine integral evaluated at $x$.

source
Nemo.cos_integralMethod
cos_integral(x::acb)

Return the exponential cosine integral evaluated at $x$.

source
Nemo.sinh_integralMethod
sinh_integral(x::acb)

Return the hyperbolic sine integral evaluated at $x$.

source
Nemo.cosh_integralMethod
cosh_integral(x::acb)

Return the hyperbolic cosine integral evaluated at $x$.

source
Nemo.dedekind_etaMethod
dedekind_eta(x::acb)

Return the Dedekind eta function $\eta(\tau)$ at $\tau = x$.

source
Nemo.modular_weber_fMethod
modular_weber_f(x::acb)

Return the modular Weber function $\mathfrak{f}(\tau) = \frac{\eta^2(\tau)}{\eta(\tau/2)\eta(2\tau)},$ at $x$ in the complex upper half plane.

source
Nemo.modular_weber_f1Method
modular_weber_f1(x::acb)

Return the modular Weber function $\mathfrak{f}_1(\tau) = \frac{\eta(\tau/2)}{\eta(\tau)},$ at $x$ in the complex upper half plane.

source
Nemo.modular_weber_f2Method
modular_weber_f2(x::acb)

Return the modular Weber function $\mathfrak{f}_2(\tau) = \frac{\sqrt{2}\eta(2\tau)}{\eta(\tau)}$ at $x$ in the complex upper half plane.

source
Nemo.j_invariantMethod
j_invariant(x::acb)

Return the $j$-invariant $j(\tau)$ at $\tau = x$.

source
Nemo.modular_lambdaMethod
modular_lambda(x::acb)

Return the modular lambda function $\lambda(\tau)$ at $\tau = x$.

source
Nemo.modular_deltaMethod
modular_delta(x::acb)

Return the modular delta function $\Delta(\tau)$ at $\tau = x$.

source
Nemo.eisenstein_gMethod
eisenstein_g(k::Int, x::acb)

Return the non-normalized Eisenstein series $G_k(\tau)$ of $\mathrm{SL}_2(\mathbb{Z})$. Also defined for $\tau = i \infty$.

source
Nemo.elliptic_kMethod
elliptic_k(x::acb)

Return the complete elliptic integral $K(x)$.

source
Nemo.elliptic_eMethod
elliptic_e(x::acb)

Return the complete elliptic integral $E(x)$.

source
Nemo.agmMethod
agm(x::acb)

Return the arithmetic-geometric mean of $1$ and $x$.

source
Nemo.agmMethod
agm(x::acb, y::acb)

Return the arithmetic-geometric mean of $x$ and $y$.

source
Nemo.polygammaMethod
polygamma(s::acb, a::acb)

Return the generalised polygamma function $\psi(s,z)$.

source
Nemo.zetaMethod
zeta(s::acb, a::acb)

Return the Hurwitz zeta function $\zeta(s,a)$.

source
Nemo.rising_factorialMethod
rising_factorial(x::acb, n::Int)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an Acb.

source
Nemo.rising_factorial2Method
rising_factorial2(x::acb, n::Int)

Return a tuple containing the rising factorial $x(x + 1)\ldots (x + n - 1)$ and its derivative.

source
Nemo.polylogMethod
polylog(s::Union{acb,Int}, a::acb)

Return the polylogarithm Li$_s(a)$.

source
Nemo.log_integralMethod
log_integral(x::acb)

Return the logarithmic integral, evaluated at $x$.

source
Nemo.log_integral_offsetMethod
log_integral_offset(x::acb)

Return the offset logarithmic integral, evaluated at $x$.

source
Nemo.exp_integral_eMethod
exp_integral_e(s::acb, x::acb)

Return the generalised exponential integral $E_s(x)$.

source
Nemo.gammaMethod
gamma(s::acb, x::acb)

Return the upper incomplete gamma function $\Gamma(s,x)$.

source
Nemo.gamma_regularizedMethod
gamma_regularized(s::acb, x::acb)

Return the regularized upper incomplete gamma function $\Gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lowerMethod
gamma_lower(s::acb, x::acb)

Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lower_regularizedMethod
gamma_lower_regularized(s::acb, x::acb)

Return the regularized lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.airy_aiMethod
airy_ai(x::acb)

Return the Airy function $\operatorname{Ai}(x)$.

source
Nemo.airy_ai_primeMethod
airy_ai_prime(x::acb)

Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$.

source
Nemo.airy_biMethod
airy_bi(x::acb)

Return the Airy function $\operatorname{Bi}(x)$.

source
Nemo.airy_bi_primeMethod
airy_bi_prime(x::acb)

Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$.

source
Nemo.bessel_jMethod
bessel_j(nu::acb, x::acb)

Return the Bessel function $J_{\nu}(x)$.

source
Nemo.bessel_yMethod
bessel_y(nu::acb, x::acb)

Return the Bessel function $Y_{\nu}(x)$.

source
Nemo.bessel_iMethod
bessel_i(nu::acb, x::acb)

Return the Bessel function $I_{\nu}(x)$.

source
Nemo.bessel_kMethod
bessel_k(nu::acb, x::acb)

Return the Bessel function $K_{\nu}(x)$.

source
Nemo.hypergeometric_1f1Method
hypergeometric_1f1(a::acb, b::acb, x::acb)

Return the confluent hypergeometric function ${}_1F_1(a,b,x)$.

source
Nemo.hypergeometric_1f1_regularizedMethod
hypergeometric_1f1_regularized(a::acb, b::acb, x::acb)

Return the regularized confluent hypergeometric function ${}_1F_1(a,b,x) / \Gamma(b)$.

source
Nemo.hypergeometric_uMethod
hypergeometric_u(a::acb, b::acb, x::acb)

Return the confluent hypergeometric function $U(a,b,x)$.

source
Nemo.hypergeometric_2f1Method
hypergeometric_2f1(a::acb, b::acb, c::acb, x::acb; flags=0)

Return the Gauss hypergeometric function ${}_2F_1(a,b,c,x)$.

source
Nemo.jacobi_thetaMethod
jacobi_theta(z::acb, tau::acb)

Return a tuple of four elements containing the Jacobi theta function values $\theta_1, \theta_2, \theta_3, \theta_4$ evaluated at $z, \tau$.

source
Nemo.weierstrass_pMethod
weierstrass_p(z::acb, tau::acb)

Return the Weierstrass elliptic function $\wp(z,\tau)$.

source

Examples

julia> CC = AcbField(64)
+[3.14159265358979323846264338327950288419716939937510582097494 +/- 5.73e-60]

Mathematical and special functions

Nemo.rsqrtMethod
rsqrt(x::acb)

Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$.

source
Base.cispiMethod
cispi(x::acb)

Return the exponential of $\pi i x$.

source
Nemo.root_of_unityMethod
root_of_unity(C::AcbField, k::Int)

Return $\exp(2\pi i/k)$.

source
Nemo.log_sinpiMethod
log_sinpi(x::acb)

Return $\log\sin(\pi x)$, constructed without branch cuts off the real line.

source
Nemo.gammaMethod
gamma(x::acb)

Return the Gamma function evaluated at $x$.

source
Nemo.lgammaMethod
lgamma(x::acb)

Return the logarithm of the Gamma function evaluated at $x$.

source
Nemo.rgammaMethod
rgamma(x::acb)

Return the reciprocal of the Gamma function evaluated at $x$.

source
Nemo.digammaMethod
digamma(x::acb)

Return the logarithmic derivative of the gamma function evaluated at $x$, i.e. $\psi(x)$.

source
Nemo.zetaMethod
zeta(x::acb)

Return the Riemann zeta function evaluated at $x$.

source
Nemo.barnes_gMethod
barnes_g(x::acb)

Return the Barnes $G$-function, evaluated at $x$.

source
Nemo.log_barnes_gMethod
log_barnes_g(x::acb)

Return the logarithm of the Barnes $G$-function, evaluated at $x$.

source
Nemo.erfMethod
erf(x::acb)

Return the error function evaluated at $x$.

source
Nemo.erfiMethod
erfi(x::acb)

Return the imaginary error function evaluated at $x$.

source
Nemo.exp_integral_eiMethod
exp_integral_ei(x::acb)

Return the exponential integral evaluated at $x$.

source
Nemo.sin_integralMethod
sin_integral(x::acb)

Return the sine integral evaluated at $x$.

source
Nemo.cos_integralMethod
cos_integral(x::acb)

Return the exponential cosine integral evaluated at $x$.

source
Nemo.sinh_integralMethod
sinh_integral(x::acb)

Return the hyperbolic sine integral evaluated at $x$.

source
Nemo.cosh_integralMethod
cosh_integral(x::acb)

Return the hyperbolic cosine integral evaluated at $x$.

source
Nemo.dedekind_etaMethod
dedekind_eta(x::acb)

Return the Dedekind eta function $\eta(\tau)$ at $\tau = x$.

source
Nemo.modular_weber_fMethod
modular_weber_f(x::acb)

Return the modular Weber function $\mathfrak{f}(\tau) = \frac{\eta^2(\tau)}{\eta(\tau/2)\eta(2\tau)},$ at $x$ in the complex upper half plane.

source
Nemo.modular_weber_f1Method
modular_weber_f1(x::acb)

Return the modular Weber function $\mathfrak{f}_1(\tau) = \frac{\eta(\tau/2)}{\eta(\tau)},$ at $x$ in the complex upper half plane.

source
Nemo.modular_weber_f2Method
modular_weber_f2(x::acb)

Return the modular Weber function $\mathfrak{f}_2(\tau) = \frac{\sqrt{2}\eta(2\tau)}{\eta(\tau)}$ at $x$ in the complex upper half plane.

source
Nemo.j_invariantMethod
j_invariant(x::acb)

Return the $j$-invariant $j(\tau)$ at $\tau = x$.

source
Nemo.modular_lambdaMethod
modular_lambda(x::acb)

Return the modular lambda function $\lambda(\tau)$ at $\tau = x$.

source
Nemo.modular_deltaMethod
modular_delta(x::acb)

Return the modular delta function $\Delta(\tau)$ at $\tau = x$.

source
Nemo.eisenstein_gMethod
eisenstein_g(k::Int, x::acb)

Return the non-normalized Eisenstein series $G_k(\tau)$ of $\mathrm{SL}_2(\mathbb{Z})$. Also defined for $\tau = i \infty$.

source
Nemo.elliptic_kMethod
elliptic_k(x::acb)

Return the complete elliptic integral $K(x)$.

source
Nemo.elliptic_eMethod
elliptic_e(x::acb)

Return the complete elliptic integral $E(x)$.

source
Nemo.agmMethod
agm(x::acb)

Return the arithmetic-geometric mean of $1$ and $x$.

source
Nemo.agmMethod
agm(x::acb, y::acb)

Return the arithmetic-geometric mean of $x$ and $y$.

source
Nemo.polygammaMethod
polygamma(s::acb, a::acb)

Return the generalised polygamma function $\psi(s,z)$.

source
Nemo.zetaMethod
zeta(s::acb, a::acb)

Return the Hurwitz zeta function $\zeta(s,a)$.

source
Nemo.rising_factorialMethod
rising_factorial(x::acb, n::Int)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an Acb.

source
Nemo.rising_factorial2Method
rising_factorial2(x::acb, n::Int)

Return a tuple containing the rising factorial $x(x + 1)\ldots (x + n - 1)$ and its derivative.

source
Nemo.polylogMethod
polylog(s::Union{acb,Int}, a::acb)

Return the polylogarithm Li$_s(a)$.

source
Nemo.log_integralMethod
log_integral(x::acb)

Return the logarithmic integral, evaluated at $x$.

source
Nemo.log_integral_offsetMethod
log_integral_offset(x::acb)

Return the offset logarithmic integral, evaluated at $x$.

source
Nemo.exp_integral_eMethod
exp_integral_e(s::acb, x::acb)

Return the generalised exponential integral $E_s(x)$.

source
Nemo.gammaMethod
gamma(s::acb, x::acb)

Return the upper incomplete gamma function $\Gamma(s,x)$.

source
Nemo.gamma_regularizedMethod
gamma_regularized(s::acb, x::acb)

Return the regularized upper incomplete gamma function $\Gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lowerMethod
gamma_lower(s::acb, x::acb)

Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lower_regularizedMethod
gamma_lower_regularized(s::acb, x::acb)

Return the regularized lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.airy_aiMethod
airy_ai(x::acb)

Return the Airy function $\operatorname{Ai}(x)$.

source
Nemo.airy_ai_primeMethod
airy_ai_prime(x::acb)

Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$.

source
Nemo.airy_biMethod
airy_bi(x::acb)

Return the Airy function $\operatorname{Bi}(x)$.

source
Nemo.airy_bi_primeMethod
airy_bi_prime(x::acb)

Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$.

source
Nemo.bessel_jMethod
bessel_j(nu::acb, x::acb)

Return the Bessel function $J_{\nu}(x)$.

source
Nemo.bessel_yMethod
bessel_y(nu::acb, x::acb)

Return the Bessel function $Y_{\nu}(x)$.

source
Nemo.bessel_iMethod
bessel_i(nu::acb, x::acb)

Return the Bessel function $I_{\nu}(x)$.

source
Nemo.bessel_kMethod
bessel_k(nu::acb, x::acb)

Return the Bessel function $K_{\nu}(x)$.

source
Nemo.hypergeometric_1f1Method
hypergeometric_1f1(a::acb, b::acb, x::acb)

Return the confluent hypergeometric function ${}_1F_1(a,b,x)$.

source
Nemo.hypergeometric_1f1_regularizedMethod
hypergeometric_1f1_regularized(a::acb, b::acb, x::acb)

Return the regularized confluent hypergeometric function ${}_1F_1(a,b,x) / \Gamma(b)$.

source
Nemo.hypergeometric_uMethod
hypergeometric_u(a::acb, b::acb, x::acb)

Return the confluent hypergeometric function $U(a,b,x)$.

source
Nemo.hypergeometric_2f1Method
hypergeometric_2f1(a::acb, b::acb, c::acb, x::acb; flags=0)

Return the Gauss hypergeometric function ${}_2F_1(a,b,c,x)$.

source
Nemo.jacobi_thetaMethod
jacobi_theta(z::acb, tau::acb)

Return a tuple of four elements containing the Jacobi theta function values $\theta_1, \theta_2, \theta_3, \theta_4$ evaluated at $z, \tau$.

source
Nemo.weierstrass_pMethod
weierstrass_p(z::acb, tau::acb)

Return the Weierstrass elliptic function $\wp(z,\tau)$.

source

Examples

julia> CC = AcbField(64)
 Complex Field with 64 bits of precision and error bounds
 
 julia> s = CC(1, 2)
@@ -168,7 +168,7 @@
 [0.63189634741402481 +/- 4.85e-18] + [0.00970090757446076 +/- 4.66e-18]*im
 
 julia> d = hypergeometric_1f1(s, s+1, z)
-[-1.3355297330012291 +/- 5.83e-17] + [-0.1715020340928697 +/- 4.97e-17]*im

Linear dependence

Nemo.lindepMethod
lindep(A::Vector{acb}, bits::Int)

Find a small linear combination of the entries of the array $A$ that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.

source
Nemo.lindepMethod
lindep(A::Matrix{acb}, bits::Int)

Find a (common) small linear combination of the entries in each row of the array $A$, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.

source

Examples

CC = AcbField(128)
+[-1.3355297330012291 +/- 5.83e-17] + [-0.1715020340928697 +/- 4.97e-17]*im

Linear dependence

Nemo.lindepMethod
lindep(A::Vector{acb}, bits::Int)

Find a small linear combination of the entries of the array $A$ that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.

source
Nemo.lindepMethod
lindep(A::Matrix{acb}, bits::Int)

Find a (common) small linear combination of the entries in each row of the array $A$, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.

source

Examples

CC = AcbField(128)
 
 # These are two of the roots of x^5 + 3x + 1
 a = CC(1.0050669478588622428791051888364775253, - 0.93725915669289182697903585868761513585)
@@ -181,4 +181,4 @@
 # ...or from two
 V2 = [CC(1), b, b^2, b^3, b^4, b^5];
 Vs = [V1 V2]
-X = lindep(Vs, 20)
+X = lindep(Vs, 20) diff --git a/dev/algebraic/index.html b/dev/algebraic/index.html index 8c47182e7..593ada23f 100644 --- a/dev/algebraic/index.html +++ b/dev/algebraic/index.html @@ -22,7 +22,7 @@ 3-element Vector{qqbar}: Root 2.00000 of x - 2 Root 0.500000 + 0.866025*im of x^2 - x + 1 - Root 0.500000 - 0.866025*im of x^2 - x + 1

Interface

AbstractAlgebra.Generic.rootsMethod
roots(R::CalciumQQBarField, f::ZZPolyRingElem)

Return all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Roots of multiplicity higher than one are repeated according to their multiplicity.

source
AbstractAlgebra.Generic.rootsMethod
roots(R::CalciumQQBarField, f::QQPolyRingElem)

Return all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Roots of multiplicity higher than one are repeated according to their multiplicity.

source
Nemo.eigenvaluesMethod
eigenvalues(A::ZZMatrix, R::CalciumQQBarField)

Return all the eigenvalues of the matrix A in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Eigenvalues of multiplicity higher than one are repeated according to their multiplicity.

source
Nemo.eigenvaluesMethod
eigenvalues(A::QQMatrix, R::CalciumQQBarField)

Return all the eigenvalues of the matrix A in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Eigenvalues of multiplicity higher than one are repeated according to their multiplicity.

source
Base.randMethod
rand(R::CalciumQQBarField; degree::Int, bits::Int, randtype::Symbol=:null)

Return a random algebraic number with degree up to degree and coefficients up to bits in size. By default, both real and complex numbers are generated. Set the optional randtype to :real or :nonreal to generate a specific type of number. Note that nonreal numbers require degree at least 2.

source

Numerical evaluation

Examples

Algebraic numbers can be evaluated numerically to arbitrary precision by converting to real or complex Arb fields:

julia> RR = ArbField(64); RR(sqrt(QQBar(2)))
+ Root 0.500000 - 0.866025*im of x^2 - x + 1

Interface

AbstractAlgebra.Generic.rootsMethod
roots(R::CalciumQQBarField, f::ZZPolyRingElem)

Return all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Roots of multiplicity higher than one are repeated according to their multiplicity.

source
AbstractAlgebra.Generic.rootsMethod
roots(R::CalciumQQBarField, f::QQPolyRingElem)

Return all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Roots of multiplicity higher than one are repeated according to their multiplicity.

source
Nemo.eigenvaluesMethod
eigenvalues(A::ZZMatrix, R::CalciumQQBarField)

Return all the eigenvalues of the matrix A in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Eigenvalues of multiplicity higher than one are repeated according to their multiplicity.

source
Nemo.eigenvaluesMethod
eigenvalues(A::QQMatrix, R::CalciumQQBarField)

Return all the eigenvalues of the matrix A in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Eigenvalues of multiplicity higher than one are repeated according to their multiplicity.

source
Base.randMethod
rand(R::CalciumQQBarField; degree::Int, bits::Int, randtype::Symbol=:null)

Return a random algebraic number with degree up to degree and coefficients up to bits in size. By default, both real and complex numbers are generated. Set the optional randtype to :real or :nonreal to generate a specific type of number. Note that nonreal numbers require degree at least 2.

source

Numerical evaluation

Examples

Algebraic numbers can be evaluated numerically to arbitrary precision by converting to real or complex Arb fields:

julia> RR = ArbField(64); RR(sqrt(QQBar(2)))
 [1.414213562373095049 +/- 3.45e-19]
 
 julia> CC = AcbField(32); CC(QQBar(-1) ^ (QQBar(1) // 4))
@@ -32,7 +32,7 @@
 julia> conjugates(QQBar(1+2im))
 2-element Vector{qqbar}:
  Root 1.00000 + 2.00000*im of x^2 - 2x + 5
- Root 1.00000 - 2.00000*im of x^2 - 2x + 5

Interface

Base.iszeroMethod
iszero(x::qqbar)

Return whether x is the number 0.

source
Base.isoneMethod
isone(x::qqbar)

Return whether x is the number 1.

source
Base.isintegerMethod
isinteger(x::qqbar)

Return whether x is an integer.

source
Nemo.is_rationalMethod
is_rational(x::qqbar)

Return whether x is a rational number.

source
Base.isrealMethod
isreal(x::qqbar)

Return whether x is a real number.

source
AbstractAlgebra.degreeMethod
degree(x::qqbar)

Return the degree of the minimal polynomial of x.

source
Nemo.is_algebraic_integerMethod
is_algebraic_integer(x::qqbar)

Return whether x is an algebraic integer.

source
AbstractAlgebra.minpolyMethod
minpoly(R::ZZPolyRing, x::qqbar)

Return the minimal polynomial of x as an element of the polynomial ring R.

source
AbstractAlgebra.minpolyMethod
minpoly(R::ZZPolyRing, x::qqbar)

Return the minimal polynomial of x as an element of the polynomial ring R.

source
Nemo.conjugatesMethod
conjugates(a::qqbar)

Return all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers.

source
Base.denominatorMethod
denominator(x::qqbar)

Return the denominator of x, defined as the leading coefficient of the minimal polynomial of x. The result is returned as an ZZRingElem.

source
Base.numeratorMethod
numerator(x::qqbar)

Return the numerator of x, defined as x multiplied by its denominator. The result is an algebraic integer.

source
Nemo.heightMethod
height(x::qqbar)

Return the height of the algebraic number x. The result is an ZZRingElem integer.

source
Nemo.height_bitsMethod
height_bits(x::qqbar)

Return the height of the algebraic number x measured in bits. The result is a Julia integer.

source

Complex parts

Examples

julia> real(sqrt(QQBar(1im)))
+ Root 1.00000 - 2.00000*im of x^2 - 2x + 5

Interface

Base.iszeroMethod
iszero(x::qqbar)

Return whether x is the number 0.

source
Base.isoneMethod
isone(x::qqbar)

Return whether x is the number 1.

source
Base.isintegerMethod
isinteger(x::qqbar)

Return whether x is an integer.

source
Nemo.is_rationalMethod
is_rational(x::qqbar)

Return whether x is a rational number.

source
Base.isrealMethod
isreal(x::qqbar)

Return whether x is a real number.

source
AbstractAlgebra.degreeMethod
degree(x::qqbar)

Return the degree of the minimal polynomial of x.

source
Nemo.is_algebraic_integerMethod
is_algebraic_integer(x::qqbar)

Return whether x is an algebraic integer.

source
AbstractAlgebra.minpolyMethod
minpoly(R::ZZPolyRing, x::qqbar)

Return the minimal polynomial of x as an element of the polynomial ring R.

source
AbstractAlgebra.minpolyMethod
minpoly(R::ZZPolyRing, x::qqbar)

Return the minimal polynomial of x as an element of the polynomial ring R.

source
Nemo.conjugatesMethod
conjugates(a::qqbar)

Return all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers.

source
Base.denominatorMethod
denominator(x::qqbar)

Return the denominator of x, defined as the leading coefficient of the minimal polynomial of x. The result is returned as an ZZRingElem.

source
Base.numeratorMethod
numerator(x::qqbar)

Return the numerator of x, defined as x multiplied by its denominator. The result is an algebraic integer.

source
Nemo.heightMethod
height(x::qqbar)

Return the height of the algebraic number x. The result is an ZZRingElem integer.

source
Nemo.height_bitsMethod
height_bits(x::qqbar)

Return the height of the algebraic number x measured in bits. The result is a Julia integer.

source

Complex parts

Examples

julia> real(sqrt(QQBar(1im)))
 Root 0.707107 of 2x^2 - 1
 
 julia> abs(sqrt(QQBar(1im)))
@@ -42,7 +42,7 @@
 Root 31.0000 of x - 31
 
 julia> sign(QQBar(-10-20im))
-Root -0.447214 - 0.894427*im of 5x^4 + 6x^2 + 5

Interface

Base.realMethod
real(a::qqbar)

Return the real part of a.

source
Base.imagMethod
imag(a::qqbar)

Return the imaginary part of a.

source
Base.absMethod
abs(a::qqbar)

Return the absolute value of a.

source
Base.abs2Method
abs2(a::qqbar)

Return the squared absolute value of a.

source
Base.conjMethod
conj(a::qqbar)

Return the complex conjugate of a.

source
Base.signMethod
sign(a::qqbar)

Return the complex sign of a, defined as zero if a is zero and as $a / |a|$ otherwise.

source
Nemo.csgnMethod
csgn(a::qqbar)

Return the extension of the real sign function taking the value 1 strictly in the right half plane, -1 strictly in the left half plane, and the sign of the imaginary part when on the imaginary axis. Equivalently, $\operatorname{csgn}(x) = x / \sqrt{x^2}$ except that the value is 0 at zero. The value is returned as a Julia integer.

source
Nemo.sign_realMethod
sign_real(a::qqbar)

Return the sign of the real part of a as a Julia integer.

source
Nemo.sign_imagMethod
sign_imag(a::qqbar)

Return the sign of the imaginary part of a as a Julia integer.

source
Base.floorMethod
floor(a::qqbar)

Return the floor function of a as an algebraic number. Use ZZRingElem(floor(a)) to construct a Nemo integer instead.

source
Base.ceilMethod
ceil(a::qqbar)

Return the ceiling function of b as an algebraic number. Use ZZRingElem(ceil(a)) to construct a Nemo integer instead.

source

Comparing algebraic numbers

The operators == and != check exactly for equality.

We provide various comparison functions for ordering algebraic numbers:

The standard comparison will throw if either argument is nonreal.

The various comparisons for complex parts are provided as separate operations since these functions are far more efficient than explicitly computing the complex parts and then doing real comparisons.

The root sort order is a total order for complex algebraic numbers used to order the output of roots and conjugates canonically. We define this order as follows: real roots come first, in descending order. Nonreal roots are subsequently ordered first by real part in descending order, then in ascending order by the absolute value of the imaginary part, and then in descending order of the sign of the imaginary part. This implies that complex conjugate roots are adjacent, with the root in the upper half plane first.

Examples

julia> 1 < sqrt(QQBar(2)) < QQBar(3)//2
+Root -0.447214 - 0.894427*im of 5x^4 + 6x^2 + 5

Interface

Base.realMethod
real(a::qqbar)

Return the real part of a.

source
Base.imagMethod
imag(a::qqbar)

Return the imaginary part of a.

source
Base.absMethod
abs(a::qqbar)

Return the absolute value of a.

source
Base.abs2Method
abs2(a::qqbar)

Return the squared absolute value of a.

source
Base.conjMethod
conj(a::qqbar)

Return the complex conjugate of a.

source
Base.signMethod
sign(a::qqbar)

Return the complex sign of a, defined as zero if a is zero and as $a / |a|$ otherwise.

source
Nemo.csgnMethod
csgn(a::qqbar)

Return the extension of the real sign function taking the value 1 strictly in the right half plane, -1 strictly in the left half plane, and the sign of the imaginary part when on the imaginary axis. Equivalently, $\operatorname{csgn}(x) = x / \sqrt{x^2}$ except that the value is 0 at zero. The value is returned as a Julia integer.

source
Nemo.sign_realMethod
sign_real(a::qqbar)

Return the sign of the real part of a as a Julia integer.

source
Nemo.sign_imagMethod
sign_imag(a::qqbar)

Return the sign of the imaginary part of a as a Julia integer.

source
Base.floorMethod
floor(a::qqbar)

Return the floor function of a as an algebraic number. Use ZZRingElem(floor(a)) to construct a Nemo integer instead.

source
Base.ceilMethod
ceil(a::qqbar)

Return the ceiling function of b as an algebraic number. Use ZZRingElem(ceil(a)) to construct a Nemo integer instead.

source

Comparing algebraic numbers

The operators == and != check exactly for equality.

We provide various comparison functions for ordering algebraic numbers:

The standard comparison will throw if either argument is nonreal.

The various comparisons for complex parts are provided as separate operations since these functions are far more efficient than explicitly computing the complex parts and then doing real comparisons.

The root sort order is a total order for complex algebraic numbers used to order the output of roots and conjugates canonically. We define this order as follows: real roots come first, in descending order. Nonreal roots are subsequently ordered first by real part in descending order, then in ascending order by the absolute value of the imaginary part, and then in descending order of the sign of the imaginary part. This implies that complex conjugate roots are adjacent, with the root in the upper half plane first.

Examples

julia> 1 < sqrt(QQBar(2)) < QQBar(3)//2
 true
 
 julia> x = QQBar(3+4im)
@@ -55,7 +55,7 @@
 true
 
 julia> is_less_real(x, x // 2)
-false

Interface

Nemo.is_equal_realMethod
is_equal_real(a::qqbar, b::qqbar)

Compares the real parts of a and b.

source
Nemo.is_equal_imagMethod
is_equal_imag(a::qqbar, b::qqbar)

Compares the imaginary parts of a and b.

source
Nemo.is_equal_absMethod
is_equal_abs(a::qqbar, b::qqbar)

Compares the absolute values of a and b.

source
Nemo.is_equal_abs_realMethod
is_equal_abs_real(a::qqbar, b::qqbar)

Compares the absolute values of the real parts of a and b.

source
Nemo.is_equal_abs_imagMethod
is_equal_abs_imag(a::qqbar, b::qqbar)

Compares the absolute values of the imaginary parts of a and b.

source
Nemo.is_less_realMethod
is_less_real(a::qqbar, b::qqbar)

Compares the real parts of a and b.

source
Nemo.is_less_imagMethod
is_less_imag(a::qqbar, b::qqbar)

Compares the imaginary parts of a and b.

source
Nemo.is_less_absMethod
is_less_abs(a::qqbar, b::qqbar)

Compares the absolute values of a and b.

source
Nemo.is_less_abs_realMethod
is_less_abs_real(a::qqbar, b::qqbar)

Compares the absolute values of the real parts of a and b.

source
Nemo.is_less_abs_imagMethod
is_less_abs_imag(a::qqbar, b::qqbar)

Compares the absolute values of the imaginary parts of a and b.

source
Nemo.is_less_root_orderMethod
is_less_root_order(a::qqbar, b::qqbar)

Compares the a and b in root sort order.

source

Roots and trigonometric functions

Examples

julia> root(QQBar(2), 5)
+false

Interface

Nemo.is_equal_realMethod
is_equal_real(a::qqbar, b::qqbar)

Compares the real parts of a and b.

source
Nemo.is_equal_imagMethod
is_equal_imag(a::qqbar, b::qqbar)

Compares the imaginary parts of a and b.

source
Nemo.is_equal_absMethod
is_equal_abs(a::qqbar, b::qqbar)

Compares the absolute values of a and b.

source
Nemo.is_equal_abs_realMethod
is_equal_abs_real(a::qqbar, b::qqbar)

Compares the absolute values of the real parts of a and b.

source
Nemo.is_equal_abs_imagMethod
is_equal_abs_imag(a::qqbar, b::qqbar)

Compares the absolute values of the imaginary parts of a and b.

source
Nemo.is_less_realMethod
is_less_real(a::qqbar, b::qqbar)

Compares the real parts of a and b.

source
Nemo.is_less_imagMethod
is_less_imag(a::qqbar, b::qqbar)

Compares the imaginary parts of a and b.

source
Nemo.is_less_absMethod
is_less_abs(a::qqbar, b::qqbar)

Compares the absolute values of a and b.

source
Nemo.is_less_abs_realMethod
is_less_abs_real(a::qqbar, b::qqbar)

Compares the absolute values of the real parts of a and b.

source
Nemo.is_less_abs_imagMethod
is_less_abs_imag(a::qqbar, b::qqbar)

Compares the absolute values of the imaginary parts of a and b.

source
Nemo.is_less_root_orderMethod
is_less_root_order(a::qqbar, b::qqbar)

Compares the a and b in root sort order.

source

Roots and trigonometric functions

Examples

julia> root(QQBar(2), 5)
 Root 1.14870 of x^5 - 2
 
 julia> sinpi(QQBar(7) // 13)
@@ -80,7 +80,7 @@
 false
 
 julia> root_of_unity_as_args(w)
-(6, 5)

Interface

Base.sqrtMethod
sqrt(a::qqbar; check::Bool=true)

Return the principal square root of a.

source
AbstractAlgebra.rootMethod
root(a::qqbar, n::Int)

Return the principal n-th root of a. Requires positive n.

source
Nemo.root_of_unityMethod
root_of_unity(C::CalciumQQBarField, n::Int)

Return the root of unity $e^{2 \pi i / n}$ as an element of the field of algebraic numbers C.

source
Nemo.root_of_unityMethod
root_of_unity(C::CalciumQQBarField, n::Int, k::Int)

Return the root of unity $e^{2 \pi i k / n}$ as an element of the field of algebraic numbers C.

source
Nemo.is_root_of_unityMethod
is_root_of_unity(a::qqbar)

Return whether the given algebraic number is a root of unity.

source
Nemo.root_of_unity_as_argsMethod
root_of_unity_as_args(a::qqbar)

Return a pair of integers (q, p) such that the given a equals $e^{2 \pi i p / q}$. The denominator q will be minimal, with $0 \le p < q$. Throws if a is not a root of unity.

source
Nemo.exp_pi_iMethod
exp_pi_i(a::qqbar)

Return $e^{\pi i a}$ as an algebraic number. Throws if this value is transcendental.

source
Nemo.log_pi_iMethod
log_pi_i(a::qqbar)

Return $\log(a) / (\pi i)$ as an algebraic number. Throws if this value is transcendental or undefined.

source
Base.Math.sinpiMethod
sinpi(a::qqbar)

Return $\sin(\pi a)$ as an algebraic number. Throws if this value is transcendental.

source
Base.Math.cospiMethod
cospi(a::qqbar)

Return $\cos(\pi a)$ as an algebraic number. Throws if this value is transcendental.

source
Nemo.tanpiMethod
tanpi(a::qqbar)

Return $\tan(\pi a)$ as an algebraic number. Throws if this value is transcendental or undefined.

source
Nemo.asinpiMethod
asinpi(a::qqbar)

Return $\operatorname{asin}(a) / \pi$ as an algebraic number. Throws if this value is transcendental.

source
Nemo.acospiMethod
acospi(a::qqbar)

Return $\operatorname{acos}(a) / \pi$ as an algebraic number. Throws if this value is transcendental.

source
Nemo.atanpiMethod
atanpi(a::qqbar)

Return $\operatorname{atan}(a) / \pi$ as an algebraic number. Throws if this value is transcendental or undefined.

source

Guessing

Examples

An algebraic number can be recovered from a numerical value:

julia> RR = ArbField(53); guess(QQBar, RR("1.41421356 +/- 1e-6"), 2)
+(6, 5)

Interface

Base.sqrtMethod
sqrt(a::qqbar; check::Bool=true)

Return the principal square root of a.

source
AbstractAlgebra.rootMethod
root(a::qqbar, n::Int)

Return the principal n-th root of a. Requires positive n.

source
Nemo.root_of_unityMethod
root_of_unity(C::CalciumQQBarField, n::Int)

Return the root of unity $e^{2 \pi i / n}$ as an element of the field of algebraic numbers C.

source
Nemo.root_of_unityMethod
root_of_unity(C::CalciumQQBarField, n::Int, k::Int)

Return the root of unity $e^{2 \pi i k / n}$ as an element of the field of algebraic numbers C.

source
Nemo.is_root_of_unityMethod
is_root_of_unity(a::qqbar)

Return whether the given algebraic number is a root of unity.

source
Nemo.root_of_unity_as_argsMethod
root_of_unity_as_args(a::qqbar)

Return a pair of integers (q, p) such that the given a equals $e^{2 \pi i p / q}$. The denominator q will be minimal, with $0 \le p < q$. Throws if a is not a root of unity.

source
Nemo.exp_pi_iMethod
exp_pi_i(a::qqbar)

Return $e^{\pi i a}$ as an algebraic number. Throws if this value is transcendental.

source
Nemo.log_pi_iMethod
log_pi_i(a::qqbar)

Return $\log(a) / (\pi i)$ as an algebraic number. Throws if this value is transcendental or undefined.

source
Base.Math.sinpiMethod
sinpi(a::qqbar)

Return $\sin(\pi a)$ as an algebraic number. Throws if this value is transcendental.

source
Base.Math.cospiMethod
cospi(a::qqbar)

Return $\cos(\pi a)$ as an algebraic number. Throws if this value is transcendental.

source
Nemo.tanpiMethod
tanpi(a::qqbar)

Return $\tan(\pi a)$ as an algebraic number. Throws if this value is transcendental or undefined.

source
Nemo.asinpiMethod
asinpi(a::qqbar)

Return $\operatorname{asin}(a) / \pi$ as an algebraic number. Throws if this value is transcendental.

source
Nemo.acospiMethod
acospi(a::qqbar)

Return $\operatorname{acos}(a) / \pi$ as an algebraic number. Throws if this value is transcendental.

source
Nemo.atanpiMethod
atanpi(a::qqbar)

Return $\operatorname{atan}(a) / \pi$ as an algebraic number. Throws if this value is transcendental or undefined.

source

Guessing

Examples

An algebraic number can be recovered from a numerical value:

julia> RR = ArbField(53); guess(QQBar, RR("1.41421356 +/- 1e-6"), 2)
 Root 1.41421 of x^2 - 2

Warning: the input should be an enclosure. If you have a floating-point approximation, you should add an error estimate; otherwise, the only algebraic number that can be guessed is the binary floating-point number itself.

julia> RR = ArbField(128);
 
 julia> x = RR(0.1);       # note: 53-bit binary approximation of 1//10 without radius
@@ -89,4 +89,4 @@
 Root 0.100000 of 36028797018963968x - 3602879701896397
 
 julia> guess(QQBar, x + RR("+/- 1e-10"), 1)
-Root 0.100000 of 10x - 1

Interface

Nemo.guessFunction
guess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)

Try to reconstruct an algebraic number from a given numerical enclosure x. The algorithm looks for candidates up to degree maxdeg and with coefficients up to size maxbits (which defaults to the precision of x if not given). Throws if no suitable algebraic number can be found.

Guessing typically requires high precision to succeed, and it does not make much sense to call this function with input precision smaller than $O(maxdeg \cdot maxbits)$. If this function succeeds, then the output is guaranteed to be contained in the enclosure x, but failure does not prove that such an algebraic number with the specified parameters does not exist.

This function does a single iteration with the target parameters. For best performance, one should invoke this function repeatedly with successively larger parameters when the size of the intended solution is unknown or may be much smaller than a worst-case bound.

source
Nemo.guessFunction
guess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)

Try to reconstruct an algebraic number from a given numerical enclosure x. The algorithm looks for candidates up to degree maxdeg and with coefficients up to size maxbits (which defaults to the precision of x if not given). Throws if no suitable algebraic number can be found.

Guessing typically requires high precision to succeed, and it does not make much sense to call this function with input precision smaller than $O(maxdeg \cdot maxbits)$. If this function succeeds, then the output is guaranteed to be contained in the enclosure x, but failure does not prove that such an algebraic number with the specified parameters does not exist.

This function does a single iteration with the target parameters. For best performance, one should invoke this function repeatedly with successively larger parameters when the size of the intended solution is unknown or may be much smaller than a worst-case bound.

source
+Root 0.100000 of 10x - 1

Interface

Nemo.guessFunction
guess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)

Try to reconstruct an algebraic number from a given numerical enclosure x. The algorithm looks for candidates up to degree maxdeg and with coefficients up to size maxbits (which defaults to the precision of x if not given). Throws if no suitable algebraic number can be found.

Guessing typically requires high precision to succeed, and it does not make much sense to call this function with input precision smaller than $O(maxdeg \cdot maxbits)$. If this function succeeds, then the output is guaranteed to be contained in the enclosure x, but failure does not prove that such an algebraic number with the specified parameters does not exist.

This function does a single iteration with the target parameters. For best performance, one should invoke this function repeatedly with successively larger parameters when the size of the intended solution is unknown or may be much smaller than a worst-case bound.

source
Nemo.guessFunction
guess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)

Try to reconstruct an algebraic number from a given numerical enclosure x. The algorithm looks for candidates up to degree maxdeg and with coefficients up to size maxbits (which defaults to the precision of x if not given). Throws if no suitable algebraic number can be found.

Guessing typically requires high precision to succeed, and it does not make much sense to call this function with input precision smaller than $O(maxdeg \cdot maxbits)$. If this function succeeds, then the output is guaranteed to be contained in the enclosure x, but failure does not prove that such an algebraic number with the specified parameters does not exist.

This function does a single iteration with the target parameters. For best performance, one should invoke this function repeatedly with successively larger parameters when the size of the intended solution is unknown or may be much smaller than a worst-case bound.

source
diff --git a/dev/arb/index.html b/dev/arb/index.html index a902c03aa..06919bb45 100644 --- a/dev/arb/index.html +++ b/dev/arb/index.html @@ -4,11 +4,11 @@ a = RR("0.25") b = RR("0.1 +/- 0.001") c = RR(0.5) -d = RR(12)

Note that whilst one can coerce double precision floating point values into an Arb real field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.

If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb field.

If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.

Real ball constructors

Nemo.ballMethod
ball(x::arb, y::arb)

Constructs an Arb ball enclosing $x_m \pm (|x_r| + |y_m| + |y_r|)$, given the pair $(x, y) = (x_m \pm x_r, y_m \pm y_r)$.

source

Examples

RR = ArbField(64)
+d = RR(12)

Note that whilst one can coerce double precision floating point values into an Arb real field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.

If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb field.

If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.

Real ball constructors

Nemo.ballMethod
ball(x::arb, y::arb)

Constructs an Arb ball enclosing $x_m \pm (|x_r| + |y_m| + |y_r|)$, given the pair $(x, y) = (x_m \pm x_r, y_m \pm y_r)$.

source

Examples

RR = ArbField(64)
 
 c = ball(RR(3), RR("0.0001"))

Conversions

RR = ArbField(64)
 
-convert(Float64, RR(1//3))

Basic manipulation

Nemo.is_nonzeroMethod
is_nonzero(x::arb)

Return true if $x$ is certainly not equal to zero, otherwise return false.

source
Base.isfiniteMethod
isfinite(x::arb)

Return true if $x$ is finite, i.e. having finite midpoint and radius, otherwise return false.

source
Nemo.is_exactMethod
is_exact(x::arb)

Return true if $x$ is exact, i.e. has zero radius, otherwise return false.

source
Base.isintegerMethod
isinteger(x::arb)

Return true if $x$ is an exact integer, otherwise return false.

source
Nemo.is_positiveMethod
is_positive(x::arb)

Return true if $x$ is certainly positive, otherwise return false.

source
Nemo.is_nonnegativeMethod
is_nonnegative(x::arb)

Return true if $x$ is certainly nonnegative, otherwise return false.

source
AbstractAlgebra.is_negativeMethod
is_negative(x::arb)

Return true if $x$ is certainly negative, otherwise return false.

source
Nemo.is_nonpositiveMethod
is_nonpositive(x::arb)

Return true if $x$ is certainly nonpositive, otherwise return false.

source
Nemo.midpointMethod
midpoint(x::arb)

Return the midpoint of the ball $x$ as an Arb ball.

source
Nemo.radiusMethod
radius(x::arb)

Return the radius of the ball $x$ as an Arb ball.

source
Nemo.accuracy_bitsMethod
accuracy_bits(x::arb)

Return the relative accuracy of $x$ measured in bits, capped between typemax(Int) and -typemax(Int).

source

Examples

RR = ArbField(64)
+convert(Float64, RR(1//3))

Basic manipulation

Nemo.is_nonzeroMethod
is_nonzero(x::arb)

Return true if $x$ is certainly not equal to zero, otherwise return false.

source
Base.isfiniteMethod
isfinite(x::arb)

Return true if $x$ is finite, i.e. having finite midpoint and radius, otherwise return false.

source
Nemo.is_exactMethod
is_exact(x::arb)

Return true if $x$ is exact, i.e. has zero radius, otherwise return false.

source
Base.isintegerMethod
isinteger(x::arb)

Return true if $x$ is an exact integer, otherwise return false.

source
Nemo.is_positiveMethod
is_positive(x::arb)

Return true if $x$ is certainly positive, otherwise return false.

source
Nemo.is_nonnegativeMethod
is_nonnegative(x::arb)

Return true if $x$ is certainly nonnegative, otherwise return false.

source
AbstractAlgebra.is_negativeMethod
is_negative(x::arb)

Return true if $x$ is certainly negative, otherwise return false.

source
Nemo.is_nonpositiveMethod
is_nonpositive(x::arb)

Return true if $x$ is certainly nonpositive, otherwise return false.

source
Nemo.midpointMethod
midpoint(x::arb)

Return the midpoint of the ball $x$ as an Arb ball.

source
Nemo.radiusMethod
radius(x::arb)

Return the radius of the ball $x$ as an Arb ball.

source
Nemo.accuracy_bitsMethod
accuracy_bits(x::arb)

Return the relative accuracy of $x$ measured in bits, capped between typemax(Int) and -typemax(Int).

source

Examples

RR = ArbField(64)
 
 a = RR("1.2 +/- 0.001")
 b = RR(3)
@@ -34,7 +34,7 @@
 print(x, "\n", y, "\n", mid, "\n", rad)

which generates

[+/- 3.01]
 [1e+1 +/- 4.01]
 1.0000000000000000000
-[2.0000000037252902985 +/- 3.81e-20]

The first reason that c is not printed as [1 +/- 2] is that the midpoint does not have a greater exponent than the radius in its scientific notation. For similar reasons y is not printed as [12 +/- 2].

The second reason is that we get an additional error term after our addition. As we see, radius(c) is not equal to $2$, which when printed rounds it up to a reasonable decimal place. This is because real balls keep track of rounding errors of basic arithmetic.

Containment

It is often necessary to determine whether a given exact value or ball is contained in a given real ball or whether two balls overlap. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::arb, y::arb)

Returns true if any part of the ball $x$ overlaps any part of the ball $y$, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::arb)

Returns true if the ball $x$ contains the ball $y$, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::Integer)

Returns true if the ball $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::ZZRingElem)

Returns true if the ball $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::QQFieldElem)

Returns true if the ball $x$ contains the given rational value, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::Rational{T}) where {T <: Integer}

Returns true if the ball $x$ contains the given rational value, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::BigFloat)

Returns true if the ball $x$ contains the given floating point value, otherwise return false.

source

The following functions are also provided for determining if a ball intersects a certain part of the real number line.

Nemo.contains_zeroMethod
contains_zero(x::arb)

Returns true if the ball $x$ contains zero, otherwise return false.

source
Nemo.contains_negativeMethod
contains_negative(x::arb)

Returns true if the ball $x$ contains any negative value, otherwise return false.

source
Nemo.contains_positiveMethod
contains_positive(x::arb)

Returns true if the ball $x$ contains any positive value, otherwise return false.

source
Nemo.contains_nonnegativeMethod
contains_nonnegative(x::arb)

Returns true if the ball $x$ contains any nonnegative value, otherwise return false.

source
Nemo.contains_nonpositiveMethod
contains_nonpositive(x::arb)

Returns true if the ball $x$ contains any nonpositive value, otherwise return false.

source

Examples

RR = ArbField(64)
+[2.0000000037252902985 +/- 3.81e-20]

The first reason that c is not printed as [1 +/- 2] is that the midpoint does not have a greater exponent than the radius in its scientific notation. For similar reasons y is not printed as [12 +/- 2].

The second reason is that we get an additional error term after our addition. As we see, radius(c) is not equal to $2$, which when printed rounds it up to a reasonable decimal place. This is because real balls keep track of rounding errors of basic arithmetic.

Containment

It is often necessary to determine whether a given exact value or ball is contained in a given real ball or whether two balls overlap. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::arb, y::arb)

Returns true if any part of the ball $x$ overlaps any part of the ball $y$, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::arb)

Returns true if the ball $x$ contains the ball $y$, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::Integer)

Returns true if the ball $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::ZZRingElem)

Returns true if the ball $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::QQFieldElem)

Returns true if the ball $x$ contains the given rational value, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::Rational{T}) where {T <: Integer}

Returns true if the ball $x$ contains the given rational value, otherwise return false.

source
Base.containsMethod
contains(x::arb, y::BigFloat)

Returns true if the ball $x$ contains the given floating point value, otherwise return false.

source

The following functions are also provided for determining if a ball intersects a certain part of the real number line.

Nemo.contains_zeroMethod
contains_zero(x::arb)

Returns true if the ball $x$ contains zero, otherwise return false.

source
Nemo.contains_negativeMethod
contains_negative(x::arb)

Returns true if the ball $x$ contains any negative value, otherwise return false.

source
Nemo.contains_positiveMethod
contains_positive(x::arb)

Returns true if the ball $x$ contains any positive value, otherwise return false.

source
Nemo.contains_nonnegativeMethod
contains_nonnegative(x::arb)

Returns true if the ball $x$ contains any nonnegative value, otherwise return false.

source
Nemo.contains_nonpositiveMethod
contains_nonpositive(x::arb)

Returns true if the ball $x$ contains any nonpositive value, otherwise return false.

source

Examples

RR = ArbField(64)
 x = RR("1 +/- 0.001")
 y = RR("3")
 
@@ -43,7 +43,7 @@
 contains(y, 3)
 contains(x, ZZ(1)//2)
 contains_zero(x)
-contains_positive(y)

Comparison

Nemo provides a full range of comparison operations for Arb balls. Note that a ball is considered less than another ball if every value in the first ball is less than every value in the second ball, etc.

In addition to the standard comparison operators, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.

Base.isequalMethod
isequal(x::arb, y::arb)

Return true if the balls $x$ and $y$ are precisely equal, i.e. have the same midpoints and radii.

source

We also provide a full range of ad hoc comparison operators. These are implemented directly in Julia, but we document them as though isless and == were provided.

Function
==(x::arb, y::Integer)
==(x::Integer, y::arb)
==(x::arb, y::ZZRingElem)
==(x::ZZRingElem, y::arb)
==(x::arb, y::Float64)
==(x::Float64, y::arb)
isless(x::arb, y::Integer)
isless(x::Integer, y::arb)
isless(x::arb, y::ZZRingElem)
isless(x::ZZRingElem, y::arb)
isless(x::arb, y::Float64)
isless(x::Float64, y::arb)
isless(x::arb, y::BigFloat)
isless(x::BigFloat, y::arb)
isless(x::arb, y::QQFieldElem)
isless(x::QQFieldElem, y::arb)

Examples

RR = ArbField(64)
+contains_positive(y)

Comparison

Nemo provides a full range of comparison operations for Arb balls. Note that a ball is considered less than another ball if every value in the first ball is less than every value in the second ball, etc.

In addition to the standard comparison operators, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.

Base.isequalMethod
isequal(x::arb, y::arb)

Return true if the balls $x$ and $y$ are precisely equal, i.e. have the same midpoints and radii.

source

We also provide a full range of ad hoc comparison operators. These are implemented directly in Julia, but we document them as though isless and == were provided.

Function
==(x::arb, y::Integer)
==(x::Integer, y::arb)
==(x::arb, y::ZZRingElem)
==(x::ZZRingElem, y::arb)
==(x::arb, y::Float64)
==(x::Float64, y::arb)
isless(x::arb, y::Integer)
isless(x::Integer, y::arb)
isless(x::arb, y::ZZRingElem)
isless(x::ZZRingElem, y::arb)
isless(x::arb, y::Float64)
isless(x::Float64, y::arb)
isless(x::arb, y::BigFloat)
isless(x::BigFloat, y::arb)
isless(x::arb, y::QQFieldElem)
isless(x::QQFieldElem, y::arb)

Examples

RR = ArbField(64)
 x = RR("1 +/- 0.001")
 y = RR("3")
 z = RR("4")
@@ -58,18 +58,18 @@
 x = RR("-3 +/- 0.001")
 
 a = ldexp(x, 23)
-b = ldexp(x, -ZZ(15))

Miscellaneous operations

Nemo.add_error!Method
add_error!(x::arb, y::arb)

Adds the absolute values of the midpoint and radius of $y$ to the radius of $x$.

source
Nemo.trimMethod
trim(x::arb)

Return an arb interval containing $x$ but which may be more economical, by rounding off insignificant bits from the midpoint.

source
Nemo.unique_integerMethod
unique_integer(x::arb)

Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the interval $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.

source
Nemo.setunionMethod
setunion(x::arb, y::arb)

Return an arb containing the union of the intervals represented by $x$ and $y$.

source

Examples

RR = ArbField(64)
+b = ldexp(x, -ZZ(15))

Miscellaneous operations

Nemo.add_error!Method
add_error!(x::arb, y::arb)

Adds the absolute values of the midpoint and radius of $y$ to the radius of $x$.

source
Nemo.trimMethod
trim(x::arb)

Return an arb interval containing $x$ but which may be more economical, by rounding off insignificant bits from the midpoint.

source
Nemo.unique_integerMethod
unique_integer(x::arb)

Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the interval $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.

source
Nemo.setunionMethod
setunion(x::arb, y::arb)

Return an arb containing the union of the intervals represented by $x$ and $y$.

source

Examples

RR = ArbField(64)
 x = RR("-3 +/- 0.001")
 y = RR("2 +/- 0.5")
 
 a = trim(x)
 b, c = unique_integer(x)
-d = setunion(x, y)

Constants

Nemo.const_piMethod
const_pi(r::ArbField)

Return $\pi = 3.14159\ldots$ as an element of $r$.

source
Nemo.const_eMethod
const_e(r::ArbField)

Return $e = 2.71828\ldots$ as an element of $r$.

source
Nemo.const_log2Method
const_log2(r::ArbField)

Return $\log(2) = 0.69314\ldots$ as an element of $r$.

source
Nemo.const_log10Method
const_log10(r::ArbField)

Return $\log(10) = 2.302585\ldots$ as an element of $r$.

source
Nemo.const_eulerMethod
const_euler(r::ArbField)

Return Euler's constant $\gamma = 0.577215\ldots$ as an element of $r$.

source
Nemo.const_catalanMethod
const_catalan(r::ArbField)

Return Catalan's constant $C = 0.915965\ldots$ as an element of $r$.

source
Nemo.const_khinchinMethod
const_khinchin(r::ArbField)

Return Khinchin's constant $K = 2.685452\ldots$ as an element of $r$.

source
Nemo.const_glaisherMethod
const_glaisher(r::ArbField)

Return Glaisher's constant $A = 1.282427\ldots$ as an element of $r$.

source

Examples

RR = ArbField(200)
+d = setunion(x, y)

Constants

Nemo.const_piMethod
const_pi(r::ArbField)

Return $\pi = 3.14159\ldots$ as an element of $r$.

source
Nemo.const_eMethod
const_e(r::ArbField)

Return $e = 2.71828\ldots$ as an element of $r$.

source
Nemo.const_log2Method
const_log2(r::ArbField)

Return $\log(2) = 0.69314\ldots$ as an element of $r$.

source
Nemo.const_log10Method
const_log10(r::ArbField)

Return $\log(10) = 2.302585\ldots$ as an element of $r$.

source
Nemo.const_eulerMethod
const_euler(r::ArbField)

Return Euler's constant $\gamma = 0.577215\ldots$ as an element of $r$.

source
Nemo.const_catalanMethod
const_catalan(r::ArbField)

Return Catalan's constant $C = 0.915965\ldots$ as an element of $r$.

source
Nemo.const_khinchinMethod
const_khinchin(r::ArbField)

Return Khinchin's constant $K = 2.685452\ldots$ as an element of $r$.

source
Nemo.const_glaisherMethod
const_glaisher(r::ArbField)

Return Glaisher's constant $A = 1.282427\ldots$ as an element of $r$.

source

Examples

RR = ArbField(200)
 
 a = const_pi(RR)
 b = const_e(RR)
 c = const_euler(RR)
-d = const_glaisher(RR)

Mathematical and special functions

Nemo.rsqrtMethod
rsqrt(x::arb)

Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$.

source
Nemo.sqrt1pm1Method
sqrt1pm1(x::arb)

Return $\sqrt{1+x}-1$, evaluated accurately for small $x$.

source
Nemo.sqrtposMethod
sqrtpos(x::arb)

Return the sqrt root of $x$, assuming that $x$ represents a nonnegative number. Thus any negative number in the input interval is discarded.

source
Nemo.gammaMethod
gamma(x::arb)

Return the Gamma function evaluated at $x$.

source
Nemo.lgammaMethod
lgamma(x::arb)

Return the logarithm of the Gamma function evaluated at $x$.

source
Nemo.rgammaMethod
rgamma(x::arb)

Return the reciprocal of the Gamma function evaluated at $x$.

source
Nemo.digammaMethod
digamma(x::arb)

Return the logarithmic derivative of the gamma function evaluated at $x$, i.e. $\psi(x)$.

source
Nemo.gammaMethod
gamma(s::arb, x::arb)

Return the upper incomplete gamma function $\Gamma(s,x)$.

source
Nemo.gamma_regularizedMethod
gamma_regularized(s::arb, x::arb)

Return the regularized upper incomplete gamma function $\Gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lowerMethod
gamma_lower(s::arb, x::arb)

Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lower_regularizedMethod
gamma_lower_regularized(s::arb, x::arb)

Return the regularized lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.zetaMethod
zeta(x::arb)

Return the Riemann zeta function evaluated at $x$.

source
Nemo.atan2Method
atan2(y::arb, x::arb)

Return $\operatorname{atan2}(y,x) = \arg(x+yi)$. Same as atan(y, x).

source
Nemo.agmMethod
agm(x::arb, y::arb)

Return the arithmetic-geometric mean of $x$ and $y$

source
Nemo.zetaMethod
zeta(s::arb, a::arb)

Return the Hurwitz zeta function $\zeta(s,a)$.

source
AbstractAlgebra.rootMethod
root(x::arb, n::Int)

Return the $n$-th root of $x$. We require $x \geq 0$.

source
Base.factorialMethod
factorial(x::arb)

Return the factorial of $x$.

source
Base.factorialMethod
factorial(n::Int, r::ArbField)

Return the factorial of $n$ in the given Arb field.

source
Base.binomialMethod
binomial(x::arb, n::UInt)

Return the binomial coefficient ${x \choose n}$.

source
Base.binomialMethod
binomial(n::UInt, k::UInt, r::ArbField)

Return the binomial coefficient ${n \choose k}$ in the given Arb field.

source
Nemo.fibonacciMethod
fibonacci(n::ZZRingElem, r::ArbField)

Return the $n$-th Fibonacci number in the given Arb field.

source
Nemo.fibonacciMethod
fibonacci(n::Int, r::ArbField)

Return the $n$-th Fibonacci number in the given Arb field.

source
Nemo.gammaMethod
gamma(x::ZZRingElem, r::ArbField)

Return the Gamma function evaluated at $x$ in the given Arb field.

source
Nemo.gammaMethod
gamma(x::QQFieldElem, r::ArbField)

Return the Gamma function evaluated at $x$ in the given Arb field.

source
Nemo.zetaMethod
zeta(n::Int, r::ArbField)

Return the Riemann zeta function $\zeta(n)$ as an element of the given Arb field.

source
Nemo.bernoulliMethod
bernoulli(n::Int, r::ArbField)

Return the $n$-th Bernoulli number as an element of the given Arb field.

source
Nemo.rising_factorialMethod
rising_factorial(x::arb, n::Int)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an Arb.

source
Nemo.rising_factorialMethod
rising_factorial(x::QQFieldElem, n::Int, r::ArbField)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an element of the given Arb field.

source
Nemo.rising_factorial2Method
rising_factorial2(x::arb, n::Int)

Return a tuple containing the rising factorial $x(x + 1)\ldots (x + n - 1)$ and its derivative.

source
Nemo.polylogMethod
polylog(s::Union{arb,Int}, a::arb)

Return the polylogarithm Li$_s(a)$.

source
AbstractAlgebra.chebyshev_tMethod
chebyshev_t(n::Int, x::arb)

Return the value of the Chebyshev polynomial $T_n(x)$.

source
AbstractAlgebra.chebyshev_uMethod
chebyshev_u(n::Int, x::arb)

Return the value of the Chebyshev polynomial $U_n(x)$.

source
Nemo.chebyshev_t2Method
chebyshev_t2(n::Int, x::arb)

Return the tuple $(T_{n}(x), T_{n-1}(x))$.

source
Nemo.chebyshev_u2Method
chebyshev_u2(n::Int, x::arb)

Return the tuple $(U_{n}(x), U_{n-1}(x))$

source
Nemo.bellMethod
bell(n::ZZRingElem, r::ArbField)

Return the Bell number $B_n$ as an element of $r$.

source
Nemo.bellMethod
bell(n::Int, r::ArbField)

Return the Bell number $B_n$ as an element of $r$.

source
Nemo.numpartMethod
numpart(n::ZZRingElem, r::ArbField)

Return the number of partitions $p(n)$ as an element of $r$.

source
Nemo.numpartMethod
numpart(n::Int, r::ArbField)

Return the number of partitions $p(n)$ as an element of $r$.

source
Nemo.airy_aiMethod
airy_ai(x::arb)

Return the Airy function $\operatorname{Ai}(x)$.

source
Nemo.airy_ai_primeMethod
airy_ai_prime(x::arb)

Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$.

source
Nemo.airy_biMethod
airy_bi(x::arb)

Return the Airy function $\operatorname{Bi}(x)$.

source
Nemo.airy_bi_primeMethod
airy_bi_prime(x::arb)

Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$.

source

Examples

RR = ArbField(64)
+d = const_glaisher(RR)

Mathematical and special functions

Nemo.rsqrtMethod
rsqrt(x::arb)

Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$.

source
Nemo.sqrt1pm1Method
sqrt1pm1(x::arb)

Return $\sqrt{1+x}-1$, evaluated accurately for small $x$.

source
Nemo.sqrtposMethod
sqrtpos(x::arb)

Return the sqrt root of $x$, assuming that $x$ represents a nonnegative number. Thus any negative number in the input interval is discarded.

source
Nemo.gammaMethod
gamma(x::arb)

Return the Gamma function evaluated at $x$.

source
Nemo.lgammaMethod
lgamma(x::arb)

Return the logarithm of the Gamma function evaluated at $x$.

source
Nemo.rgammaMethod
rgamma(x::arb)

Return the reciprocal of the Gamma function evaluated at $x$.

source
Nemo.digammaMethod
digamma(x::arb)

Return the logarithmic derivative of the gamma function evaluated at $x$, i.e. $\psi(x)$.

source
Nemo.gammaMethod
gamma(s::arb, x::arb)

Return the upper incomplete gamma function $\Gamma(s,x)$.

source
Nemo.gamma_regularizedMethod
gamma_regularized(s::arb, x::arb)

Return the regularized upper incomplete gamma function $\Gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lowerMethod
gamma_lower(s::arb, x::arb)

Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lower_regularizedMethod
gamma_lower_regularized(s::arb, x::arb)

Return the regularized lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.zetaMethod
zeta(x::arb)

Return the Riemann zeta function evaluated at $x$.

source
Nemo.atan2Method
atan2(y::arb, x::arb)

Return $\operatorname{atan2}(y,x) = \arg(x+yi)$. Same as atan(y, x).

source
Nemo.agmMethod
agm(x::arb, y::arb)

Return the arithmetic-geometric mean of $x$ and $y$

source
Nemo.zetaMethod
zeta(s::arb, a::arb)

Return the Hurwitz zeta function $\zeta(s,a)$.

source
AbstractAlgebra.rootMethod
root(x::arb, n::Int)

Return the $n$-th root of $x$. We require $x \geq 0$.

source
Base.factorialMethod
factorial(x::arb)

Return the factorial of $x$.

source
Base.factorialMethod
factorial(n::Int, r::ArbField)

Return the factorial of $n$ in the given Arb field.

source
Base.binomialMethod
binomial(x::arb, n::UInt)

Return the binomial coefficient ${x \choose n}$.

source
Base.binomialMethod
binomial(n::UInt, k::UInt, r::ArbField)

Return the binomial coefficient ${n \choose k}$ in the given Arb field.

source
Nemo.fibonacciMethod
fibonacci(n::ZZRingElem, r::ArbField)

Return the $n$-th Fibonacci number in the given Arb field.

source
Nemo.fibonacciMethod
fibonacci(n::Int, r::ArbField)

Return the $n$-th Fibonacci number in the given Arb field.

source
Nemo.gammaMethod
gamma(x::ZZRingElem, r::ArbField)

Return the Gamma function evaluated at $x$ in the given Arb field.

source
Nemo.gammaMethod
gamma(x::QQFieldElem, r::ArbField)

Return the Gamma function evaluated at $x$ in the given Arb field.

source
Nemo.zetaMethod
zeta(n::Int, r::ArbField)

Return the Riemann zeta function $\zeta(n)$ as an element of the given Arb field.

source
Nemo.bernoulliMethod
bernoulli(n::Int, r::ArbField)

Return the $n$-th Bernoulli number as an element of the given Arb field.

source
Nemo.rising_factorialMethod
rising_factorial(x::arb, n::Int)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an Arb.

source
Nemo.rising_factorialMethod
rising_factorial(x::QQFieldElem, n::Int, r::ArbField)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an element of the given Arb field.

source
Nemo.rising_factorial2Method
rising_factorial2(x::arb, n::Int)

Return a tuple containing the rising factorial $x(x + 1)\ldots (x + n - 1)$ and its derivative.

source
Nemo.polylogMethod
polylog(s::Union{arb,Int}, a::arb)

Return the polylogarithm Li$_s(a)$.

source
AbstractAlgebra.chebyshev_tMethod
chebyshev_t(n::Int, x::arb)

Return the value of the Chebyshev polynomial $T_n(x)$.

source
AbstractAlgebra.chebyshev_uMethod
chebyshev_u(n::Int, x::arb)

Return the value of the Chebyshev polynomial $U_n(x)$.

source
Nemo.chebyshev_t2Method
chebyshev_t2(n::Int, x::arb)

Return the tuple $(T_{n}(x), T_{n-1}(x))$.

source
Nemo.chebyshev_u2Method
chebyshev_u2(n::Int, x::arb)

Return the tuple $(U_{n}(x), U_{n-1}(x))$

source
Nemo.bellMethod
bell(n::ZZRingElem, r::ArbField)

Return the Bell number $B_n$ as an element of $r$.

source
Nemo.bellMethod
bell(n::Int, r::ArbField)

Return the Bell number $B_n$ as an element of $r$.

source
Nemo.numpartMethod
numpart(n::ZZRingElem, r::ArbField)

Return the number of partitions $p(n)$ as an element of $r$.

source
Nemo.numpartMethod
numpart(n::Int, r::ArbField)

Return the number of partitions $p(n)$ as an element of $r$.

source
Nemo.airy_aiMethod
airy_ai(x::arb)

Return the Airy function $\operatorname{Ai}(x)$.

source
Nemo.airy_ai_primeMethod
airy_ai_prime(x::arb)

Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$.

source
Nemo.airy_biMethod
airy_bi(x::arb)

Return the Airy function $\operatorname{Bi}(x)$.

source
Nemo.airy_bi_primeMethod
airy_bi_prime(x::arb)

Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$.

source

Examples

RR = ArbField(64)
 
 a = floor(exp(RR(1)))
 b = sinpi(QQ(5,6), RR)
@@ -97,7 +97,7 @@
  0
  0
  0
- 1
source

Examples

RR = ArbField(128)
+ 1
source

Examples

RR = ArbField(128)
 
 a = RR(-0.33198902958450931620250069492231652319)
 
@@ -106,10 +106,10 @@
 Real Field with 64 bits of precision and error bounds
 
 julia> simplest_rational_inside(const_pi(RR))
-8717442233//2774848045
source

Examples

RR = ArbField(64)
-simplest_rational_inside(const_pi(RR))

Random generation

Base.randMethod
rand(r::ArbField; randtype::Symbol=:urandom)

Return a random element in given Arb field.

The randtype default is :urandom which return an arb contained in $[0,1]$.

The rest of the methods return non-uniformly distributed values in order to exercise corner cases. The option :randtest will return a finite number, and :randtest_exact the same but with a zero radius. The option :randtest_precise return an arb with a radius around $2^{-\mathrm{prec}}$ the magnitude of the midpoint, while :randtest_wide return a radius that might be big relative to its midpoint. The :randtest_special-option might return a midpoint and radius whose values are NaN or inf.

source

Examples

RR = ArbField(100)
+8717442233//2774848045
source

Examples

RR = ArbField(64)
+simplest_rational_inside(const_pi(RR))

Random generation

Base.randMethod
rand(r::ArbField; randtype::Symbol=:urandom)

Return a random element in given Arb field.

The randtype default is :urandom which return an arb contained in $[0,1]$.

The rest of the methods return non-uniformly distributed values in order to exercise corner cases. The option :randtest will return a finite number, and :randtest_exact the same but with a zero radius. The option :randtest_precise return an arb with a radius around $2^{-\mathrm{prec}}$ the magnitude of the midpoint, while :randtest_wide return a radius that might be big relative to its midpoint. The :randtest_special-option might return a midpoint and radius whose values are NaN or inf.

source

Examples

RR = ArbField(100)
 
 a = rand(RR)
 b = rand(RR; randtype = :null_exact)
 c = rand(RR; randtype = :exact)
-d = rand(RR; randtype = :special)
+d = rand(RR; randtype = :special) diff --git a/dev/complex/index.html b/dev/complex/index.html index 880276c16..acff64fa8 100644 --- a/dev/complex/index.html +++ b/dev/complex/index.html @@ -4,7 +4,7 @@ a = CC("0.25") b = CC("0.1") c = CC(0.5) -d = CC(12)

Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.

If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.

If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.

Constructors

Nemo.oneiMethod
onei(r::ComplexField)

Return exact one times $i$ in the given Arb complex field.

source

Examples

CC = ComplexField(64)
+d = CC(12)

Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.

If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.

If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.

Constructors

Nemo.oneiMethod
onei(r::ComplexField)

Return exact one times $i$ in the given Arb complex field.

source

Examples

CC = ComplexField(64)
 
 c = onei(CC)

Basic functionality

The following basic functionality is provided by the default Arb complex field implementation in Nemo, to support construction of generic rings over complex fields. Any custom complex field implementation in Nemo should provide analogues of these functions along with the usual arithmetic operations.

parent_type(::Type{ComplexFieldElem})

Gives the type of the parent object of an Arb complex field element.

elem_type(R::ComplexField)

Given the parent object for an Arb complex field, return the type of elements of the field.

mul!(c::ComplexFieldElem, a::ComplexFieldElem, b::ComplexFieldElem)

Multiply $a$ by $b$ and set the existing Arb complex field element $c$ to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.

addeq!(c::ComplexFieldElem, a::ComplexFieldElem)

In-place addition adds $a$ to $c$ and sets $c$ to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.

deepcopy(a::ComplexFieldElem)

Return a copy of the Arb complex field element $a$, recursively copying the internal data. Arb complex field elements are mutable in Nemo so a shallow copy is not sufficient.

Given the parent object R for an Arb complex field, the following coercion functions are provided to coerce various elements into the Arb complex field. Developers provide these by overloading the call operator for the complex field parent objects.

R()

Coerce zero into the Arb complex field.

R(n::Integer)
 R(f::ZZRingElem)
@@ -18,7 +18,7 @@
 c = CC("3 +/- 0.0001")
 d = CC("-1.24e+12345")
 f = CC("nan +/- inf")
-g = CC(RR(3))

In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::ComplexField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::ComplexFieldElem) to return the parent object of a complex field element.

Basic manipulation

Base.isfiniteMethod
isfinite(x::ComplexFieldElem)

Return true if $x$ is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return false.

source
Nemo.is_exactMethod
is_exact(x::ComplexFieldElem)

Return true if $x$ is exact, i.e. has its real and imaginary parts have zero radius, otherwise return false.

source
Base.isintegerMethod
isinteger(x::ComplexFieldElem)

Return true if $x$ is an exact integer, otherwise return false.

source
Nemo.accuracy_bitsMethod
accuracy_bits(x::ComplexFieldElem)

Return the relative accuracy of $x$ measured in bits, capped between typemax(Int) and -typemax(Int).

source

Examples

CC = ComplexField(64)
+g = CC(RR(3))

In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::ComplexField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::ComplexFieldElem) to return the parent object of a complex field element.

Basic manipulation

Base.isfiniteMethod
isfinite(x::ComplexFieldElem)

Return true if $x$ is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return false.

source
Nemo.is_exactMethod
is_exact(x::ComplexFieldElem)

Return true if $x$ is exact, i.e. has its real and imaginary parts have zero radius, otherwise return false.

source
Base.isintegerMethod
isinteger(x::ComplexFieldElem)

Return true if $x$ is an exact integer, otherwise return false.

source
Nemo.accuracy_bitsMethod
accuracy_bits(x::ComplexFieldElem)

Return the relative accuracy of $x$ measured in bits, capped between typemax(Int) and -typemax(Int).

source

Examples

CC = ComplexField(64)
 
 a = CC("1.2 +/- 0.001")
 b = CC(3)
@@ -28,7 +28,7 @@
 isinteger(b)
 c = real(a)
 d = imag(b)
-f = accuracy_bits(a)

Containment

It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::ComplexFieldElem, y::ComplexFieldElem)

Returns true if any part of the box $x$ overlaps any part of the box $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexFieldElem, y::ComplexFieldElem)

Returns true if the box $x$ contains the box $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexFieldElem, y::Integer)

Returns true if the box $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::ComplexFieldElem, y::ZZRingElem)

Returns true if the box $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::ComplexFieldElem, y::QQFieldElem)

Returns true if the box $x$ contains the given rational value, otherwise return false.

source

The following functions are also provided for determining if a box intersects a certain part of the complex number plane.

Nemo.contains_zeroMethod
contains_zero(x::ComplexFieldElem)

Returns true if the box $x$ contains zero, otherwise return false.

source

Examples

CC = ComplexField(64)
+f = accuracy_bits(a)

Containment

It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::ComplexFieldElem, y::ComplexFieldElem)

Returns true if any part of the box $x$ overlaps any part of the box $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexFieldElem, y::ComplexFieldElem)

Returns true if the box $x$ contains the box $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexFieldElem, y::Integer)

Returns true if the box $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::ComplexFieldElem, y::ZZRingElem)

Returns true if the box $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::ComplexFieldElem, y::QQFieldElem)

Returns true if the box $x$ contains the given rational value, otherwise return false.

source

The following functions are also provided for determining if a box intersects a certain part of the complex number plane.

Nemo.contains_zeroMethod
contains_zero(x::ComplexFieldElem)

Returns true if the box $x$ contains zero, otherwise return false.

source

Examples

CC = ComplexField(64)
 x = CC("1 +/- 0.001")
 y = CC("3")
 
@@ -36,7 +36,7 @@
 contains(x, y)
 contains(y, 3)
 contains(x, ZZ(1)//2)
-contains_zero(x)

Comparison

Nemo provides a full range of comparison operations for Arb complex boxes.

In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.

Base.isequalMethod
isequal(x::ComplexFieldElem, y::ComplexFieldElem)

Return true if the boxes $x$ and $y$ are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii.

source

A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.

Function
==(x::ComplexFieldElem, y::Integer)
==(x::Integer, y::ComplexFieldElem)
==(x::ComplexFieldElem, y::ZZRingElem)
==(x::ZZRingElem, y::ComplexFieldElem)
==(x::arb, y::ZZRingElem)
==(x::ZZRingElem, y::arb)
==(x::ComplexFieldElem, y::Float64)
==(x::Float64, y::ComplexFieldElem)

Examples

CC = ComplexField(64)
+contains_zero(x)

Comparison

Nemo provides a full range of comparison operations for Arb complex boxes.

In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.

Base.isequalMethod
isequal(x::ComplexFieldElem, y::ComplexFieldElem)

Return true if the boxes $x$ and $y$ are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii.

source

A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.

Function
==(x::ComplexFieldElem, y::Integer)
==(x::Integer, y::ComplexFieldElem)
==(x::ComplexFieldElem, y::ZZRingElem)
==(x::ZZRingElem, y::ComplexFieldElem)
==(x::arb, y::ZZRingElem)
==(x::ZZRingElem, y::arb)
==(x::ComplexFieldElem, y::Float64)
==(x::Float64, y::ComplexFieldElem)

Examples

CC = ComplexField(64)
 x = CC("1 +/- 0.001")
 y = CC("3")
 z = CC("4")
@@ -51,15 +51,15 @@
 x = CC("-3 +/- 0.001")
 
 a = ldexp(x, 23)
-b = ldexp(x, -ZZ(15))

Miscellaneous operations

Nemo.trimMethod
trim(x::ComplexFieldElem)

Return an acb box containing $x$ but which may be more economical, by rounding off insignificant bits from midpoints.

source
Nemo.unique_integerMethod
unique_integer(x::ComplexFieldElem)

Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.

source

Examples

CC = ComplexField(64)
+b = ldexp(x, -ZZ(15))

Miscellaneous operations

Nemo.trimMethod
trim(x::ComplexFieldElem)

Return an acb box containing $x$ but which may be more economical, by rounding off insignificant bits from midpoints.

source
Nemo.unique_integerMethod
unique_integer(x::ComplexFieldElem)

Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.

source

Examples

CC = ComplexField(64)
 x = CC("-3 +/- 0.001", "0.1")
 
 a = trim(x)
 b, c = unique_integer(x)
 d = conj(x)
-f = angle(x)

Constants

Nemo.const_piMethod
const_pi(r::ComplexField)

Return $\pi = 3.14159\ldots$ as an element of $r$.

source

Examples

CC = ComplexField(200)
+f = angle(x)

Constants

Nemo.const_piMethod
const_pi(r::ComplexField)

Return $\pi = 3.14159\ldots$ as an element of $r$.

source

Examples

CC = ComplexField(200)
 
-a = const_pi(CC)

Mathematical and special functions

Nemo.rsqrtMethod
rsqrt(x::ComplexFieldElem)

Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$.

source
Base.cispiMethod
cispi(x::ComplexFieldElem)

Return the exponential of $\pi i x$.

source
Nemo.root_of_unityMethod
root_of_unity(C::ComplexField, k::Int)

Return $\exp(2\pi i/k)$.

source
Nemo.log_sinpiMethod
log_sinpi(x::ComplexFieldElem)

Return $\log\sin(\pi x)$, constructed without branch cuts off the real line.

source
Nemo.gammaMethod
gamma(x::ComplexFieldElem)

Return the Gamma function evaluated at $x$.

source
Nemo.lgammaMethod
lgamma(x::ComplexFieldElem)

Return the logarithm of the Gamma function evaluated at $x$.

source
Nemo.rgammaMethod
rgamma(x::ComplexFieldElem)

Return the reciprocal of the Gamma function evaluated at $x$.

source
Nemo.digammaMethod
digamma(x::ComplexFieldElem)

Return the logarithmic derivative of the gamma function evaluated at $x$, i.e. $\psi(x)$.

source
Nemo.zetaMethod
zeta(x::ComplexFieldElem)

Return the Riemann zeta function evaluated at $x$.

source
Nemo.barnes_gMethod
barnes_g(x::ComplexFieldElem)

Return the Barnes $G$-function, evaluated at $x$.

source
Nemo.log_barnes_gMethod
log_barnes_g(x::ComplexFieldElem)

Return the logarithm of the Barnes $G$-function, evaluated at $x$.

source
Nemo.erfMethod
erf(x::ComplexFieldElem)

Return the error function evaluated at $x$.

source
Nemo.erfiMethod
erfi(x::ComplexFieldElem)

Return the imaginary error function evaluated at $x$.

source
Nemo.exp_integral_eiMethod
exp_integral_ei(x::ComplexFieldElem)

Return the exponential integral evaluated at $x$.

source
Nemo.sin_integralMethod
sin_integral(x::ComplexFieldElem)

Return the sine integral evaluated at $x$.

source
Nemo.cos_integralMethod
cos_integral(x::ComplexFieldElem)

Return the exponential cosine integral evaluated at $x$.

source
Nemo.sinh_integralMethod
sinh_integral(x::ComplexFieldElem)

Return the hyperbolic sine integral evaluated at $x$.

source
Nemo.cosh_integralMethod
cosh_integral(x::ComplexFieldElem)

Return the hyperbolic cosine integral evaluated at $x$.

source
Nemo.dedekind_etaMethod
dedekind_eta(x::ComplexFieldElem)

Return the Dedekind eta function $\eta(\tau)$ at $\tau = x$.

source
Nemo.modular_weber_fMethod
modular_weber_f(x::ComplexFieldElem)

Return the modular Weber function $\mathfrak{f}(\tau) = \frac{\eta^2(\tau)}{\eta(\tau/2)\eta(2\tau)},$ at $x$ in the complex upper half plane.

source
Nemo.modular_weber_f1Method
modular_weber_f1(x::ComplexFieldElem)

Return the modular Weber function $\mathfrak{f}_1(\tau) = \frac{\eta(\tau/2)}{\eta(\tau)},$ at $x$ in the complex upper half plane.

source
Nemo.modular_weber_f2Method
modular_weber_f2(x::ComplexFieldElem)

Return the modular Weber function $\mathfrak{f}_2(\tau) = \frac{\sqrt{2}\eta(2\tau)}{\eta(\tau)}$ at $x$ in the complex upper half plane.

source
Nemo.j_invariantMethod
j_invariant(x::ComplexFieldElem)

Return the $j$-invariant $j(\tau)$ at $\tau = x$.

source
Nemo.modular_lambdaMethod
modular_lambda(x::ComplexFieldElem)

Return the modular lambda function $\lambda(\tau)$ at $\tau = x$.

source
Nemo.modular_deltaMethod
modular_delta(x::ComplexFieldElem)

Return the modular delta function $\Delta(\tau)$ at $\tau = x$.

source
Nemo.eisenstein_gMethod
eisenstein_g(k::Int, x::ComplexFieldElem)

Return the non-normalized Eisenstein series $G_k(\tau)$ of $\mathrm{SL}_2(\mathbb{Z})$. Also defined for $\tau = i \infty$.

source
Nemo.hilbert_class_polynomialMethod
hilbert_class_polynomial(D::Int, R::ZZPolyRing)

Return in the ring $R$ the Hilbert class polynomial of discriminant $D$, which is only defined for $D < 0$ and $D \equiv 0, 1 \pmod 4$.

source
Nemo.elliptic_kMethod
elliptic_k(x::ComplexFieldElem)

Return the complete elliptic integral $K(x)$.

source
Nemo.elliptic_eMethod
elliptic_e(x::ComplexFieldElem)

Return the complete elliptic integral $E(x)$.

source
Nemo.agmMethod
agm(x::ComplexFieldElem)

Return the arithmetic-geometric mean of $1$ and $x$.

source
Nemo.agmMethod
agm(x::ComplexFieldElem, y::ComplexFieldElem)

Return the arithmetic-geometric mean of $x$ and $y$.

source
Nemo.polygammaMethod
polygamma(s::ComplexFieldElem, a::ComplexFieldElem)

Return the generalised polygamma function $\psi(s,z)$.

source
Nemo.zetaMethod
zeta(s::ComplexFieldElem, a::ComplexFieldElem)

Return the Hurwitz zeta function $\zeta(s,a)$.

source
Nemo.rising_factorialMethod
rising_factorial(x::ComplexFieldElem, n::Int)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an Acb.

source
Nemo.rising_factorial2Method
rising_factorial2(x::ComplexFieldElem, n::Int)

Return a tuple containing the rising factorial $x(x + 1)\ldots (x + n - 1)$ and its derivative.

source
Nemo.polylogMethod
polylog(s::Union{ComplexFieldElem,Int}, a::ComplexFieldElem)

Return the polylogarithm Li$_s(a)$.

source
Nemo.log_integralMethod
log_integral(x::ComplexFieldElem)

Return the logarithmic integral, evaluated at $x$.

source
Nemo.log_integral_offsetMethod
log_integral_offset(x::ComplexFieldElem)

Return the offset logarithmic integral, evaluated at $x$.

source
Nemo.exp_integral_eMethod
exp_integral_e(s::ComplexFieldElem, x::ComplexFieldElem)

Return the generalised exponential integral $E_s(x)$.

source
Nemo.gammaMethod
gamma(s::ComplexFieldElem, x::ComplexFieldElem)

Return the upper incomplete gamma function $\Gamma(s,x)$.

source
Nemo.gamma_regularizedMethod
gamma_regularized(s::ComplexFieldElem, x::ComplexFieldElem)

Return the regularized upper incomplete gamma function $\Gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lowerMethod
gamma_lower(s::ComplexFieldElem, x::ComplexFieldElem)

Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lower_regularizedMethod
gamma_lower_regularized(s::ComplexFieldElem, x::ComplexFieldElem)

Return the regularized lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.airy_aiMethod
airy_ai(x::ComplexFieldElem)

Return the Airy function $\operatorname{Ai}(x)$.

source
Nemo.airy_ai_primeMethod
airy_ai_prime(x::ComplexFieldElem)

Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$.

source
Nemo.airy_biMethod
airy_bi(x::ComplexFieldElem)

Return the Airy function $\operatorname{Bi}(x)$.

source
Nemo.airy_bi_primeMethod
airy_bi_prime(x::ComplexFieldElem)

Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$.

source
Nemo.bessel_jMethod
bessel_j(nu::ComplexFieldElem, x::ComplexFieldElem)

Return the Bessel function $J_{\nu}(x)$.

source
Nemo.bessel_yMethod
bessel_y(nu::ComplexFieldElem, x::ComplexFieldElem)

Return the Bessel function $Y_{\nu}(x)$.

source
Nemo.bessel_iMethod
bessel_i(nu::ComplexFieldElem, x::ComplexFieldElem)

Return the Bessel function $I_{\nu}(x)$.

source
Nemo.bessel_kMethod
bessel_k(nu::ComplexFieldElem, x::ComplexFieldElem)

Return the Bessel function $K_{\nu}(x)$.

source
Nemo.hypergeometric_1f1Method
hypergeometric_1f1(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)

Return the confluent hypergeometric function ${}_1F_1(a,b,x)$.

source
Nemo.hypergeometric_1f1_regularizedMethod
hypergeometric_1f1_regularized(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)

Return the regularized confluent hypergeometric function ${}_1F_1(a,b,x) / \Gamma(b)$.

source
Nemo.hypergeometric_uMethod
hypergeometric_u(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)

Return the confluent hypergeometric function $U(a,b,x)$.

source
Nemo.hypergeometric_2f1Method
hypergeometric_2f1(a::ComplexFieldElem, b::ComplexFieldElem, c::ComplexFieldElem, x::ComplexFieldElem; flags=0)

Return the Gauss hypergeometric function ${}_2F_1(a,b,c,x)$.

source
Nemo.jacobi_thetaMethod
jacobi_theta(z::ComplexFieldElem, tau::ComplexFieldElem)

Return a tuple of four elements containing the Jacobi theta function values $\theta_1, \theta_2, \theta_3, \theta_4$ evaluated at $z, \tau$.

source
Nemo.weierstrass_pMethod
weierstrass_p(z::ComplexFieldElem, tau::ComplexFieldElem)

Return the Weierstrass elliptic function $\wp(z,\tau)$.

source

Examples

CC = ComplexField(64)
+a = const_pi(CC)

Mathematical and special functions

Nemo.rsqrtMethod
rsqrt(x::ComplexFieldElem)

Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$.

source
Base.cispiMethod
cispi(x::ComplexFieldElem)

Return the exponential of $\pi i x$.

source
Nemo.root_of_unityMethod
root_of_unity(C::ComplexField, k::Int)

Return $\exp(2\pi i/k)$.

source
Nemo.log_sinpiMethod
log_sinpi(x::ComplexFieldElem)

Return $\log\sin(\pi x)$, constructed without branch cuts off the real line.

source
Nemo.gammaMethod
gamma(x::ComplexFieldElem)

Return the Gamma function evaluated at $x$.

source
Nemo.lgammaMethod
lgamma(x::ComplexFieldElem)

Return the logarithm of the Gamma function evaluated at $x$.

source
Nemo.rgammaMethod
rgamma(x::ComplexFieldElem)

Return the reciprocal of the Gamma function evaluated at $x$.

source
Nemo.digammaMethod
digamma(x::ComplexFieldElem)

Return the logarithmic derivative of the gamma function evaluated at $x$, i.e. $\psi(x)$.

source
Nemo.zetaMethod
zeta(x::ComplexFieldElem)

Return the Riemann zeta function evaluated at $x$.

source
Nemo.barnes_gMethod
barnes_g(x::ComplexFieldElem)

Return the Barnes $G$-function, evaluated at $x$.

source
Nemo.log_barnes_gMethod
log_barnes_g(x::ComplexFieldElem)

Return the logarithm of the Barnes $G$-function, evaluated at $x$.

source
Nemo.erfMethod
erf(x::ComplexFieldElem)

Return the error function evaluated at $x$.

source
Nemo.erfiMethod
erfi(x::ComplexFieldElem)

Return the imaginary error function evaluated at $x$.

source
Nemo.exp_integral_eiMethod
exp_integral_ei(x::ComplexFieldElem)

Return the exponential integral evaluated at $x$.

source
Nemo.sin_integralMethod
sin_integral(x::ComplexFieldElem)

Return the sine integral evaluated at $x$.

source
Nemo.cos_integralMethod
cos_integral(x::ComplexFieldElem)

Return the exponential cosine integral evaluated at $x$.

source
Nemo.sinh_integralMethod
sinh_integral(x::ComplexFieldElem)

Return the hyperbolic sine integral evaluated at $x$.

source
Nemo.cosh_integralMethod
cosh_integral(x::ComplexFieldElem)

Return the hyperbolic cosine integral evaluated at $x$.

source
Nemo.dedekind_etaMethod
dedekind_eta(x::ComplexFieldElem)

Return the Dedekind eta function $\eta(\tau)$ at $\tau = x$.

source
Nemo.modular_weber_fMethod
modular_weber_f(x::ComplexFieldElem)

Return the modular Weber function $\mathfrak{f}(\tau) = \frac{\eta^2(\tau)}{\eta(\tau/2)\eta(2\tau)},$ at $x$ in the complex upper half plane.

source
Nemo.modular_weber_f1Method
modular_weber_f1(x::ComplexFieldElem)

Return the modular Weber function $\mathfrak{f}_1(\tau) = \frac{\eta(\tau/2)}{\eta(\tau)},$ at $x$ in the complex upper half plane.

source
Nemo.modular_weber_f2Method
modular_weber_f2(x::ComplexFieldElem)

Return the modular Weber function $\mathfrak{f}_2(\tau) = \frac{\sqrt{2}\eta(2\tau)}{\eta(\tau)}$ at $x$ in the complex upper half plane.

source
Nemo.j_invariantMethod
j_invariant(x::ComplexFieldElem)

Return the $j$-invariant $j(\tau)$ at $\tau = x$.

source
Nemo.modular_lambdaMethod
modular_lambda(x::ComplexFieldElem)

Return the modular lambda function $\lambda(\tau)$ at $\tau = x$.

source
Nemo.modular_deltaMethod
modular_delta(x::ComplexFieldElem)

Return the modular delta function $\Delta(\tau)$ at $\tau = x$.

source
Nemo.eisenstein_gMethod
eisenstein_g(k::Int, x::ComplexFieldElem)

Return the non-normalized Eisenstein series $G_k(\tau)$ of $\mathrm{SL}_2(\mathbb{Z})$. Also defined for $\tau = i \infty$.

source
Nemo.hilbert_class_polynomialMethod
hilbert_class_polynomial(D::Int, R::ZZPolyRing)

Return in the ring $R$ the Hilbert class polynomial of discriminant $D$, which is only defined for $D < 0$ and $D \equiv 0, 1 \pmod 4$.

source
Nemo.elliptic_kMethod
elliptic_k(x::ComplexFieldElem)

Return the complete elliptic integral $K(x)$.

source
Nemo.elliptic_eMethod
elliptic_e(x::ComplexFieldElem)

Return the complete elliptic integral $E(x)$.

source
Nemo.agmMethod
agm(x::ComplexFieldElem)

Return the arithmetic-geometric mean of $1$ and $x$.

source
Nemo.agmMethod
agm(x::ComplexFieldElem, y::ComplexFieldElem)

Return the arithmetic-geometric mean of $x$ and $y$.

source
Nemo.polygammaMethod
polygamma(s::ComplexFieldElem, a::ComplexFieldElem)

Return the generalised polygamma function $\psi(s,z)$.

source
Nemo.zetaMethod
zeta(s::ComplexFieldElem, a::ComplexFieldElem)

Return the Hurwitz zeta function $\zeta(s,a)$.

source
Nemo.rising_factorialMethod
rising_factorial(x::ComplexFieldElem, n::Int)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an Acb.

source
Nemo.rising_factorial2Method
rising_factorial2(x::ComplexFieldElem, n::Int)

Return a tuple containing the rising factorial $x(x + 1)\ldots (x + n - 1)$ and its derivative.

source
Nemo.polylogMethod
polylog(s::Union{ComplexFieldElem,Int}, a::ComplexFieldElem)

Return the polylogarithm Li$_s(a)$.

source
Nemo.log_integralMethod
log_integral(x::ComplexFieldElem)

Return the logarithmic integral, evaluated at $x$.

source
Nemo.log_integral_offsetMethod
log_integral_offset(x::ComplexFieldElem)

Return the offset logarithmic integral, evaluated at $x$.

source
Nemo.exp_integral_eMethod
exp_integral_e(s::ComplexFieldElem, x::ComplexFieldElem)

Return the generalised exponential integral $E_s(x)$.

source
Nemo.gammaMethod
gamma(s::ComplexFieldElem, x::ComplexFieldElem)

Return the upper incomplete gamma function $\Gamma(s,x)$.

source
Nemo.gamma_regularizedMethod
gamma_regularized(s::ComplexFieldElem, x::ComplexFieldElem)

Return the regularized upper incomplete gamma function $\Gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lowerMethod
gamma_lower(s::ComplexFieldElem, x::ComplexFieldElem)

Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lower_regularizedMethod
gamma_lower_regularized(s::ComplexFieldElem, x::ComplexFieldElem)

Return the regularized lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.airy_aiMethod
airy_ai(x::ComplexFieldElem)

Return the Airy function $\operatorname{Ai}(x)$.

source
Nemo.airy_ai_primeMethod
airy_ai_prime(x::ComplexFieldElem)

Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$.

source
Nemo.airy_biMethod
airy_bi(x::ComplexFieldElem)

Return the Airy function $\operatorname{Bi}(x)$.

source
Nemo.airy_bi_primeMethod
airy_bi_prime(x::ComplexFieldElem)

Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$.

source
Nemo.bessel_jMethod
bessel_j(nu::ComplexFieldElem, x::ComplexFieldElem)

Return the Bessel function $J_{\nu}(x)$.

source
Nemo.bessel_yMethod
bessel_y(nu::ComplexFieldElem, x::ComplexFieldElem)

Return the Bessel function $Y_{\nu}(x)$.

source
Nemo.bessel_iMethod
bessel_i(nu::ComplexFieldElem, x::ComplexFieldElem)

Return the Bessel function $I_{\nu}(x)$.

source
Nemo.bessel_kMethod
bessel_k(nu::ComplexFieldElem, x::ComplexFieldElem)

Return the Bessel function $K_{\nu}(x)$.

source
Nemo.hypergeometric_1f1Method
hypergeometric_1f1(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)

Return the confluent hypergeometric function ${}_1F_1(a,b,x)$.

source
Nemo.hypergeometric_1f1_regularizedMethod
hypergeometric_1f1_regularized(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)

Return the regularized confluent hypergeometric function ${}_1F_1(a,b,x) / \Gamma(b)$.

source
Nemo.hypergeometric_uMethod
hypergeometric_u(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)

Return the confluent hypergeometric function $U(a,b,x)$.

source
Nemo.hypergeometric_2f1Method
hypergeometric_2f1(a::ComplexFieldElem, b::ComplexFieldElem, c::ComplexFieldElem, x::ComplexFieldElem; flags=0)

Return the Gauss hypergeometric function ${}_2F_1(a,b,c,x)$.

source
Nemo.jacobi_thetaMethod
jacobi_theta(z::ComplexFieldElem, tau::ComplexFieldElem)

Return a tuple of four elements containing the Jacobi theta function values $\theta_1, \theta_2, \theta_3, \theta_4$ evaluated at $z, \tau$.

source
Nemo.weierstrass_pMethod
weierstrass_p(z::ComplexFieldElem, tau::ComplexFieldElem)

Return the Weierstrass elliptic function $\wp(z,\tau)$.

source

Examples

CC = ComplexField(64)
 
 s = CC(1, 2)
 z = CC("1.23", "3.45")
@@ -67,7 +67,7 @@
 a = sin(z)^2 + cos(z)^2
 b = zeta(z)
 c = bessel_j(s, z)
-d = hypergeometric_1f1(s, s+1, z)

Linear dependence

Nemo.lindepMethod
lindep(A::Vector{ComplexFieldElem}, bits::Int)

Find a small linear combination of the entries of the array $A$ that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.

source
Nemo.lindepMethod
lindep(A::Matrix{ComplexFieldElem}, bits::Int)

Find a (common) small linear combination of the entries in each row of the array $A$, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.

source

Examples

CC = ComplexField(128)
+d = hypergeometric_1f1(s, s+1, z)

Linear dependence

Nemo.lindepMethod
lindep(A::Vector{ComplexFieldElem}, bits::Int)

Find a small linear combination of the entries of the array $A$ that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.

source
Nemo.lindepMethod
lindep(A::Matrix{ComplexFieldElem}, bits::Int)

Find a (common) small linear combination of the entries in each row of the array $A$, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.

source

Examples

CC = ComplexField(128)
 
 # These are two of the roots of x^5 + 3x + 1
 a = CC(1.0050669478588622428791051888364775253, - 0.93725915669289182697903585868761513585)
@@ -80,4 +80,4 @@
 # ...or from two
 V2 = [CC(1), b, b^2, b^3, b^4, b^5];
 Vs = [V1 V2]
-X = lindep(Vs, 20)
+X = lindep(Vs, 20) diff --git a/dev/constructors/index.html b/dev/constructors/index.html index 1a5dd4ca1..582013c18 100644 --- a/dev/constructors/index.html +++ b/dev/constructors/index.html @@ -1,4 +1,4 @@ Constructing mathematical objects in Nemo · Nemo.jl

Constructing mathematical objects in Nemo

Constructing objects in Julia

In Julia, one constructs objects of a given type by calling a type constructor. This is simply a function with the same name as the type itself. For example, to construct a BigInt object in Julia, we simply call the BigInt constructor:

n = BigInt("1234567898765434567898765434567876543456787654567890")

Julia also uses constructors to convert between types. For example, to convert an Int to a BigInt:

m = BigInt(123)

How we construct objects in Nemo

Julia types don't contain enough information to properly model groups, rings and fields, especially if they are parameterised by values. For example, the ring of integers modulo $n$ for a multiprecision modulus $n$ cannot be modeled using types alone.

Instead of using types to construct objects in Nemo, we use special objects that we refer to as parent objects. They behave a lot like Julia types.

Consider the following simple example, to create a Flint multiprecision integer:

n = ZZ("12345678765456787654567890987654567898765678909876567890")

Here ZZ is not a Julia type, but a callable object. However, for most purposes one can think of such a parent object ZZ as though it were a type.

Constructing parent objects

For more complicated groups, rings, fields, etc., one first needs to construct the parent object before one can use it to construct element objects.

Nemo provides a set of functions for constructing such parent objects. For example, to create a parent object for polynomials over the integers, we use the polynomial_ring parent object constructor.

R, x = polynomial_ring(ZZ, "x")
 f = x^3 + 3x + 1
-g = R(12)

In this example, $R$ is the parent object and we use it to convert the Int value $12$ to an element of the polynomial ring $\mathbb{Z}[x]$.

List of parent object constructors

For convenience, we provide a list of all the parent object constructors in Nemo and explain what domains they represent.

MathematicsNemo constructor
$R = \mathbb{Z}$R = ZZ
$R = \mathbb{Q}$R = QQ
$R = \mathbb{F}_{p^n}$R, a = FiniteField(p, n, "a")
$R = \mathbb{Z}/n\mathbb{Z}$R = residue_ring(ZZ, n)
$S = R[x]$S, x = polynomial_ring(R, "x")
$S = R[x, y]$S, (x, y) = polynomial_ring(R, ["x", "y"])
$S = R[[x]]$ (to precision $n$)S, x = power_series_ring(R, n, "x")
$S = R((x))$ (to precision $n$)S, x = laurent_series_ring(R, n, "x")
$S = \mathrm{Frac}_R$S = fraction_field(R)
$S = R/(f)$S = residue_ring(R, f)
$S = \mathrm{Mat}_{m\times n}(R)$S = matrix_space(R, m, n)
$S = \mathbb{Q}[x]/(f)$S, a = number_field(f, "a")
$S = \mathbb{Q}_p$ (to precision $N$)S = PadicField(p, n)
$S = \mathbb{R}$ (to precision $n$)S = RealField(n)
$S = \mathbb{C}$ (to precision $n$)S = ComplexField(n)
+g = R(12)

In this example, $R$ is the parent object and we use it to convert the Int value $12$ to an element of the polynomial ring $\mathbb{Z}[x]$.

List of parent object constructors

For convenience, we provide a list of all the parent object constructors in Nemo and explain what domains they represent.

MathematicsNemo constructor
$R = \mathbb{Z}$R = ZZ
$R = \mathbb{Q}$R = QQ
$R = \mathbb{F}_{p^n}$R, a = FiniteField(p, n, "a")
$R = \mathbb{Z}/n\mathbb{Z}$R = residue_ring(ZZ, n)
$S = R[x]$S, x = polynomial_ring(R, "x")
$S = R[x, y]$S, (x, y) = polynomial_ring(R, ["x", "y"])
$S = R[[x]]$ (to precision $n$)S, x = power_series_ring(R, n, "x")
$S = R((x))$ (to precision $n$)S, x = laurent_series_ring(R, n, "x")
$S = \mathrm{Frac}_R$S = fraction_field(R)
$S = R/(f)$S = residue_ring(R, f)
$S = \mathrm{Mat}_{m\times n}(R)$S = matrix_space(R, m, n)
$S = \mathbb{Q}[x]/(f)$S, a = number_field(f, "a")
$S = \mathbb{Q}_p$ (to precision $N$)S = PadicField(p, n)
$S = \mathbb{R}$ (to precision $n$)S = RealField(n)
$S = \mathbb{C}$ (to precision $n$)S = ComplexField(n)
diff --git a/dev/developer/conventions/index.html b/dev/developer/conventions/index.html index 7cb76b289..07af2d6ab 100644 --- a/dev/developer/conventions/index.html +++ b/dev/developer/conventions/index.html @@ -1,2 +1,2 @@ -Conventions · Nemo.jl

Conventions

AbstractAlgebra and Nemo have adopted a number of conventions to help maintain a uniform codebase.

Code conventions

Function and type names

Names of types in Julia follow the convention of CamelCase where the first letter of each word is capitalised, e.g. Int64 and AbstractString.

Function/method names in Julia use all lowercase with underscores between the words, e.g. zip and jacobi_symbol.

We follow these conventions in Nemo with some exceptions:

  • When interfacing C libraries the types use the same spelling and capitalisation in Nemo as they do in C, e.g. the Flint library's ZZPolyRingElem remains uncapitalised in Nemo.

  • Types such as fpPolyRingElem which don't exist under that name on the C side also use the lowercase convention as they wrap an actual C type which must be split into more than one type on the Julia side. For example zzModPolyRingElem and fpPolyRingElem on the Julia side both represent Flint zzModPolyRingElem's on the C side.

  • Types of rings and fields, modules, maps, etc. are capitalised whether they correspond to a C type or not, e.g. fqPolyRepField for the type of an object representing the field that fqPolyRepFieldElem's belong to.

.

  • We omit an underscore if the first word of a method is "is" or "has", e.g. iseven.

  • Underscores are omitted if the method name is already well established without an underscore in Julia itself, e.g. setindex.

  • Constructors with the same name as a type use the same spelling and capitalisation as that type, e.g. ZZRingElem(1).

  • Functions for creating rings, fields, modules, maps, etc. (rather than the elements thereof) use CamelCase, e.g. polynomial_ring. We refer to these functions as parent constructors. Note that we do not follow the Julia convention here, e.g. polynomial_ring is a function and not a type constructor (in fact we often return a tuple consisting of a parent object and other objects such as generators with this type of function) yet we capitalise it.

  • We prefer words to not be abbreviated, e.g. denominator instead of den.

  • Exceptions always exist where the result would be offensive in any major spoken language (example omitted).

It is easy to find counterexamples to virtually all these rules. However we have been making efforts to remove the most egregious cases from our codebase over time. As perfect consistency is not possible, work on this has to at times take a back seat.

Use of ASCII characters

All code and printed output in Nemo should use ASCII characters only. This is because we have developers who are using versions of the WSL that cannot correctly display non-ASCII characters.

This extends to function and operator names, which saves people having to learn how to enter them to use the system.

Spacing and tabs

All function bodies and control blocks should be indented using spaces.

A survey of existing code shows 2, 3 or 4 space indenting commonly used in our files. Values outside this range should not be used.

When contributing to an existing file, follow the majority convention in that file. Consistency within a file is valued highly.

If you are new to Nemo development and do not already have a very strong preference, new files should be started with 3 space indenting. This maximises the likelihood that copy and paste between files will be straightforward, though modern editors ease this to some degree.

Function signatures in docstrings should have four spaces before them.

Where possible, line lengths should not exceed 80 characters.

We use a term/factor convention for spacing. This means that all (additive) terms have spaces before and after them, (multiplicative) factors usually do not.

In practice this means that +, -, =, ==, !=, <, >, <=, >= all have spaces before and after them. The operators *, /, ^ and unary minus do not.

As per English, commas are followed by a single space in expressions. This applies for example to function arguments and tuples.

We do not put spaces immediately inside or before parentheses.

Colons used for ranges do not have spaces before or after them.

Logical operators, &, |, &&, etc. usually have spaces before and after them.

Comments

Despite appearances to the contrary, we now prefer code comments explaining the algorithm as it proceeds.

The hash when used for a comment should always be followed by a space. Full sentences are preferred.

We do not generally use comments in Nemo for questions, complaints or proposals for future improvement. These are better off in a ticket on GitHub with a discussion that will be brought to the attention of all relevant parties.

Any (necessary) limitations of the implementation should be noted in docstrings.

Layout of files

In Nemo, all types are places in special files with the word "Types" in their name, e.g. FlintTypes.jl. This is because Julia must be aware of all types before they are used. Separation of types from implementations makes it easy to ensure this happens.

Abstract types should be put in the file called AbstractTypes.jl at the top level of the src directory.

Most implementation files present functions in a particular order, which is as follows:

  • A header stating what the file is for, and if needed, any copyright notices

  • Functions applying to any "types" used in the file, e.g. parent_type, elem_type, base_ring, parent, check_parent.

  • Basic manipulation, including hashes, predicates, getters/setters, functions for creating special values (e.g. one, zero and the like), deepcopy_internal. These are usually fairly short functions, often a single line.

  • Indexing (getindex, setindex), iteration, views.

  • String I/O (expressify and file access, etc.)

  • Arithmetic operations, usually in multiple sections, such as unary operations, binary operations, ad hoc binary operations (e.g. multiplication of a complex object by a scalar), comparisons, ad hoc comparisons, division, etc.

  • More complex functionality separated into sections based on functionality provided, e.g. gcd, interpolation, special functions, solving, etc.

  • Functions for mapping between different types, coercion, changing base ring, etc.

  • Unsafe operators, e.g. mul!, add!, addeq! etc.

  • Random generation

  • Promotion rules

  • Parent object call overload (e.g. for implementing R(2) where R is an object representing a ring or field, etc.)

  • Additional constructors, e.g. matrix, which might be used instead of a parent object to construct elements.

  • Parent object constructors, e.g. polynomial_ring, etc.

The exact order within the file is less important than generally following something like the above. This aids in finding functions in a file since all files are more or less set out the same way.

For an example to follow, see the src/Poly.jl and src/generic/Poly.jl files in AbstractAlgebra which form the oldest and most canonical example.

Headings for sections should be 80 characters wide and formed of hashes in the style that can be seen in each Nemo file.

+Conventions · Nemo.jl

Conventions

AbstractAlgebra and Nemo have adopted a number of conventions to help maintain a uniform codebase.

Code conventions

Function and type names

Names of types in Julia follow the convention of CamelCase where the first letter of each word is capitalised, e.g. Int64 and AbstractString.

Function/method names in Julia use all lowercase with underscores between the words, e.g. zip and jacobi_symbol.

We follow these conventions in Nemo with some exceptions:

  • When interfacing C libraries the types use the same spelling and capitalisation in Nemo as they do in C, e.g. the Flint library's ZZPolyRingElem remains uncapitalised in Nemo.

  • Types such as fpPolyRingElem which don't exist under that name on the C side also use the lowercase convention as they wrap an actual C type which must be split into more than one type on the Julia side. For example zzModPolyRingElem and fpPolyRingElem on the Julia side both represent Flint zzModPolyRingElem's on the C side.

  • Types of rings and fields, modules, maps, etc. are capitalised whether they correspond to a C type or not, e.g. fqPolyRepField for the type of an object representing the field that fqPolyRepFieldElem's belong to.

.

  • We omit an underscore if the first word of a method is "is" or "has", e.g. iseven.

  • Underscores are omitted if the method name is already well established without an underscore in Julia itself, e.g. setindex.

  • Constructors with the same name as a type use the same spelling and capitalisation as that type, e.g. ZZRingElem(1).

  • Functions for creating rings, fields, modules, maps, etc. (rather than the elements thereof) use CamelCase, e.g. polynomial_ring. We refer to these functions as parent constructors. Note that we do not follow the Julia convention here, e.g. polynomial_ring is a function and not a type constructor (in fact we often return a tuple consisting of a parent object and other objects such as generators with this type of function) yet we capitalise it.

  • We prefer words to not be abbreviated, e.g. denominator instead of den.

  • Exceptions always exist where the result would be offensive in any major spoken language (example omitted).

It is easy to find counterexamples to virtually all these rules. However we have been making efforts to remove the most egregious cases from our codebase over time. As perfect consistency is not possible, work on this has to at times take a back seat.

Use of ASCII characters

All code and printed output in Nemo should use ASCII characters only. This is because we have developers who are using versions of the WSL that cannot correctly display non-ASCII characters.

This extends to function and operator names, which saves people having to learn how to enter them to use the system.

Spacing and tabs

All function bodies and control blocks should be indented using spaces.

A survey of existing code shows 2, 3 or 4 space indenting commonly used in our files. Values outside this range should not be used.

When contributing to an existing file, follow the majority convention in that file. Consistency within a file is valued highly.

If you are new to Nemo development and do not already have a very strong preference, new files should be started with 3 space indenting. This maximises the likelihood that copy and paste between files will be straightforward, though modern editors ease this to some degree.

Function signatures in docstrings should have four spaces before them.

Where possible, line lengths should not exceed 80 characters.

We use a term/factor convention for spacing. This means that all (additive) terms have spaces before and after them, (multiplicative) factors usually do not.

In practice this means that +, -, =, ==, !=, <, >, <=, >= all have spaces before and after them. The operators *, /, ^ and unary minus do not.

As per English, commas are followed by a single space in expressions. This applies for example to function arguments and tuples.

We do not put spaces immediately inside or before parentheses.

Colons used for ranges do not have spaces before or after them.

Logical operators, &, |, &&, etc. usually have spaces before and after them.

Comments

Despite appearances to the contrary, we now prefer code comments explaining the algorithm as it proceeds.

The hash when used for a comment should always be followed by a space. Full sentences are preferred.

We do not generally use comments in Nemo for questions, complaints or proposals for future improvement. These are better off in a ticket on GitHub with a discussion that will be brought to the attention of all relevant parties.

Any (necessary) limitations of the implementation should be noted in docstrings.

Layout of files

In Nemo, all types are places in special files with the word "Types" in their name, e.g. FlintTypes.jl. This is because Julia must be aware of all types before they are used. Separation of types from implementations makes it easy to ensure this happens.

Abstract types should be put in the file called AbstractTypes.jl at the top level of the src directory.

Most implementation files present functions in a particular order, which is as follows:

  • A header stating what the file is for, and if needed, any copyright notices

  • Functions applying to any "types" used in the file, e.g. parent_type, elem_type, base_ring, parent, check_parent.

  • Basic manipulation, including hashes, predicates, getters/setters, functions for creating special values (e.g. one, zero and the like), deepcopy_internal. These are usually fairly short functions, often a single line.

  • Indexing (getindex, setindex), iteration, views.

  • String I/O (expressify and file access, etc.)

  • Arithmetic operations, usually in multiple sections, such as unary operations, binary operations, ad hoc binary operations (e.g. multiplication of a complex object by a scalar), comparisons, ad hoc comparisons, division, etc.

  • More complex functionality separated into sections based on functionality provided, e.g. gcd, interpolation, special functions, solving, etc.

  • Functions for mapping between different types, coercion, changing base ring, etc.

  • Unsafe operators, e.g. mul!, add!, addeq! etc.

  • Random generation

  • Promotion rules

  • Parent object call overload (e.g. for implementing R(2) where R is an object representing a ring or field, etc.)

  • Additional constructors, e.g. matrix, which might be used instead of a parent object to construct elements.

  • Parent object constructors, e.g. polynomial_ring, etc.

The exact order within the file is less important than generally following something like the above. This aids in finding functions in a file since all files are more or less set out the same way.

For an example to follow, see the src/Poly.jl and src/generic/Poly.jl files in AbstractAlgebra which form the oldest and most canonical example.

Headings for sections should be 80 characters wide and formed of hashes in the style that can be seen in each Nemo file.

diff --git a/dev/developer/future/index.html b/dev/developer/future/index.html index c429d6602..749bff09a 100644 --- a/dev/developer/future/index.html +++ b/dev/developer/future/index.html @@ -1,2 +1,2 @@ -Future plans · Nemo.jl

Future plans

Ring and CommRing

Currently all commutative ring types belong to Ring and their elements to RingElem (and RingElement) and we have separate types for noncommutative rings and elements thereof, i.e. NCRing and NCRingElem etc.

However, it would be more logical to use Ring for not necessarily commutative rings and CommRing, CRing or CommutativeRing (the name has not been decided on yet) for commutative rings.

This is a big change and should happen with plenty of warning for the community. It would be convenient if a script could be made available to automate this.

Mono repository

There is currently a proposal to place all Oscar related repositories, or some subset of them in a single repository called OscarMono.jl. The details are not finalised and it is not known what impact this will have on Nemo. However, Nemo developers should be aware that this may happen at some point in the fairly near future.

Users of Nemo should be unaffected, as Nemo will continue to exist as a separate package in the OscarMono.jl repository, even if it does become part of this repository. Julia supports multiple packages in the same repository nowadays.

The possibility will always exist to separate the repositories again if the experiment is unsuccessful or serves its purpose and is no longer needed.

Moving implementations from Hecke

In the Hecke.jl project there are a vast number of implementations that were intended for AbstractAlgebra.jl and Nemo.jl. They exist in the src/Misc directory of that project.

These implementations will eventually all be moved over to the correct repositories. Code, documentation and performance improvements will be added.

A number of things must be taken into account when making such moves:

  • Substantial chunks of code should be moved at a time. The code can be initially placed in a src/Misc directory in AbstractAlgebra or Nemo until it can finally be integrated fully into the correct place in those projects.

  • Some of the code calls full parent object constructors in generic code. Such calls should be removed where possible.

  • Some functions such as exp and the like require Base to be prepended, as we do not import these functions from Base into Generic.

  • Some of the code calls back into convenience functions found only in Hecke. These have to be rewritten in terms of AbstractAlgebra/Nemo functions.

  • Some of the code relies on ZZRingElem being available, but would otherwise be suitable for AbstractAlgebra. This code can hopefully be rewritten to be agnostic about the integer type.

  • Todos, questions and so on should be moved to tickets.

  • Sometimes exception types differ between Hecke and Nemo, meaning that tests will fail due to the wrong type of exception being raised. Either the tests will have to be adjusted, or the Nemo exception types changed.

  • RingElem is often used where RingElement is intended, etc. Also types are often unconstrained where Nemo would constrain them to RingElement.

  • Some Hecke functions try to support generic types and specific concrete Nemo types in the same implementation. These will unfortunately have to either be split between AbstractAlgebra and Nemo or a completely generic implementation for abstract types will have to be made.

  • Some Hecke implementations assume sub! and friends are available in generic code. These will have to be rewritten, usually by adding a single unary minus outside of a loop and switching to add! and friends inside the loops.

  • Test code, docstrings and documentation will have to be added where they do not already exist.

  • Exports of the new functionality will have to be added.

  • Some functions should be accompanied by similar functions that don't yet exist. For example if there is a blah_rows there probably should be a blah_cols function as well, etc.

+Future plans · Nemo.jl

Future plans

Ring and CommRing

Currently all commutative ring types belong to Ring and their elements to RingElem (and RingElement) and we have separate types for noncommutative rings and elements thereof, i.e. NCRing and NCRingElem etc.

However, it would be more logical to use Ring for not necessarily commutative rings and CommRing, CRing or CommutativeRing (the name has not been decided on yet) for commutative rings.

This is a big change and should happen with plenty of warning for the community. It would be convenient if a script could be made available to automate this.

Mono repository

There is currently a proposal to place all Oscar related repositories, or some subset of them in a single repository called OscarMono.jl. The details are not finalised and it is not known what impact this will have on Nemo. However, Nemo developers should be aware that this may happen at some point in the fairly near future.

Users of Nemo should be unaffected, as Nemo will continue to exist as a separate package in the OscarMono.jl repository, even if it does become part of this repository. Julia supports multiple packages in the same repository nowadays.

The possibility will always exist to separate the repositories again if the experiment is unsuccessful or serves its purpose and is no longer needed.

Moving implementations from Hecke

In the Hecke.jl project there are a vast number of implementations that were intended for AbstractAlgebra.jl and Nemo.jl. They exist in the src/Misc directory of that project.

These implementations will eventually all be moved over to the correct repositories. Code, documentation and performance improvements will be added.

A number of things must be taken into account when making such moves:

  • Substantial chunks of code should be moved at a time. The code can be initially placed in a src/Misc directory in AbstractAlgebra or Nemo until it can finally be integrated fully into the correct place in those projects.

  • Some of the code calls full parent object constructors in generic code. Such calls should be removed where possible.

  • Some functions such as exp and the like require Base to be prepended, as we do not import these functions from Base into Generic.

  • Some of the code calls back into convenience functions found only in Hecke. These have to be rewritten in terms of AbstractAlgebra/Nemo functions.

  • Some of the code relies on ZZRingElem being available, but would otherwise be suitable for AbstractAlgebra. This code can hopefully be rewritten to be agnostic about the integer type.

  • Todos, questions and so on should be moved to tickets.

  • Sometimes exception types differ between Hecke and Nemo, meaning that tests will fail due to the wrong type of exception being raised. Either the tests will have to be adjusted, or the Nemo exception types changed.

  • RingElem is often used where RingElement is intended, etc. Also types are often unconstrained where Nemo would constrain them to RingElement.

  • Some Hecke functions try to support generic types and specific concrete Nemo types in the same implementation. These will unfortunately have to either be split between AbstractAlgebra and Nemo or a completely generic implementation for abstract types will have to be made.

  • Some Hecke implementations assume sub! and friends are available in generic code. These will have to be rewritten, usually by adding a single unary minus outside of a loop and switching to add! and friends inside the loops.

  • Test code, docstrings and documentation will have to be added where they do not already exist.

  • Exports of the new functionality will have to be added.

  • Some functions should be accompanied by similar functions that don't yet exist. For example if there is a blah_rows there probably should be a blah_cols function as well, etc.

diff --git a/dev/developer/interfaces/index.html b/dev/developer/interfaces/index.html index 46bed0936..b3e6dcdcf 100644 --- a/dev/developer/interfaces/index.html +++ b/dev/developer/interfaces/index.html @@ -1,2 +1,2 @@ -Interfaces · Nemo.jl

Interfaces

Functionality for Generic and Abstract Types

As previously mentioned, Nemo provides various generic types, e.g. Poly{T} for generic univariate polynomials and Mat{T} for generic matrices over a base ring. These and other polynomial and matrix types belong in turn to abstract types or unions thereof, e.g. PolyRingElem{T} is an abstract type representing all univariate polynomial types and MatrixElem{T} is a union of all Nemo matrix types.

When implementing generic functionality, one should usually implement it for the abstract types and unions thereof, since the new functionality will then work for all types of the specified kind, instead of just the generic types.

In order for this to work in practice, such implementations can only use functions in the relevant official interface. These are the functions required to be implemented by all types of that kind. For example, matrix implementations make heavy use of addeq! and mul! to accumulate entries, but they cannot make use of functions such as subeq! as it is not part of the official interface.

In addition to implementations for abstract types and their unions, one may also like to provide specialised implementations for the generic types e.g. Poly{T} and Mat{T} as one would for other specialised types. The generic types are based on Julia arrays internally, and so it makes perfect sense to implement lower level functionality for these types specifically, as this may lead to performance gains. Such specialised implementations can make use of any functions provided for the generic types, whether in the interface or not.

For convenience we list the most important abstract types and their unions for which one should usually prefer to write generic implementations.

  • PolyRingElem{T} : all univariate polynomial types
  • MPolyRingElem{T} : all multivariate polynomial types (see note below)
  • MatrixElem{T} : union of all matrix types including matrix algebras
  • MatElem{T} : all matrix types not including matrix algebras
  • AbsPowerSeriesRingElem{T} : all abstract series types
  • RelPowerSeriesRingElem{T} : all relative series types
  • LaurentSeriesElem{T} : union of all Laurent series over rings and fields
  • PuiseuxSeriesElem{T} : union of all Puiseux series over rings and fields
  • FPModule{T} : all finitely presented modules over a Euclidean domain
  • FPModuleElem{T} : all elems of fin. presented modules over a Euc. domain
  • FracElem{T} : all fractions
  • ResElem{T} : all elements of a residue ring
  • ResFieldElem{T} : all elements of a residue field
  • Map{D, C} : all maps (see Maps developer docs for a description)

N.B: inside the Generic submodule of AbstractAlgebra some abstract types Blah are only accessible by writing AbstractAlgebra.Blah. The unions are directly accessible. There may be generic types and abstract types with the same name, so this is more than just a convention.

Note that multivariate polynomials tend to require very specialised implementations depending heavily on implementation details of the specific multivariate type. Therefore it is rare to write implementations for the abstract type MPolyRingElem{T}. Instead, implementations tend to be done for each concrete multivariate type separately.

Generic interfaces

As mentioned above, the generic implementations in Nemo depend on carefully written interfaces for each of the abstract types provided by the system.

These interfaces are spelled out in the AbstractAlgebra documentation. Note that a generic implementation may depend on functions in both the required and optional interfaces as the optional functions are all implemented with generic fallbacks in terms of the required functions.

For convenience we provide here a list of interfaces that can be relied on in generic implementations, along with a description.

  • Ring : all commutative rings in the system
  • Field : all fields in the system
  • NCRing : all rings in the system (not necessarily commutative)
  • Euclidean Ring : Euclidean rings (see notes below)
  • Univariate Polynomial Ring : all dense univariate polynomials
  • Multivariate Polynomial Ring : all sparse distributed multivariate polys.
  • Series Ring : all series, relative and absolute
  • Residue Ring : all quotients of gcd domains with gcdx by a principal ideal
  • Fraction Field : all fractions over a gcd domain with gcdx
  • Module : all finitely presented modules over a Euclidean domain
  • Matrix : all matrices over a commutative ring
  • Map : all (set) maps in the system

Although we allow Z/nZ in our definition of Euclidean ring, much of the functionality in Nemo can be expected to misbehave (impossible inverses, etc.) when working with Euclidean rings that are not domains. In some cases the algorithms just don't exist, and in other cases we simply haven't implemented the required functionality to support all Euclidean rings for which computations can be done.

Whether a ring is a Euclidean domain or not cannot be encoded in the type. Thus there is no abstract type for Euclidean domains or their elements. Instead, generic functions rely on the existence of certain functions such as gcdx to implement functionality for Euclidean domains.

There is also currently no way to define a Euclidean function for a given ring (which is known to be Euclidean) and have the system recognise the ring as such. This kind of Euclidean interface may be provided in a future version of Nemo.

Julia interfaces we support

Many Julia interfaces rely on being able to create zero and one elements given the type only. As we use the parent/element model (see developer notes on this topic) we cannot support all Julia interfaces fully.

We do however partially implement some Julia interfaces.

  • Iteration : iterators are currently provided for multivariate polynomials to iterate over the coefficients, terms and monomials. Nemo matrices can also be iterated over. Iteration proceeds down each column in turn. One can also iterate over all permutations and partitions. Finally, all finite field types can be iterated over.

  • Views : because C libraries cannot be expected to implement the full range of Julia view types, views of matrices in Nemo can only be constructed for submatrices consisting of contiguous blocks in the original matrix.

  • map and similar : we implement the map and similar interfaces with the caveat that we generally use parent objects where Julia would use types. See the specific documentation for the module of interest to see details.

  • zero and one : these are implemented for parent types, which is not what Julia typically expects. Exceptions include the Flint ZZRingElem and QQFieldElem types, as their parents are not parameterised, which makes it possible to implement these functions for the types as well as the parents.

  • rand : we have a Nemo specific rand interface, which passes the tail of a given rand invocation to the rand function for the base ring, e.g. to create random matrix elements or polynomial coefficients and so on. In addition to this custom rand interface, we also support much of the Julia rand interface, with the usual caveat that we use parent objects instead of types where necessary.

  • serialisation : unfortunately this is currently NOT implemented by Nemo, but we would certainly like to see that done in the future. It's not automatic because of the C objects that underly many of our constructions.

  • Number : Nemo number types do NOT belong to Julia's Number hierarchy, as we must make all our ring element types belong to our RingElem abstract type. To make some Julia Number types cooperate with Nemo, we define the unions RingElement and FieldElement which include some Julia types, such as BigInt and Rational{BigInt}, etc. Note that fixed precision integer types cannot be expected to be well-behaved when they overflow. We recommend using Nemo integer types if one wants good performance for small machine word sized integers, but no overflow when the integer becomes large (Nemo integers are based on Flint's multiprecision ZZRingElem type).

  • hash : we implement hash functions for all major element types in Nemo.

  • getindex/setindex!/typed_hvcat : we implement these to access elements of Nemo matrices, however see the note below on row major representation. In addition, we allow creation of matrices using the notation R[a b; c d] etc. This is done by overloading typed_hvcat for the parent object R instead of a type as Julia would normally expect. This produces a Nemo matrix rather than a Julia one. Note that when passed a type, Julia's typed_hvcat can only construct Julia matrices for Nemo types such as ZZRingElem and QQFieldElem where elements can be constructed from types alone.

Many other Julia interfaces are either not yet implemented or only very partially implemented.

Column major vs row major matrices

Whereas Julia uses column major representation for its matrices, Nemo follows the convention of the C libraries it wraps and uses row major representation. Although Julia 2-D arrays are used internally in Nemo's generic matrix type, the interface from the perspective of the user is still the Nemo row major convention, not the Julia column major convention.

In row major representation, some row operations may be able to be performed more cheaply than similar column operations. In column major representation the converse is true. This may mean that some Julia matrix implementations may perform more slowly if naively ported to Nemo matrices, unless suitably modified.

+Interfaces · Nemo.jl

Interfaces

Functionality for Generic and Abstract Types

As previously mentioned, Nemo provides various generic types, e.g. Poly{T} for generic univariate polynomials and Mat{T} for generic matrices over a base ring. These and other polynomial and matrix types belong in turn to abstract types or unions thereof, e.g. PolyRingElem{T} is an abstract type representing all univariate polynomial types and MatrixElem{T} is a union of all Nemo matrix types.

When implementing generic functionality, one should usually implement it for the abstract types and unions thereof, since the new functionality will then work for all types of the specified kind, instead of just the generic types.

In order for this to work in practice, such implementations can only use functions in the relevant official interface. These are the functions required to be implemented by all types of that kind. For example, matrix implementations make heavy use of addeq! and mul! to accumulate entries, but they cannot make use of functions such as subeq! as it is not part of the official interface.

In addition to implementations for abstract types and their unions, one may also like to provide specialised implementations for the generic types e.g. Poly{T} and Mat{T} as one would for other specialised types. The generic types are based on Julia arrays internally, and so it makes perfect sense to implement lower level functionality for these types specifically, as this may lead to performance gains. Such specialised implementations can make use of any functions provided for the generic types, whether in the interface or not.

For convenience we list the most important abstract types and their unions for which one should usually prefer to write generic implementations.

  • PolyRingElem{T} : all univariate polynomial types
  • MPolyRingElem{T} : all multivariate polynomial types (see note below)
  • MatrixElem{T} : union of all matrix types including matrix algebras
  • MatElem{T} : all matrix types not including matrix algebras
  • AbsPowerSeriesRingElem{T} : all abstract series types
  • RelPowerSeriesRingElem{T} : all relative series types
  • LaurentSeriesElem{T} : union of all Laurent series over rings and fields
  • PuiseuxSeriesElem{T} : union of all Puiseux series over rings and fields
  • FPModule{T} : all finitely presented modules over a Euclidean domain
  • FPModuleElem{T} : all elems of fin. presented modules over a Euc. domain
  • FracElem{T} : all fractions
  • ResElem{T} : all elements of a residue ring
  • ResFieldElem{T} : all elements of a residue field
  • Map{D, C} : all maps (see Maps developer docs for a description)

N.B: inside the Generic submodule of AbstractAlgebra some abstract types Blah are only accessible by writing AbstractAlgebra.Blah. The unions are directly accessible. There may be generic types and abstract types with the same name, so this is more than just a convention.

Note that multivariate polynomials tend to require very specialised implementations depending heavily on implementation details of the specific multivariate type. Therefore it is rare to write implementations for the abstract type MPolyRingElem{T}. Instead, implementations tend to be done for each concrete multivariate type separately.

Generic interfaces

As mentioned above, the generic implementations in Nemo depend on carefully written interfaces for each of the abstract types provided by the system.

These interfaces are spelled out in the AbstractAlgebra documentation. Note that a generic implementation may depend on functions in both the required and optional interfaces as the optional functions are all implemented with generic fallbacks in terms of the required functions.

For convenience we provide here a list of interfaces that can be relied on in generic implementations, along with a description.

  • Ring : all commutative rings in the system
  • Field : all fields in the system
  • NCRing : all rings in the system (not necessarily commutative)
  • Euclidean Ring : Euclidean rings (see notes below)
  • Univariate Polynomial Ring : all dense univariate polynomials
  • Multivariate Polynomial Ring : all sparse distributed multivariate polys.
  • Series Ring : all series, relative and absolute
  • Residue Ring : all quotients of gcd domains with gcdx by a principal ideal
  • Fraction Field : all fractions over a gcd domain with gcdx
  • Module : all finitely presented modules over a Euclidean domain
  • Matrix : all matrices over a commutative ring
  • Map : all (set) maps in the system

Although we allow Z/nZ in our definition of Euclidean ring, much of the functionality in Nemo can be expected to misbehave (impossible inverses, etc.) when working with Euclidean rings that are not domains. In some cases the algorithms just don't exist, and in other cases we simply haven't implemented the required functionality to support all Euclidean rings for which computations can be done.

Whether a ring is a Euclidean domain or not cannot be encoded in the type. Thus there is no abstract type for Euclidean domains or their elements. Instead, generic functions rely on the existence of certain functions such as gcdx to implement functionality for Euclidean domains.

There is also currently no way to define a Euclidean function for a given ring (which is known to be Euclidean) and have the system recognise the ring as such. This kind of Euclidean interface may be provided in a future version of Nemo.

Julia interfaces we support

Many Julia interfaces rely on being able to create zero and one elements given the type only. As we use the parent/element model (see developer notes on this topic) we cannot support all Julia interfaces fully.

We do however partially implement some Julia interfaces.

  • Iteration : iterators are currently provided for multivariate polynomials to iterate over the coefficients, terms and monomials. Nemo matrices can also be iterated over. Iteration proceeds down each column in turn. One can also iterate over all permutations and partitions. Finally, all finite field types can be iterated over.

  • Views : because C libraries cannot be expected to implement the full range of Julia view types, views of matrices in Nemo can only be constructed for submatrices consisting of contiguous blocks in the original matrix.

  • map and similar : we implement the map and similar interfaces with the caveat that we generally use parent objects where Julia would use types. See the specific documentation for the module of interest to see details.

  • zero and one : these are implemented for parent types, which is not what Julia typically expects. Exceptions include the Flint ZZRingElem and QQFieldElem types, as their parents are not parameterised, which makes it possible to implement these functions for the types as well as the parents.

  • rand : we have a Nemo specific rand interface, which passes the tail of a given rand invocation to the rand function for the base ring, e.g. to create random matrix elements or polynomial coefficients and so on. In addition to this custom rand interface, we also support much of the Julia rand interface, with the usual caveat that we use parent objects instead of types where necessary.

  • serialisation : unfortunately this is currently NOT implemented by Nemo, but we would certainly like to see that done in the future. It's not automatic because of the C objects that underly many of our constructions.

  • Number : Nemo number types do NOT belong to Julia's Number hierarchy, as we must make all our ring element types belong to our RingElem abstract type. To make some Julia Number types cooperate with Nemo, we define the unions RingElement and FieldElement which include some Julia types, such as BigInt and Rational{BigInt}, etc. Note that fixed precision integer types cannot be expected to be well-behaved when they overflow. We recommend using Nemo integer types if one wants good performance for small machine word sized integers, but no overflow when the integer becomes large (Nemo integers are based on Flint's multiprecision ZZRingElem type).

  • hash : we implement hash functions for all major element types in Nemo.

  • getindex/setindex!/typed_hvcat : we implement these to access elements of Nemo matrices, however see the note below on row major representation. In addition, we allow creation of matrices using the notation R[a b; c d] etc. This is done by overloading typed_hvcat for the parent object R instead of a type as Julia would normally expect. This produces a Nemo matrix rather than a Julia one. Note that when passed a type, Julia's typed_hvcat can only construct Julia matrices for Nemo types such as ZZRingElem and QQFieldElem where elements can be constructed from types alone.

Many other Julia interfaces are either not yet implemented or only very partially implemented.

Column major vs row major matrices

Whereas Julia uses column major representation for its matrices, Nemo follows the convention of the C libraries it wraps and uses row major representation. Although Julia 2-D arrays are used internally in Nemo's generic matrix type, the interface from the perspective of the user is still the Nemo row major convention, not the Julia column major convention.

In row major representation, some row operations may be able to be performed more cheaply than similar column operations. In column major representation the converse is true. This may mean that some Julia matrix implementations may perform more slowly if naively ported to Nemo matrices, unless suitably modified.

diff --git a/dev/developer/introduction/index.html b/dev/developer/introduction/index.html index f78442fb5..c5e3bcf3e 100644 --- a/dev/developer/introduction/index.html +++ b/dev/developer/introduction/index.html @@ -4,4 +4,4 @@ git push --all

However, if you are working on a much larger project it is highly recommended that you frequently pull from the official master branch and rebase your new branch on top of any changes that have been made there:

git checkout master
 git pull
 git checkout mynewbranch
-git rebase master

Note that rebasing will try to rewrite each of your commits over the top of the branch you are rebasing on (master in this case). This process will have many steps if there are many commits and lots of conflicts. Simply follow the instructions until the process is finished.

The longer you leave it before rebasing on master the longer the rebase process will take. It can eventually become overwhelming as it is not replaying the latest state of your repository over master, but each commit that you made in order. You may have completely forgotten what those older commits were about, so this can become very difficult if not done regularly.

Once you have pushed your changes to your GitHub account, go to the official project GitHub page and you should see your branch mentioned near the top of the page. Open a pull request.

Someone will review your code and suggest changes they'd like made. Simply add more commits to your branch and push again. They will automatically get added to your pull request.

Note that we don't accept code without tests and documentation. We use Documenter.jl for our documentation, in Markdown format. See our existing code for examples of docstrings above functions in the source code and look in the docs/src directory to see how these docstrings are merged into our online documentation.

Development list

All developers of AbstractAlgebra and Nemo are welcome to write to our development list to ask questions and discuss development:

https://groups.google.com/g/nemo-devel

Reporting bugs

Bugs should be reported by opening an issue (ticket) on the official GitHub page for the relevant project. Please state the Julia version being used, the machine you are using and the version of AbstractAlgebra/Nemo you are using. The version can be found in the Project.toml file at the top level of the source tree.

Development roadmap

AbstractAlgebra has a special roadmap ticket which lists the most important tickets that have been opened. If you want to contribute something high value this is the place to start:

https://github.com/Nemocas/AbstractAlgebra.jl/issues/492

This ticket is updated every so often.

Binaries

Binaries of C libraries for Nemo are currently made in a separate repository:

https://github.com/JuliaPackaging/Yggdrasil

If code is added to any of the C libraries used by Nemo, this jll package must be updated first and the version updated in Nemo.jl before the new functionality can be used. Ask the core developers for help with this as various other tasks must be completed at the same time.

Relationship to Oscar

Nemo and AbstractAlgebra are heavily used by the Oscar computer algebra system being developed in Germany by a number of universities involved in a large project known as TRR 195, funded by the DFG.

Oscar is the number one customer for Nemo. Many bugs in Nemo are found and fixed by Oscar developers and most of the key Nemo developers are part of the Oscar project.

See the Oscar website for further details:

https://www.oscar-system.org/

+git rebase master

Note that rebasing will try to rewrite each of your commits over the top of the branch you are rebasing on (master in this case). This process will have many steps if there are many commits and lots of conflicts. Simply follow the instructions until the process is finished.

The longer you leave it before rebasing on master the longer the rebase process will take. It can eventually become overwhelming as it is not replaying the latest state of your repository over master, but each commit that you made in order. You may have completely forgotten what those older commits were about, so this can become very difficult if not done regularly.

Once you have pushed your changes to your GitHub account, go to the official project GitHub page and you should see your branch mentioned near the top of the page. Open a pull request.

Someone will review your code and suggest changes they'd like made. Simply add more commits to your branch and push again. They will automatically get added to your pull request.

Note that we don't accept code without tests and documentation. We use Documenter.jl for our documentation, in Markdown format. See our existing code for examples of docstrings above functions in the source code and look in the docs/src directory to see how these docstrings are merged into our online documentation.

Development list

All developers of AbstractAlgebra and Nemo are welcome to write to our development list to ask questions and discuss development:

https://groups.google.com/g/nemo-devel

Reporting bugs

Bugs should be reported by opening an issue (ticket) on the official GitHub page for the relevant project. Please state the Julia version being used, the machine you are using and the version of AbstractAlgebra/Nemo you are using. The version can be found in the Project.toml file at the top level of the source tree.

Development roadmap

AbstractAlgebra has a special roadmap ticket which lists the most important tickets that have been opened. If you want to contribute something high value this is the place to start:

https://github.com/Nemocas/AbstractAlgebra.jl/issues/492

This ticket is updated every so often.

Binaries

Binaries of C libraries for Nemo are currently made in a separate repository:

https://github.com/JuliaPackaging/Yggdrasil

If code is added to any of the C libraries used by Nemo, this jll package must be updated first and the version updated in Nemo.jl before the new functionality can be used. Ask the core developers for help with this as various other tasks must be completed at the same time.

Relationship to Oscar

Nemo and AbstractAlgebra are heavily used by the Oscar computer algebra system being developed in Germany by a number of universities involved in a large project known as TRR 195, funded by the DFG.

Oscar is the number one customer for Nemo. Many bugs in Nemo are found and fixed by Oscar developers and most of the key Nemo developers are part of the Oscar project.

See the Oscar website for further details:

https://www.oscar-system.org/

diff --git a/dev/developer/parents/index.html b/dev/developer/parents/index.html index da44489f8..5c2de69e9 100644 --- a/dev/developer/parents/index.html +++ b/dev/developer/parents/index.html @@ -9,4 +9,4 @@ 4*x^2 + 3*x + 2 julia> s = p + q -7*x^2 + 5*x + 3

Naturally functions like polynomial and matrix and the light-weight parent constructors are missing for other modules in Nemo at present and it is hoped that developers will fill in such infrastructure rather than simply push the can down the road for someone else to fix. Forcing the creating of full parent objects into as few bottlenecks as possible will make it much easier for developers to remove problems associated with such calls when they arise in future.

+7*x^2 + 5*x + 3

Naturally functions like polynomial and matrix and the light-weight parent constructors are missing for other modules in Nemo at present and it is hoped that developers will fill in such infrastructure rather than simply push the can down the road for someone else to fix. Forcing the creating of full parent objects into as few bottlenecks as possible will make it much easier for developers to remove problems associated with such calls when they arise in future.

diff --git a/dev/developer/topics/index.html b/dev/developer/topics/index.html index 8214bdbf6..372e13194 100644 --- a/dev/developer/topics/index.html +++ b/dev/developer/topics/index.html @@ -3,4 +3,4 @@ for k = 1:ncols(X) A[i, j] = addmul_delayed_reduction!(A[i, j], x[i, k], y[k, j], C) end -A[i, j] = reduce!(A[i, j])

Here C is a temporary element of the same type as the other inputs which is used internally in addmul_delayed_reduction! if needed.

Notice the final call to reduce! to reduce the accumulated value after the accumulation loop has finished.

Note that mul_red! is never called directly but is called inside the generic implementation of addmul_delayed_reduction! for rings that support delayed reduction. That generic code falls back to a call to addmul! which in turn falls back to mul! and addeq! where delayed reduction or addmul! are not available.

+A[i, j] = reduce!(A[i, j])

Here C is a temporary element of the same type as the other inputs which is used internally in addmul_delayed_reduction! if needed.

Notice the final call to reduce! to reduce the accumulated value after the accumulation loop has finished.

Note that mul_red! is never called directly but is called inside the generic implementation of addmul_delayed_reduction! for rings that support delayed reduction. That generic code falls back to a call to addmul! which in turn falls back to mul! and addeq! where delayed reduction or addmul! are not available.

diff --git a/dev/developer/typesystem/index.html b/dev/developer/typesystem/index.html index 001ac962f..a7d9de900 100644 --- a/dev/developer/typesystem/index.html +++ b/dev/developer/typesystem/index.html @@ -1,2 +1,2 @@ -The type system · Nemo.jl

The type system

Use of Julia types in Nemo

Concrete and abstract types

Julia does not provide a traditional class/inheritance approach to programming. Instead, the basic unit of its object oriented approach is the type definition (struct and mutable struct) and inheritance exists only on the function side of the language rather than data side. Julia provides a rich system of abstract types and unions on the data side and multimethods on the function side to effect this.

For example Julia's Number type is an abstract type containing all concrete types that behave like numbers, e.g. Int64, Float64, and so on.

Abstract types can also belong to other abstract types, forming a tree of abstract types.

In Nemo the most important abstract types are Ring and Field, with the latter belonging to the former so that all fields are rings, and the abstract types RingElem and FieldElem for the objects that represent elements of rings and fields, again with the latter abstract type belonging to the former.

Because this hierarchy of abstract types must form a tree, Julia is strictly speaking single inheritance, as each concrete and abstract type can belong to at most one other abstract type. For example, one could not have a diamond of abstract types with ExactField belonging to both Field and ExactRing.

Recovering aspects of multiple inheritance in Nemo

Various possibilities exist to get around the limitation that abstract types must form a 'tree' in Nemo and AbstractAlgebra.

One such possibility is union types. If a function should accept one of a number of concrete or abstract types that can't all be made to belong to a single abstract type due to this limitation then one can use a union type.

For example, Nemo defines RingElement to be a union of RingElem and all the Julia standard types which behave like ring elements, e.g. all Integer types and types of rationals with Integer components.

Other union types are defined in src/AbstractAlgebra.jl in AbstractAlgebra.

A second feature we make use of in Nemo is parameterised types. Each concrete and abstract type can take one or more parameters. These parameter can be any other type, either concrete or abstract. For example, in Julia Rational{T} is for rationals with numerator and denominator of type T.

A great deal of control over parameterised types is possible, e.g. one can restrict the type parameter T using a where clause, e.g. to write a function that accepts all rational types with integer components of the same type one can use the type Rational{T} where T <: Integer.

Nemo makes use of such parameterised types for generic ring constructions such as generic polynomial rings and matrices over a given base ring. The type of the elements of the base ring is substituted for the parameter T in any concrete instantiation of the types Poly{T} and Mat{T}, which are defined in AbstractAlgebra in src/generic/GenericTypes.jl.

The totality of all univariate polynomial types, including those of generic Poly{T} types and those coming from C libraries (such as ZZPolyRingElem), is represented by the abstract type PolyRingElem{T} which in turn belongs to RingElem, both defined in AbstractAlgebra in src/AbstractTypes.jl.

Similarly, the totality of all matrix types, including explicit C types like ZZMatrix and the generic Mat{T} types is given by the abstract type MatElem{T}, again defined in AbstractAlgebra in src/AbstractTypes.jl.

This hierarchy of types allows one to write functions at any level, e.g. for all univariate polynomial types, just those with a given base type T, or for a specific concrete type corresponding to just one kind of univariate polynomial.

A third possibility to get around the single inheritance limitation of Julia is type traits. There is currently no explicit compiler/language support for traits, however various implementations exist that make use of type parameters in tricky ways. This allows one to add 'traits' to types, so long as those traits can be expressed as types. In this way, types can have multiple 'properties' at the same time, instead of belonging to just a single abstract type.

Nemo does not currently use type traits, though the map types in Nemo do make use of a custom analogue of this.

Note that unlike class based systems that dispatch on the type of a (sometimes implicit) this or self parameter, Julia methods dispatch on the type of all arguments. This is a natural fit for mathematics where all sorts of ad hoc left and right operations may be required.

Encapsulation, maps and runtime flags

One limitation of the Julia approach is that the type of an object cannot be changed at runtime. For example one might like to insist that a given ring is in fact a field. There are three standard ways to handle this in Julia.

The first approach is to encapsulate the object in another object which does have the desired type. The second approach is to map the object to a different one of the required type (e.g. by applying a morphism). The third approach is to introduce data fields in the original type which can be changed at runtime, unlike its type. All three approaches come with downsides.

Encapsulation can be time consuming for the developer as methods which applied to the original object do not automatically apply to the encapsulated object. One can write methods which do, but this is not automatic.

Application of a map may come with a performance penalty and may be difficult for the user to navigate. Moreover, mutation of the resulting object does not result in mutation of the original object.

The third option of adding runtime data fields essentially takes one back to writing a (possibly bug ridden) interpreter. It relies on the developer implementing outer methods that make use of hand written control statements to determine which of a range of inner methods should be applied to the object. This misses the benefits of one of the main defining features of Julia, namely its multimethod system and can also make introspection more difficult.

Nemo does not apply any of these three approaches widely at present, though information which can only be known at runtime such as whether a ring is Euclidean will eventually have to be encoded using one of these three methods.

Nemo's custom map types

It makes sense that map types in Nemo should be parameterised by the element types of both the domain and codomain of the map, and of course all maps in the system should somehow belong to an abstract type Map.

This leads one to consider a two parameter system of types Map{D, C} where D and C are the domain and codomain types respectively.

One may also wish to implement various types of map, e.g. linear maps (where the map contains a matrix representing the map) or functional maps (where the map is implemented by a Julia function) and so on. Notionally one imagines doing this with a hierarchy of two parameter abstract types all ultimately belonging to Map{D, C} as the root of the tree.

This approach begins to break down when constructions from homological algebra begin to be applied to maps. In such cases, the maps themselves are the object of study and functions may be applied to maps to produce other maps.

The simplest such function is composition. In a system where composition of maps always results in a map of the same type, no problem arises with the straightforward approach outlined above.

However, for various reasons (including performance) it may not be desirable or even possible to construct a composition of two given maps using the same representation as the original maps. This means that the result of composing two maps of the same type may be a map of a different type, e.g. in the worst case a general composition type.

This problem makes many homological and category theoretic operations on maps difficult or impossible to implement.

Other operations which may be desirable to implement are caching of maps (e.g. where the map is extremely time consuming to compute, such as discrete logarithms) and attaching category theoretic information to maps. Such operations can be effected by encapsulating existing maps in objects containing the extra information, e.g. a cache or a category. However all the methods that applied to the original map objects now no longer apply to the encapsulated objects.

To work around these limitations Nemo implements a four parameter Map type, Map{D, C, T, U}.

The first two parameters are the domain and codomain types as discussed above.

The parameter T is a "map class" which is itself an abstract type existing in a hierarchy of abstract types. This parameter is best thought of as a trait, independent of the hierarchy of abstract types belonging to Map, giving additional flexibility to the map types in the system.

For example, T may be set to LinearMap or FunctionalMap. This may be useful if one wishes to distinguish maps in other ways, e.g. whether they are homomorphisms, isomorphisms, maps with section or retraction etc. As usual, offering traits partially gets around the single inheritance problem.

The final parameter U is used to allow maps of a given type U to be composed and still result in a map of type U, even though the concrete type of the composition is different to that of the original maps. Methods can be written for all maps of type U by matching this parameter, rather than matching on the concrete type U of the original maps.

For example, two maps with concrete type MyRingHomomorphism would belong to Map{D, C, T, MyRingHomomorphism} as would any composition of such maps, even if the concrete type of the composition was not a MyRingHomomorphism.

Naturally four parameter types are rather unwieldy and so various helper functions are provided to compute four parameter map types. In the first instance one still has the type Map{D, C} which will give the union of all map types whose first two parameters are D and C, and where the remaining two parameters are arbitrary.

However one can also pass a map class or a concrete type U to a Map function to compute the class of all maps of the given map class or type.

For example, to write a function which accepts all maps of "type" MyRingHomomorphism, including all compositions of such maps, one inserts Map(MyRingHomomorphism) in place of the type, e.g.

function myfun(f::Map(MyRingHomomorphism))

Note the parentheses here, rather than curly braces; it's a function to compute a type! Now the function myfun will accept any map type whose fourth parameter U is set to MyRingHomomorphism.

This four parameter system is flexible, but may need to be expanded in the future. For example it may be useful to have more than one trait T. This could be achieved either by making T a tuple of traits or by introducing a parameterised MapTrait type which can be placed at that location. Naturally the Map functions for computing the four parameter types will have to be similarly expanded to make it easier for the user.

The map type system is currently considered experimental and our observation so far is that it is not intuitive for developers.

Type hierarchy diagram

The most important abstract types in the system are the element types. Their hierarchy is shown in the following diagram.

alt text

Most of the element types have a corresponding parent abstract type. These are shown in the following diagram.

alt text

+The type system · Nemo.jl

The type system

Use of Julia types in Nemo

Concrete and abstract types

Julia does not provide a traditional class/inheritance approach to programming. Instead, the basic unit of its object oriented approach is the type definition (struct and mutable struct) and inheritance exists only on the function side of the language rather than data side. Julia provides a rich system of abstract types and unions on the data side and multimethods on the function side to effect this.

For example Julia's Number type is an abstract type containing all concrete types that behave like numbers, e.g. Int64, Float64, and so on.

Abstract types can also belong to other abstract types, forming a tree of abstract types.

In Nemo the most important abstract types are Ring and Field, with the latter belonging to the former so that all fields are rings, and the abstract types RingElem and FieldElem for the objects that represent elements of rings and fields, again with the latter abstract type belonging to the former.

Because this hierarchy of abstract types must form a tree, Julia is strictly speaking single inheritance, as each concrete and abstract type can belong to at most one other abstract type. For example, one could not have a diamond of abstract types with ExactField belonging to both Field and ExactRing.

Recovering aspects of multiple inheritance in Nemo

Various possibilities exist to get around the limitation that abstract types must form a 'tree' in Nemo and AbstractAlgebra.

One such possibility is union types. If a function should accept one of a number of concrete or abstract types that can't all be made to belong to a single abstract type due to this limitation then one can use a union type.

For example, Nemo defines RingElement to be a union of RingElem and all the Julia standard types which behave like ring elements, e.g. all Integer types and types of rationals with Integer components.

Other union types are defined in src/AbstractAlgebra.jl in AbstractAlgebra.

A second feature we make use of in Nemo is parameterised types. Each concrete and abstract type can take one or more parameters. These parameter can be any other type, either concrete or abstract. For example, in Julia Rational{T} is for rationals with numerator and denominator of type T.

A great deal of control over parameterised types is possible, e.g. one can restrict the type parameter T using a where clause, e.g. to write a function that accepts all rational types with integer components of the same type one can use the type Rational{T} where T <: Integer.

Nemo makes use of such parameterised types for generic ring constructions such as generic polynomial rings and matrices over a given base ring. The type of the elements of the base ring is substituted for the parameter T in any concrete instantiation of the types Poly{T} and Mat{T}, which are defined in AbstractAlgebra in src/generic/GenericTypes.jl.

The totality of all univariate polynomial types, including those of generic Poly{T} types and those coming from C libraries (such as ZZPolyRingElem), is represented by the abstract type PolyRingElem{T} which in turn belongs to RingElem, both defined in AbstractAlgebra in src/AbstractTypes.jl.

Similarly, the totality of all matrix types, including explicit C types like ZZMatrix and the generic Mat{T} types is given by the abstract type MatElem{T}, again defined in AbstractAlgebra in src/AbstractTypes.jl.

This hierarchy of types allows one to write functions at any level, e.g. for all univariate polynomial types, just those with a given base type T, or for a specific concrete type corresponding to just one kind of univariate polynomial.

A third possibility to get around the single inheritance limitation of Julia is type traits. There is currently no explicit compiler/language support for traits, however various implementations exist that make use of type parameters in tricky ways. This allows one to add 'traits' to types, so long as those traits can be expressed as types. In this way, types can have multiple 'properties' at the same time, instead of belonging to just a single abstract type.

Nemo does not currently use type traits, though the map types in Nemo do make use of a custom analogue of this.

Note that unlike class based systems that dispatch on the type of a (sometimes implicit) this or self parameter, Julia methods dispatch on the type of all arguments. This is a natural fit for mathematics where all sorts of ad hoc left and right operations may be required.

Encapsulation, maps and runtime flags

One limitation of the Julia approach is that the type of an object cannot be changed at runtime. For example one might like to insist that a given ring is in fact a field. There are three standard ways to handle this in Julia.

The first approach is to encapsulate the object in another object which does have the desired type. The second approach is to map the object to a different one of the required type (e.g. by applying a morphism). The third approach is to introduce data fields in the original type which can be changed at runtime, unlike its type. All three approaches come with downsides.

Encapsulation can be time consuming for the developer as methods which applied to the original object do not automatically apply to the encapsulated object. One can write methods which do, but this is not automatic.

Application of a map may come with a performance penalty and may be difficult for the user to navigate. Moreover, mutation of the resulting object does not result in mutation of the original object.

The third option of adding runtime data fields essentially takes one back to writing a (possibly bug ridden) interpreter. It relies on the developer implementing outer methods that make use of hand written control statements to determine which of a range of inner methods should be applied to the object. This misses the benefits of one of the main defining features of Julia, namely its multimethod system and can also make introspection more difficult.

Nemo does not apply any of these three approaches widely at present, though information which can only be known at runtime such as whether a ring is Euclidean will eventually have to be encoded using one of these three methods.

Nemo's custom map types

It makes sense that map types in Nemo should be parameterised by the element types of both the domain and codomain of the map, and of course all maps in the system should somehow belong to an abstract type Map.

This leads one to consider a two parameter system of types Map{D, C} where D and C are the domain and codomain types respectively.

One may also wish to implement various types of map, e.g. linear maps (where the map contains a matrix representing the map) or functional maps (where the map is implemented by a Julia function) and so on. Notionally one imagines doing this with a hierarchy of two parameter abstract types all ultimately belonging to Map{D, C} as the root of the tree.

This approach begins to break down when constructions from homological algebra begin to be applied to maps. In such cases, the maps themselves are the object of study and functions may be applied to maps to produce other maps.

The simplest such function is composition. In a system where composition of maps always results in a map of the same type, no problem arises with the straightforward approach outlined above.

However, for various reasons (including performance) it may not be desirable or even possible to construct a composition of two given maps using the same representation as the original maps. This means that the result of composing two maps of the same type may be a map of a different type, e.g. in the worst case a general composition type.

This problem makes many homological and category theoretic operations on maps difficult or impossible to implement.

Other operations which may be desirable to implement are caching of maps (e.g. where the map is extremely time consuming to compute, such as discrete logarithms) and attaching category theoretic information to maps. Such operations can be effected by encapsulating existing maps in objects containing the extra information, e.g. a cache or a category. However all the methods that applied to the original map objects now no longer apply to the encapsulated objects.

To work around these limitations Nemo implements a four parameter Map type, Map{D, C, T, U}.

The first two parameters are the domain and codomain types as discussed above.

The parameter T is a "map class" which is itself an abstract type existing in a hierarchy of abstract types. This parameter is best thought of as a trait, independent of the hierarchy of abstract types belonging to Map, giving additional flexibility to the map types in the system.

For example, T may be set to LinearMap or FunctionalMap. This may be useful if one wishes to distinguish maps in other ways, e.g. whether they are homomorphisms, isomorphisms, maps with section or retraction etc. As usual, offering traits partially gets around the single inheritance problem.

The final parameter U is used to allow maps of a given type U to be composed and still result in a map of type U, even though the concrete type of the composition is different to that of the original maps. Methods can be written for all maps of type U by matching this parameter, rather than matching on the concrete type U of the original maps.

For example, two maps with concrete type MyRingHomomorphism would belong to Map{D, C, T, MyRingHomomorphism} as would any composition of such maps, even if the concrete type of the composition was not a MyRingHomomorphism.

Naturally four parameter types are rather unwieldy and so various helper functions are provided to compute four parameter map types. In the first instance one still has the type Map{D, C} which will give the union of all map types whose first two parameters are D and C, and where the remaining two parameters are arbitrary.

However one can also pass a map class or a concrete type U to a Map function to compute the class of all maps of the given map class or type.

For example, to write a function which accepts all maps of "type" MyRingHomomorphism, including all compositions of such maps, one inserts Map(MyRingHomomorphism) in place of the type, e.g.

function myfun(f::Map(MyRingHomomorphism))

Note the parentheses here, rather than curly braces; it's a function to compute a type! Now the function myfun will accept any map type whose fourth parameter U is set to MyRingHomomorphism.

This four parameter system is flexible, but may need to be expanded in the future. For example it may be useful to have more than one trait T. This could be achieved either by making T a tuple of traits or by introducing a parameterised MapTrait type which can be placed at that location. Naturally the Map functions for computing the four parameter types will have to be similarly expanded to make it easier for the user.

The map type system is currently considered experimental and our observation so far is that it is not intuitive for developers.

Type hierarchy diagram

The most important abstract types in the system are the element types. Their hierarchy is shown in the following diagram.

alt text

Most of the element types have a corresponding parent abstract type. These are shown in the following diagram.

alt text

diff --git a/dev/exact/index.html b/dev/exact/index.html index 4eecc7012..b99487997 100644 --- a/dev/exact/index.html +++ b/dev/exact/index.html @@ -87,7 +87,7 @@ false julia> C(1im) > C(1im) -false

This behavior may be changed or may become configurable in the future.

Interface

Base.iszeroMethod
iszero(a::ca)

Return whether a is the number 0.

source
Base.isoneMethod
isone(a::ca)

Return whether a is the number 1.

source
Nemo.is_algebraicMethod
is_algebraic(a::ca)

Return whether a is an algebraic number.

source
Nemo.is_rationalMethod
is_rational(a::ca)

Return whether a is a rational number.

source
Base.isintegerMethod
isinteger(a::ca)

Return whether a is an integer.

source
Base.isrealMethod
isreal(a::ca)

Return whether a is a real number. This returns false if a is a pure real infinity.

source
Nemo.is_imaginaryMethod
is_imaginary(a::ca)

Return whether a is an imaginary number. This returns false if a is a pure imaginary infinity.

source

Infinities and special values

By default, CalciumField does not permit creating values that are not numbers, and any non-number value (unsigned infinity, signed infinity, Undefined) will result in an exception. This also applies to the special value Unknown, used in situations where Calcium is unable to prove that a value is a number. To enable special values, use extended=true.

julia> C = CalciumField()
+false

This behavior may be changed or may become configurable in the future.

Interface

Base.iszeroMethod
iszero(a::ca)

Return whether a is the number 0.

source
Base.isoneMethod
isone(a::ca)

Return whether a is the number 1.

source
Nemo.is_algebraicMethod
is_algebraic(a::ca)

Return whether a is an algebraic number.

source
Nemo.is_rationalMethod
is_rational(a::ca)

Return whether a is a rational number.

source
Base.isintegerMethod
isinteger(a::ca)

Return whether a is an integer.

source
Base.isrealMethod
isreal(a::ca)

Return whether a is a real number. This returns false if a is a pure real infinity.

source
Nemo.is_imaginaryMethod
is_imaginary(a::ca)

Return whether a is an imaginary number. This returns false if a is a pure imaginary infinity.

source

Infinities and special values

By default, CalciumField does not permit creating values that are not numbers, and any non-number value (unsigned infinity, signed infinity, Undefined) will result in an exception. This also applies to the special value Unknown, used in situations where Calcium is unable to prove that a value is a number. To enable special values, use extended=true.

julia> C = CalciumField()
 Exact Complex Field
 
 julia> 1 // C(0)
@@ -99,7 +99,7 @@
 Exact Complex Field (Extended)
 
 julia> 1 // Cext(0)
-UnsignedInfinity

Note that special values do not satisfy the properties of a mathematical ring or field. You will likely get meaningless results if you put infinities in matrices or polynomials.

Nemo.unsigned_infinityMethod
unsigned_infinity(C::CalciumField)

Return unsigned infinity ($\hat \infty$) as an element of C. This throws an exception if C does not allow special values.

source
Nemo.infinityMethod
infinity(C::CalciumField)

Return positive infinity ($+\infty$) as an element of C. This throws an exception if C does not allow special values.

source
Nemo.infinityMethod
infinity(a::ca)

Return the signed infinity ($a \cdot \infty$). This throws an exception if the parent of a does not allow special values.

source
Nemo.undefinedMethod
undefined(C::CalciumField)

Return the special value Undefined as an element of C. This throws an exception if C does not allow special values.

source
Nemo.unknownMethod
unknown(C::CalciumField)

Return the special meta-value Unknown as an element of C. This throws an exception if C does not allow special values.

source
Nemo.is_numberMethod
is_number(a::ca)

Return whether a is a number, i.e. not an infinity or undefined.

source
Nemo.is_undefinedMethod
is_undefined(a::ca)

Return whether a is the special value Undefined.

source
Base.isinfMethod
isinf(a::ca)

Return whether a is any infinity (signed or unsigned).

source
Nemo.is_uinfMethod
is_uinf(a::ca)

Return whether a is unsigned infinity.

source
Nemo.is_signed_infMethod
is_signed_inf(a::ca)

Return whether a is any signed infinity.

source
Nemo.is_unknownMethod
is_unknown(a::ca)

Return whether a is the special value Unknown. This is a representation property and not a mathematical predicate.

source

Complex parts

Functions for computing components of real and complex numbers will perform automatic symbolic simplifications in special cases. In general, such operations will introduce new extension numbers.

julia> real(C(2+3im))
+UnsignedInfinity

Note that special values do not satisfy the properties of a mathematical ring or field. You will likely get meaningless results if you put infinities in matrices or polynomials.

Nemo.unsigned_infinityMethod
unsigned_infinity(C::CalciumField)

Return unsigned infinity ($\hat \infty$) as an element of C. This throws an exception if C does not allow special values.

source
Nemo.infinityMethod
infinity(C::CalciumField)

Return positive infinity ($+\infty$) as an element of C. This throws an exception if C does not allow special values.

source
Nemo.infinityMethod
infinity(a::ca)

Return the signed infinity ($a \cdot \infty$). This throws an exception if the parent of a does not allow special values.

source
Nemo.undefinedMethod
undefined(C::CalciumField)

Return the special value Undefined as an element of C. This throws an exception if C does not allow special values.

source
Nemo.unknownMethod
unknown(C::CalciumField)

Return the special meta-value Unknown as an element of C. This throws an exception if C does not allow special values.

source
Nemo.is_numberMethod
is_number(a::ca)

Return whether a is a number, i.e. not an infinity or undefined.

source
Nemo.is_undefinedMethod
is_undefined(a::ca)

Return whether a is the special value Undefined.

source
Base.isinfMethod
isinf(a::ca)

Return whether a is any infinity (signed or unsigned).

source
Nemo.is_uinfMethod
is_uinf(a::ca)

Return whether a is unsigned infinity.

source
Nemo.is_signed_infMethod
is_signed_inf(a::ca)

Return whether a is any signed infinity.

source
Nemo.is_unknownMethod
is_unknown(a::ca)

Return whether a is the special value Unknown. This is a representation property and not a mathematical predicate.

source

Complex parts

Functions for computing components of real and complex numbers will perform automatic symbolic simplifications in special cases. In general, such operations will introduce new extension numbers.

julia> real(C(2+3im))
 2
 
 julia> sign(C(2im))
@@ -121,7 +121,7 @@
 5.18785e+49 {51878483143196131920862615246303013562686760680405}
 
 julia> ZZ(floor(C(pi) ^ 100))
-51878483143196131920862615246303013562686760680405

Interface

Base.realMethod
real(a::ca)

Return the real part of a.

source
Base.imagMethod
imag(a::ca)

Return the imaginary part of a.

source
Base.angleMethod
angle(a::ca)

Return the complex argument of a.

source
Nemo.csgnMethod
csgn(a::ca)

Return the extension of the real sign function taking the value 1 strictly in the right half plane, -1 strictly in the left half plane, and the sign of the imaginary part when on the imaginary axis. Equivalently, $\operatorname{csgn}(x) = x / \sqrt{x^2}$ except that the value is 0 at zero.

source
Base.signMethod
sign(a::ca)

Return the complex sign of a, defined as zero if a is zero and as $a / |a|$ for any other complex number. This function also extracts the sign when a is a signed infinity.

source
Base.absMethod
abs(a::ca)

Return the absolute value of a.

source
Base.conjMethod
conj(a::ca; form::Symbol=:default)

Return the complex conjugate of a. The optional form argument allows specifying the representation. In :shallow form, $\overline{a}$ is introduced as a new extension number if it no straightforward simplifications are possible. In :deep form, complex conjugation is performed recursively.

source
Base.floorMethod
floor(a::ca)

Return the floor function of a.

source
Base.ceilMethod
ceil(a::ca)

Return the ceiling function of a.

source

Elementary and special functions

Elementary and special functions generally create new extension numbers. In special cases, simplifications occur automatically.

julia> exp(C(1))
+51878483143196131920862615246303013562686760680405

Interface

Base.realMethod
real(a::ca)

Return the real part of a.

source
Base.imagMethod
imag(a::ca)

Return the imaginary part of a.

source
Base.angleMethod
angle(a::ca)

Return the complex argument of a.

source
Nemo.csgnMethod
csgn(a::ca)

Return the extension of the real sign function taking the value 1 strictly in the right half plane, -1 strictly in the left half plane, and the sign of the imaginary part when on the imaginary axis. Equivalently, $\operatorname{csgn}(x) = x / \sqrt{x^2}$ except that the value is 0 at zero.

source
Base.signMethod
sign(a::ca)

Return the complex sign of a, defined as zero if a is zero and as $a / |a|$ for any other complex number. This function also extracts the sign when a is a signed infinity.

source
Base.absMethod
abs(a::ca)

Return the absolute value of a.

source
Base.conjMethod
conj(a::ca; form::Symbol=:default)

Return the complex conjugate of a. The optional form argument allows specifying the representation. In :shallow form, $\overline{a}$ is introduced as a new extension number if it no straightforward simplifications are possible. In :deep form, complex conjugation is performed recursively.

source
Base.floorMethod
floor(a::ca)

Return the floor function of a.

source
Base.ceilMethod
ceil(a::ca)

Return the ceiling function of a.

source

Elementary and special functions

Elementary and special functions generally create new extension numbers. In special cases, simplifications occur automatically.

julia> exp(C(1))
 2.71828 {a where a = 2.71828 [Exp(1)]}
 
 julia> exp(C(0))
@@ -169,4 +169,4 @@
 
 julia> sin(3*a) == 4 * sin(a) * sin(C(pi)//3 - a) * sin(C(pi)//3 + a)
 ERROR: Unable to perform operation (failed deciding truth of a predicate): isequal

A possible workaround is to fall back on a numerical comparison:

julia> abs(cos(a) + cos(2*a) + cos(3*a) - (sin(7*a//2)//(2*sin(a//2)) - C(1)//2)) <= C(10)^-100
-true

Of course, this is not a rigorous proof that the numbers are equal, and CalciumField is overkill here; it would be far more efficient to use ArbField directly to check that the numbers are approximately equal.

Interface

Nemo.const_piMethod
const_pi(C::CalciumField)

Return the constant $\pi$ as an element of C.

source
Nemo.const_eulerMethod
const_euler(C::CalciumField)

Return Euler's constant $\gamma$ as an element of C.

source
Nemo.oneiMethod
onei(C::CalciumField)

Return the imaginary unit $i$ as an element of C.

source
Base.sqrtMethod
Base.sqrt(a::ca; check::Bool=true)

Return the principal square root of a.

source
Base.expMethod
exp(a::ca)

Return the exponential function of a.

source
Base.logMethod
log(a::ca)

Return the natural logarithm of a.

source
Nemo.powMethod
pow(a::ca, b::Int; form::Symbol=:default)

Return a raised to the integer power b. The optional form argument allows specifying the representation. In :default form, this is equivalent to a ^ b, which may create a new extension number $a^b$ if the exponent b is too large (as determined by the parent option :pow_limit or :prec_limit depending on the case). In :arithmetic form, the exponentiation is performed arithmetically in the field of a, regardless of the size of the exponent b.

source
Base.sinMethod
sin(a::ca; form::Symbol=:default)

Return the sine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :tangent form, the value is represented using tangents. In :direct form, the value is represented directly using a sine or cosine.

source
Base.cosMethod
cos(a::ca; form::Symbol=:default)

Return the cosine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :tangent form, the value is represented using tangents. In :direct form, the value is represented directly using a sine or cosine.

source
Base.tanMethod
tan(a::ca; form::Symbol=:default)

Return the tangent of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :direct or :tangent form, the value is represented directly using tangents. In :sine_cosine form, the value is represented using sines or cosines.

source
Base.atanMethod
atan(a::ca; form::Symbol=:default)

Return the inverse tangent of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct or :arctangent form, the value is represented directly using arctangents.

source
Base.asinMethod
asin(a::ca; form::Symbol=:default)

Return the inverse sine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct form, the value is represented directly using an inverse sine or cosine.

source
Base.acosMethod
acos(a::ca; form::Symbol=:default)

Return the inverse cosine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct form, the value is represented directly using an inverse sine or cosine.

source
Nemo.gammaMethod
gamma(a::ca)

Return the gamma function of a.

source
Nemo.erfMethod
erf(a::ca)

Return the error function of a.

source
Nemo.erfiMethod
erfi(a::ca)

Return the imaginary error function of a.

source
Nemo.erfcMethod
erfc(a::ca)

Return the complementary error function of a.

source

Rewriting and simplification

Nemo.complex_normal_formMethod
complex_normal_form(a::ca, deep::Bool=true)

Returns the input rewritten using standardizing transformations over the complex numbers:

  • Elementary functions are rewritten in terms of exponentials, roots and logarithms.

  • Complex parts are rewritten using logarithms, square roots, and (deep) complex conjugates.

  • Algebraic numbers are rewritten in terms of cyclotomic fields where applicable.

If deep is set, the rewriting is applied recursively to the tower of extension numbers; otherwise, the rewriting is only applied to the top-level extension numbers.

The result is not a normal form in the strong sense (the same number can have many possible representations even after applying this transformation), but this transformation can nevertheless be a useful heuristic for simplification.

source
+true

Of course, this is not a rigorous proof that the numbers are equal, and CalciumField is overkill here; it would be far more efficient to use ArbField directly to check that the numbers are approximately equal.

Interface

Nemo.const_piMethod
const_pi(C::CalciumField)

Return the constant $\pi$ as an element of C.

source
Nemo.const_eulerMethod
const_euler(C::CalciumField)

Return Euler's constant $\gamma$ as an element of C.

source
Nemo.oneiMethod
onei(C::CalciumField)

Return the imaginary unit $i$ as an element of C.

source
Base.sqrtMethod
Base.sqrt(a::ca; check::Bool=true)

Return the principal square root of a.

source
Base.expMethod
exp(a::ca)

Return the exponential function of a.

source
Base.logMethod
log(a::ca)

Return the natural logarithm of a.

source
Nemo.powMethod
pow(a::ca, b::Int; form::Symbol=:default)

Return a raised to the integer power b. The optional form argument allows specifying the representation. In :default form, this is equivalent to a ^ b, which may create a new extension number $a^b$ if the exponent b is too large (as determined by the parent option :pow_limit or :prec_limit depending on the case). In :arithmetic form, the exponentiation is performed arithmetically in the field of a, regardless of the size of the exponent b.

source
Base.sinMethod
sin(a::ca; form::Symbol=:default)

Return the sine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :tangent form, the value is represented using tangents. In :direct form, the value is represented directly using a sine or cosine.

source
Base.cosMethod
cos(a::ca; form::Symbol=:default)

Return the cosine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :tangent form, the value is represented using tangents. In :direct form, the value is represented directly using a sine or cosine.

source
Base.tanMethod
tan(a::ca; form::Symbol=:default)

Return the tangent of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :direct or :tangent form, the value is represented directly using tangents. In :sine_cosine form, the value is represented using sines or cosines.

source
Base.atanMethod
atan(a::ca; form::Symbol=:default)

Return the inverse tangent of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct or :arctangent form, the value is represented directly using arctangents.

source
Base.asinMethod
asin(a::ca; form::Symbol=:default)

Return the inverse sine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct form, the value is represented directly using an inverse sine or cosine.

source
Base.acosMethod
acos(a::ca; form::Symbol=:default)

Return the inverse cosine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct form, the value is represented directly using an inverse sine or cosine.

source
Nemo.gammaMethod
gamma(a::ca)

Return the gamma function of a.

source
Nemo.erfMethod
erf(a::ca)

Return the error function of a.

source
Nemo.erfiMethod
erfi(a::ca)

Return the imaginary error function of a.

source
Nemo.erfcMethod
erfc(a::ca)

Return the complementary error function of a.

source

Rewriting and simplification

Nemo.complex_normal_formMethod
complex_normal_form(a::ca, deep::Bool=true)

Returns the input rewritten using standardizing transformations over the complex numbers:

  • Elementary functions are rewritten in terms of exponentials, roots and logarithms.

  • Complex parts are rewritten using logarithms, square roots, and (deep) complex conjugates.

  • Algebraic numbers are rewritten in terms of cyclotomic fields where applicable.

If deep is set, the rewriting is applied recursively to the tower of extension numbers; otherwise, the rewriting is only applied to the top-level extension numbers.

The result is not a normal form in the strong sense (the same number can have many possible representations even after applying this transformation), but this transformation can nevertheless be a useful heuristic for simplification.

source
diff --git a/dev/factor/index.html b/dev/factor/index.html index 918b563d2..5996f429e 100644 --- a/dev/factor/index.html +++ b/dev/factor/index.html @@ -18,4 +18,4 @@ true julia> fac[229] -3

Basic functionality

Objects of type Fac are iterable, that is, if a is an object of type Fac, then for (p, e) in a will iterate through all pairs (p, e), where p is a factor and e the corresponding exponent.

Base.inMethod
in(a, b::Fac)

Test whether $a$ is a factor of $b$.

Base.getindexMethod
getindex(a::Fac, b) -> Int

If $b$ is a factor of $a$, the corresponding exponent is returned. Otherwise an error is thrown.

Base.lengthMethod
length(a::Fac) -> Int

Return the number of factors of $a$, not including the unit.

AbstractAlgebra.Generic.unitMethod
unit(a::Fac{T}) -> T

Return the unit of the factorization.

+3

Basic functionality

Objects of type Fac are iterable, that is, if a is an object of type Fac, then for (p, e) in a will iterate through all pairs (p, e), where p is a factor and e the corresponding exponent.

Base.inMethod
in(a, b::Fac)

Test whether $a$ is a factor of $b$.

Base.getindexMethod
getindex(a::Fac, b) -> Int

If $b$ is a factor of $a$, the corresponding exponent is returned. Otherwise an error is thrown.

Base.lengthMethod
length(a::Fac) -> Int

Return the number of factors of $a$, not including the unit.

AbstractAlgebra.Generic.unitMethod
unit(a::Fac{T}) -> T

Return the unit of the factorization.

diff --git a/dev/ff_embedding/index.html b/dev/ff_embedding/index.html index bc27a1e94..844891902 100644 --- a/dev/ff_embedding/index.html +++ b/dev/ff_embedding/index.html @@ -1,5 +1,5 @@ -Finite field embeddings · Nemo.jl

Finite field embeddings

Introduction

Nemo allows the construction of finite field embeddings making use of the algorithm of Bosma, Cannon and Steel behind the scenes to ensure compatibility. Critical routines (e.g. polynomial factorization, matrix computations) are provided by the C library Flint, whereas high level tasks are written directly in Nemo.

Embedding functionality

It is possible to explicitly call the embedding embed function to create an embedding, but it is also possible to directly ask for the conversion of a finite field element x in some other finite field k via calling k(x). The resulting embedding is of type FinFieldMorphism. It is also possible to compute the preimage map of an embedding via the preimage_map function, applied to an embedding or directly to the finite fields (this actually first computes the embedding), or via conversion. An error is thrown if the element you want to compute the preimage of is not in the image of the embedding.

Computing an embedding

Nemo.embedMethod
embed(k::T, K::T) where T <: FinField

Embed $k$ in $K$, with some additional computations in order to satisfy compatibility conditions with previous and future embeddings.

source

Examples

julia> k2, x2 = FiniteField(19, 2, "x2")
+Finite field embeddings · Nemo.jl

Finite field embeddings

Introduction

Nemo allows the construction of finite field embeddings making use of the algorithm of Bosma, Cannon and Steel behind the scenes to ensure compatibility. Critical routines (e.g. polynomial factorization, matrix computations) are provided by the C library Flint, whereas high level tasks are written directly in Nemo.

Embedding functionality

It is possible to explicitly call the embedding embed function to create an embedding, but it is also possible to directly ask for the conversion of a finite field element x in some other finite field k via calling k(x). The resulting embedding is of type FinFieldMorphism. It is also possible to compute the preimage map of an embedding via the preimage_map function, applied to an embedding or directly to the finite fields (this actually first computes the embedding), or via conversion. An error is thrown if the element you want to compute the preimage of is not in the image of the embedding.

Computing an embedding

Nemo.embedMethod
embed(k::T, K::T) where T <: FinField

Embed $k$ in $K$, with some additional computations in order to satisfy compatibility conditions with previous and future embeddings.

source

Examples

julia> k2, x2 = FiniteField(19, 2, "x2")
 (Finite field of degree 2 over GF(19), x2)
 
 julia> k4, x4 = FiniteField(19, 4, "x4")
@@ -14,7 +14,7 @@
 6*x4^3 + 5*x4^2 + 9*x4 + 17
 
 julia> z = k4(x2)
-6*x4^3 + 5*x4^2 + 9*x4 + 17

Computing the preimage of an embedding

Examples

julia> k7, x7 = FiniteField(13, 7, "x7")
+6*x4^3 + 5*x4^2 + 9*x4 + 17

Computing the preimage of an embedding

Examples

julia> k7, x7 = FiniteField(13, 7, "x7")
 (Finite field of degree 7 over GF(13), x7)
 
 julia> k21, x21 = FiniteField(13, 21, "x21")
@@ -29,4 +29,4 @@
 x7
 
 julia> t = k7(y)
-x7
+x7
diff --git a/dev/finitefield/index.html b/dev/finitefield/index.html index 4b6faa466..5a07a2a4a 100644 --- a/dev/finitefield/index.html +++ b/dev/finitefield/index.html @@ -1,5 +1,5 @@ -Finite fields · Nemo.jl

Finite fields

Finite fields are provided in Nemo by Flint. This allows construction of finite fields of any characteristic and degree for which there are Conway polynomials. It is also possible for the user to specify their own irreducible polynomial generating a finite field.

Finite fields are constructed using the FlintFiniteField function. However, for convenience we define

FiniteField = FlintFiniteField

so that finite fields can be constructed using FiniteField rather than FlintFiniteField. Note that this is the name of the constructor, but not of finite field type.

The types of finite field elements in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.

LibraryFieldElement typeParent type
Flint$\mathbb{F}_{p^n}$ (small $p$)fqPolyRepFieldElemfqPolyRepField
Flint$\mathbb{F}_{p^n}$ (large $p$)FqPolyRepFieldElemFqPolyRepField

The only difference between the FqPolyRepFieldElem and fqPolyRepFieldElem types is the representation. The former is for finite fields with multiprecision characteristic and the latter is for characteristics that fit into a single unsigned machine word. The FlintFiniteField constructor automatically picks the correct representation for the user, and so the average user doesn't need to know about the actual types.

All the finite field types belong to the FinField abstract type and the finite field element types belong to the FinFieldElem abstract type.

Since all the functionality for the FqPolyRepFieldElem finite field type is identical to that provided for the fqPolyRepFieldElem finite field type, we simply document the former.

Finite field functionality

Finite fields in Nemo provide all the field functionality described in AbstractAlgebra:

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

Below we describe the functionality that is provided in addition to this.

Constructors

In order to construct finite field elements in Nemo, one must first construct the finite field itself. This is accomplished with one of the following constructors.

Nemo.FlintFiniteFieldFunction
FlintFiniteField(char::ZZRingElem, deg::Int, s::VarName; cached = true)

Returns a tuple $S, x$ consisting of a finite field parent object $S$ and generator $x$ for the finite field of the given characteristic and degree. The string $s$ is used to designate how the finite field generator will be printed. The characteristic must be prime. When a Conway polynomial is known, the field is generated using the Conway polynomial. Otherwise a random sparse, irreducible polynomial is used. The generator of the field is guaranteed to be a multiplicative generator only if the field is generated by a Conway polynomial. We require the degree to be positive.

source
FlintFiniteField(pol::Union{ZZModPolyRingElem, FpPolyRingElem}, s::VarName; cached = true, check = true)

Returns a tuple $S, x$ consisting of a finite field parent object $S$ and generator $x$ for the finite field over $F_p$ defined by the given polynomial, i.e. $\mathbb{F}_p[t]/(pol)$. The characteristic is specified by the modulus of pol. The polynomial is required to be irreducible, but this is not checked. The base ring of the polynomial is required to be a field, which is checked by default. Use check = false to disable the check. The string $s$ is used to designate how the finite field generator will be printed. The generator will not be multiplicative in general.

source
FlintFiniteField(F::FqPolyRepField, deg::Int, s::VarName; cached = true)

Return a finite field with the same type as F but with a possibly different degree deg over the prime subfield.

source

Here are some examples of creating finite fields and making use of the resulting parent objects to coerce various elements into those fields.

Examples

julia> R, x = FiniteField(7, 3, "x")
+Finite fields · Nemo.jl

Finite fields

Finite fields are provided in Nemo by Flint. This allows construction of finite fields of any characteristic and degree for which there are Conway polynomials. It is also possible for the user to specify their own irreducible polynomial generating a finite field.

Finite fields are constructed using the FlintFiniteField function. However, for convenience we define

FiniteField = FlintFiniteField

so that finite fields can be constructed using FiniteField rather than FlintFiniteField. Note that this is the name of the constructor, but not of finite field type.

The types of finite field elements in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.

LibraryFieldElement typeParent type
Flint$\mathbb{F}_{p^n}$ (small $p$)fqPolyRepFieldElemfqPolyRepField
Flint$\mathbb{F}_{p^n}$ (large $p$)FqPolyRepFieldElemFqPolyRepField

The only difference between the FqPolyRepFieldElem and fqPolyRepFieldElem types is the representation. The former is for finite fields with multiprecision characteristic and the latter is for characteristics that fit into a single unsigned machine word. The FlintFiniteField constructor automatically picks the correct representation for the user, and so the average user doesn't need to know about the actual types.

All the finite field types belong to the FinField abstract type and the finite field element types belong to the FinFieldElem abstract type.

Since all the functionality for the FqPolyRepFieldElem finite field type is identical to that provided for the fqPolyRepFieldElem finite field type, we simply document the former.

Finite field functionality

Finite fields in Nemo provide all the field functionality described in AbstractAlgebra:

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

Below we describe the functionality that is provided in addition to this.

Constructors

In order to construct finite field elements in Nemo, one must first construct the finite field itself. This is accomplished with one of the following constructors.

Nemo.FlintFiniteFieldFunction
FlintFiniteField(char::ZZRingElem, deg::Int, s::VarName; cached = true)

Returns a tuple $S, x$ consisting of a finite field parent object $S$ and generator $x$ for the finite field of the given characteristic and degree. The string $s$ is used to designate how the finite field generator will be printed. The characteristic must be prime. When a Conway polynomial is known, the field is generated using the Conway polynomial. Otherwise a random sparse, irreducible polynomial is used. The generator of the field is guaranteed to be a multiplicative generator only if the field is generated by a Conway polynomial. We require the degree to be positive.

source
FlintFiniteField(pol::Union{ZZModPolyRingElem, FpPolyRingElem}, s::VarName; cached = true, check = true)

Returns a tuple $S, x$ consisting of a finite field parent object $S$ and generator $x$ for the finite field over $F_p$ defined by the given polynomial, i.e. $\mathbb{F}_p[t]/(pol)$. The characteristic is specified by the modulus of pol. The polynomial is required to be irreducible, but this is not checked. The base ring of the polynomial is required to be a field, which is checked by default. Use check = false to disable the check. The string $s$ is used to designate how the finite field generator will be printed. The generator will not be multiplicative in general.

source
FlintFiniteField(F::FqPolyRepField, deg::Int, s::VarName; cached = true)

Return a finite field with the same type as F but with a possibly different degree deg over the prime subfield.

source

Here are some examples of creating finite fields and making use of the resulting parent objects to coerce various elements into those fields.

Examples

julia> R, x = FiniteField(7, 3, "x")
 (Finite field of degree 3 over GF(7), x)
 
 julia> S, y = FiniteField(ZZ(12431351431561), 2, "y")
@@ -21,7 +21,7 @@
 11
 
 julia> d = U(7)
-7

Basic manipulation

AbstractAlgebra.genMethod
gen(a::FqPolyRepField)

Return the generator of the finite field. Note that this is only guaranteed to be a multiplicative generator if the finite field is generated by a Conway polynomial automatically.

source
AbstractAlgebra.is_genMethod
is_gen(a::FqPolyRepFieldElem)

Return true if the given finite field element is the generator of the finite field, otherwise return false.

source
AbstractAlgebra.coeffMethod
coeff(x::FqPolyRepFieldElem, n::Int)

Return the degree $n$ coefficient of the polynomial representing the given finite field element.

source

Examples

julia> R, x = FiniteField(ZZ(7), 5, "x")
+7

Basic manipulation

AbstractAlgebra.genMethod
gen(a::FqPolyRepField)

Return the generator of the finite field. Note that this is only guaranteed to be a multiplicative generator if the finite field is generated by a Conway polynomial automatically.

source
AbstractAlgebra.is_genMethod
is_gen(a::FqPolyRepFieldElem)

Return true if the given finite field element is the generator of the finite field, otherwise return false.

source
AbstractAlgebra.coeffMethod
coeff(x::FqPolyRepFieldElem, n::Int)

Return the degree $n$ coefficient of the polynomial representing the given finite field element.

source

Examples

julia> R, x = FiniteField(ZZ(7), 5, "x")
 (Finite field of degree 5 over GF(7), x)
 
 julia> c = gen(R)
@@ -37,7 +37,7 @@
 5
 
 julia> n = is_gen(x)
-true

Special functions

Various special functions with finite field specific behaviour are defined.

LinearAlgebra.trMethod
tr(x::FqPolyRepFieldElem)

Return the trace of $x$. This is an element of $\mathbb{F}_p$, but the value returned is this value embedded in the original finite field.

source
LinearAlgebra.normMethod
norm(x::FqPolyRepFieldElem)

Return the norm of $x$. This is an element of $\mathbb{F}_p$, but the value returned is this value embedded in the original finite field.

source
Nemo.frobeniusMethod
frobenius(x::FqPolyRepFieldElem, n = 1)

Return the iterated Frobenius $\sigma_p^n(x)$ where $\sigma_p$ is the Frobenius map sending the element $a$ to $a^p$ in the finite field of characteristic $p$. By default the Frobenius map is applied $n = 1$ times if $n$ is not specified.

source
Nemo.pth_rootMethod
pth_root(x::FqPolyRepFieldElem)

Return the $p$-th root of $x$ in the finite field of characteristic $p$. This is the inverse operation to the Frobenius map $\sigma_p$.

source

Examples

julia> R, x = FiniteField(ZZ(7), 5, "x")
+true

Special functions

Various special functions with finite field specific behaviour are defined.

LinearAlgebra.trMethod
tr(x::FqPolyRepFieldElem)

Return the trace of $x$. This is an element of $\mathbb{F}_p$, but the value returned is this value embedded in the original finite field.

source
LinearAlgebra.normMethod
norm(x::FqPolyRepFieldElem)

Return the norm of $x$. This is an element of $\mathbb{F}_p$, but the value returned is this value embedded in the original finite field.

source
Nemo.frobeniusMethod
frobenius(x::FqPolyRepFieldElem, n = 1)

Return the iterated Frobenius $\sigma_p^n(x)$ where $\sigma_p$ is the Frobenius map sending the element $a$ to $a^p$ in the finite field of characteristic $p$. By default the Frobenius map is applied $n = 1$ times if $n$ is not specified.

source
Nemo.pth_rootMethod
pth_root(x::FqPolyRepFieldElem)

Return the $p$-th root of $x$ in the finite field of characteristic $p$. This is the inverse operation to the Frobenius map $\sigma_p$.

source

Examples

julia> R, x = FiniteField(ZZ(7), 5, "x")
 (Finite field of degree 5 over GF(7), x)
 
 julia> a = x^4 + 3x^2 + 6x + 1
@@ -56,7 +56,7 @@
 3*x^4 + 3*x^3 + 3*x^2 + x + 4
 
 julia> g = pth_root(a)
-4*x^4 + 3*x^3 + 4*x^2 + 5*x + 2

Lift

AbstractAlgebra.liftMethod
lift(R::FpPolyRing, x::FqPolyRepFieldElem)

Lift the finite field element x to a polynomial over the prime field.

source

Examples

julia> R, x = FiniteField(23, 2, "x")
+4*x^4 + 3*x^3 + 4*x^2 + 5*x + 2

Lift

AbstractAlgebra.liftMethod
lift(R::FpPolyRing, x::FqPolyRepFieldElem)

Lift the finite field element x to a polynomial over the prime field.

source

Examples

julia> R, x = FiniteField(23, 2, "x")
 (Finite field of degree 2 over GF(23), x)
 
 julia> S, y = polynomial_ring(GF(23), "y")
@@ -68,6 +68,6 @@
 julia> lift(S, f)
 8*y + 9

Uniform finite fields

An (experimental) uniform finite field interface is provided by the type FqField. Such a finite field can be constructed as an extension of a prime field $\mathbf{F}_p$ (an absolute extension) or of another finite field (a relative extension). The field over which the extension is constructed is referred to as the base field and field theoretic properties like the degree of an extension or the trace of an element are understood with respect to the base field. The corresponding functionality for the implicit absolute extension over the prime field is available by methods with the prefix absolute_.

Note that all finite fields are simple extension $k[t]/(f)$ of their base field $k$. The irreducible polynomial $f \in k[t]$ is the defining polynomial and the class of $t$ is referred to as the generator of the extension.

Construction of finite fields

Nemo._FiniteFieldFunction
_FiniteField(q::IntegerUnion, s::String; cached::Bool, check::Bool)
 _FiniteField(p::IntegerUnion, d::Int, s::String; cached::Bool, check::Bool)
-_FiniteField(f::FqPolyRingElem; s::String; cached::Bool, check::Bool)

Return a tuple $S, x$ consisting of a finite field $S$ of order $q = p^d$ and algebra generator $x$. The string $s$ is used to designate how the finite field generator will be printed.

If a polynomial $f \in k[t]$ over a finite field $k$ is specified, the finite field $S = k[t]/(f)$ will be constructed as a finite field with base field $k$.

source
Nemo._GFFunction
_GF(q::IntegerUnion, s::String; cached::Bool, check::Bool)
+_FiniteField(f::FqPolyRingElem; s::String; cached::Bool, check::Bool)

Return a tuple $S, x$ consisting of a finite field $S$ of order $q = p^d$ and algebra generator $x$. The string $s$ is used to designate how the finite field generator will be printed.

If a polynomial $f \in k[t]$ over a finite field $k$ is specified, the finite field $S = k[t]/(f)$ will be constructed as a finite field with base field $k$.

source
Nemo._GFFunction
_GF(q::IntegerUnion, s::String; cached::Bool, check::Bool)
 _GF(p::IntegerUnion, d::Int, s::String; cached::Bool, check::Bool)
-_GF(f::FqPolyRingElem; s::String; cached::Bool, check::Bool)

Return a finite field $S$ of order $q = p^d$. The string $s$ is used to designate how the finite field generator will be printed.

If a polynomial $f \in k[t]$ over a finite field $k$ is specified, the finite field $S = k[t]/(f)$ will be constructed as a finite field with base field $k$.

source

Field properties

Nemo.is_absoluteMethod
is_absolute(F::FqField)

Return whether the base field of $F$ is a prime field.

source
AbstractAlgebra.Generic.defining_polynomialMethod
defining_polynomial([R::FqPolyRing], L::FqField)

Return the defining polynomial of L as a polynomial over the base field of L.

If the polynomial ring R is specified, the polynomial will be an element of R.

source

Element properties

LinearAlgebra.trMethod
tr(x::FqFieldElem)

Return the trace of $x$. This is an element of the base field.

source
Nemo.absolute_trMethod
absolute_tr(x::FqFieldElem)

Return the absolute trace of $x$. This is an element of the prime field.

source
Nemo.absolute_normMethod
absolute_norm(x::FqFieldElem)

Return the absolute norm of $x$. This is an element of the prime field.

source
AbstractAlgebra.liftMethod
lift(R::FqPolyRing, a::FqFieldElem) -> FqPolyRingElem

Given a polynomial ring over the base field of the parent of a, return a lift such that parent(a)(lift(R, a)) == a is true.

source
+_GF(f::FqPolyRingElem; s::String; cached::Bool, check::Bool)

Return a finite field $S$ of order $q = p^d$. The string $s$ is used to designate how the finite field generator will be printed.

If a polynomial $f \in k[t]$ over a finite field $k$ is specified, the finite field $S = k[t]/(f)$ will be constructed as a finite field with base field $k$.

source

Field properties

AbstractAlgebra.Generic.base_fieldMethod
base_field(F::FqField)

Return the base field of F.

source
Nemo.prime_fieldMethod
prime_field(F::FqField)

Return the prime field of F.

source
AbstractAlgebra.degreeMethod
degree(a::FqField)

Return the degree of the given finite field over the base field.

source
Nemo.absolute_degreeMethod
absolute_degree(a::FqField)

Return the degree of the given finite field over the prime field.

source
Nemo.is_absoluteMethod
is_absolute(F::FqField)

Return whether the base field of $F$ is a prime field.

source
AbstractAlgebra.Generic.defining_polynomialMethod
defining_polynomial([R::FqPolyRing], L::FqField)

Return the defining polynomial of L as a polynomial over the base field of L.

If the polynomial ring R is specified, the polynomial will be an element of R.

source

Element properties

LinearAlgebra.trMethod
tr(x::FqFieldElem)

Return the trace of $x$. This is an element of the base field.

source
Nemo.absolute_trMethod
absolute_tr(x::FqFieldElem)

Return the absolute trace of $x$. This is an element of the prime field.

source
LinearAlgebra.normMethod
norm(x::FqFieldElem)

Return the norm of $x$. This is an element of the base field.

source
Nemo.absolute_normMethod
absolute_norm(x::FqFieldElem)

Return the absolute norm of $x$. This is an element of the prime field.

source
AbstractAlgebra.liftMethod
lift(R::FqPolyRing, a::FqFieldElem) -> FqPolyRingElem

Given a polynomial ring over the base field of the parent of a, return a lift such that parent(a)(lift(R, a)) == a is true.

source
diff --git a/dev/fraction/index.html b/dev/fraction/index.html index 8e91e54e3..230d1bfe9 100644 --- a/dev/fraction/index.html +++ b/dev/fraction/index.html @@ -1,6 +1,6 @@ Fraction fields · Nemo.jl

Fraction fields

Nemo allows the creation of fraction fields over any ring $R$. We don't require $R$ to be an integral domain, however no attempt is made to deal with the general case. Two fractions $a/b$ and $c/d$ are equal in Nemo iff $ad = bc$. Thus, in practice, a greatest common divisor function is currently required for the ring $R$.

In order to make the representation $a/b$ unique for printing, we have a notion of canonical unit for elements of a ring $R$. When canonicalising $a/b$, each of the elements $a$ and $b$ is first divided by the canonical unit of $b$.

The canonical_unit function is defined for elements of every Nemo ring. It must have the properties

canonical_unit(u) == u
-canonical_unit(a*b) == canonical_unit(a)*canonical_unit(b)

for any unit $u$ of the ring in question, and $a$ and $b$ arbitrary elements of the ring.

For example, the canonical unit of an integer is its sign. Thus a fraction of integers always has positive denominator after canonicalisation.

The canonical unit of a polynomial is the canonical unit of its leading coefficient, etc.

There are two different kinds of implementation of fraction fields in Nemo: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of fractions over specific rings, usually provided by C/C++ libraries.

The following table shows each of the fraction types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of fraction (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.Frac{T}Generic.FracField{T}
$\mathbb{Z}$FlintQQFieldElemQQField

All fraction element types belong to the abstract type FracElem and all of the fraction field types belong to the abstract type FracField. This enables one to write generic functions that can accept any Nemo fraction type.

Fraction functionality

All fraction types in Nemo provide functionality for fields described in AbstractAlgebra.jl:

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

In addition all the fraction field functionality of AbstractAlgebra.jl is provided, along with generic fractions fields as described here:

https://nemocas.github.io/AbstractAlgebra.jl/stable/fraction

Basic manipulation

Base.signMethod
sign(a::QQFieldElem)

Return the sign of $a$ ($-1$, $0$ or $1$) as a fraction.

source
Nemo.heightMethod
height(a::QQFieldElem)

Return the height of the fraction $a$, namely the largest of the absolute values of the numerator and denominator.

source
Nemo.height_bitsMethod
height_bits(a::QQFieldElem)

Return the number of bits of the height of the fraction $a$.

source
Base.:<<Method
<<(a::QQFieldElem, b::Int)

Return $a \times 2^b$.

source
Base.floorMethod
floor(a::QQFieldElem)

Return the greatest integer that is less than or equal to $a$. The result is returned as a rational with denominator $1$.

source
Base.ceilMethod
ceil(a::QQFieldElem)

Return the least integer that is greater than or equal to $a$. The result is returned as a rational with denominator $1$.

source

Examples

julia> d = abs(ZZ(11)//3)
+canonical_unit(a*b) == canonical_unit(a)*canonical_unit(b)

for any unit $u$ of the ring in question, and $a$ and $b$ arbitrary elements of the ring.

For example, the canonical unit of an integer is its sign. Thus a fraction of integers always has positive denominator after canonicalisation.

The canonical unit of a polynomial is the canonical unit of its leading coefficient, etc.

There are two different kinds of implementation of fraction fields in Nemo: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of fractions over specific rings, usually provided by C/C++ libraries.

The following table shows each of the fraction types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of fraction (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.Frac{T}Generic.FracField{T}
$\mathbb{Z}$FlintQQFieldElemQQField

All fraction element types belong to the abstract type FracElem and all of the fraction field types belong to the abstract type FracField. This enables one to write generic functions that can accept any Nemo fraction type.

Fraction functionality

All fraction types in Nemo provide functionality for fields described in AbstractAlgebra.jl:

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

In addition all the fraction field functionality of AbstractAlgebra.jl is provided, along with generic fractions fields as described here:

https://nemocas.github.io/AbstractAlgebra.jl/stable/fraction

Basic manipulation

Base.signMethod
sign(a::QQFieldElem)

Return the sign of $a$ ($-1$, $0$ or $1$) as a fraction.

source
Nemo.heightMethod
height(a::QQFieldElem)

Return the height of the fraction $a$, namely the largest of the absolute values of the numerator and denominator.

source
Nemo.height_bitsMethod
height_bits(a::QQFieldElem)

Return the number of bits of the height of the fraction $a$.

source
Base.:<<Method
<<(a::QQFieldElem, b::Int)

Return $a \times 2^b$.

source
Base.floorMethod
floor(a::QQFieldElem)

Return the greatest integer that is less than or equal to $a$. The result is returned as a rational with denominator $1$.

source
Base.ceilMethod
ceil(a::QQFieldElem)

Return the least integer that is greater than or equal to $a$. The result is returned as a rational with denominator $1$.

source

Examples

julia> d = abs(ZZ(11)//3)
 11//3
 
 julia> 4 <= ZZ(7)//ZZ(3)
@@ -9,7 +9,7 @@
 4
 
 julia> mod(ZZ(1)//2, ZZ(5))
-3
source

Rational Reconstruction

Rational reconstruction is available for rational numbers.

Nemo.reconstructMethod
reconstruct(a::ZZRingElem, b::ZZRingElem)
+3
source

Rational Reconstruction

Rational reconstruction is available for rational numbers.

Nemo.reconstructMethod
reconstruct(a::ZZRingElem, b::ZZRingElem)
 reconstruct(a::ZZRingElem, b::Integer)
 reconstruct(a::Integer, b::ZZRingElem)
 reconstruct(a::Integer, b::Integer)

Attempt to return a rational number $n/d$ such that $0 \leq |n| \leq \lfloor\sqrt{m/2}\rfloor$ and $0 < d \leq \lfloor\sqrt{m/2}\rfloor$ such that gcd$(n, d) = 1$ and $a \equiv nd^{-1} \pmod{m}$. If no solution exists, an exception is thrown.

Examples

julia> a = reconstruct(7, 13)
@@ -19,18 +19,18 @@
 -1//2
 
 julia> c = reconstruct(ZZ(123), ZZ(237))
-9//2
source

Rational enumeration

Various methods exist to enumerate rationals.

Nemo.next_minimalMethod
next_minimal(a::QQFieldElem)

Given $a$, return the next rational number in the sequence obtained by enumerating all positive denominators $q$, and for each $q$ enumerating the numerators $1 \le p < q$ in order and generating both $p/q$ and $q/p$, but skipping all gcd$(p,q) \neq 1$. Starting with zero, this generates every nonnegative rational number once and only once, with the first few entries being $0, 1, 1/2, 2, 1/3, 3, 2/3, 3/2, 1/4, 4, 3/4, 4/3, \ldots$. This enumeration produces the rational numbers in order of minimal height. It has the disadvantage of being somewhat slower to compute than the Calkin-Wilf enumeration. If $a < 0$ we throw a DomainError().

Examples

julia> next_minimal(ZZ(2)//3)
-3//2
source
Nemo.next_signed_minimalMethod
next_signed_minimal(a::QQFieldElem)

Given a signed rational number $a$ assumed to be in canonical form, return the next element in the minimal-height sequence generated by next_minimal but with negative numbers interleaved. The sequence begins $0, 1, -1, 1/2, -1/2, 2, -2, 1/3, -1/3, \ldots$. Starting with zero, this generates every rational number once and only once, in order of minimal height.

Examples

julia> next_signed_minimal(-ZZ(21)//31)
-31//21
source
Nemo.next_calkin_wilfMethod
next_calkin_wilf(a::QQFieldElem)

Return the next number after $a$ in the breadth-first traversal of the Calkin-Wilf tree. Starting with zero, this generates every nonnegative rational number once and only once, with the first few entries being $0, 1, 1/2, 2, 1/3, 3/2, 2/3, 3, 1/4, 4/3, 3/5, 5/2, 2/5, \ldots$. Despite the appearance of the initial entries, the Calkin-Wilf enumeration does not produce the rational numbers in order of height: some small fractions will appear late in the sequence. This order has the advantage of being faster to produce than the minimal-height order.

Examples

julia> next_calkin_wilf(ZZ(321)//113)
-113//244
source
Nemo.next_signed_calkin_wilfMethod
next_signed_calkin_wilf(a::QQFieldElem)

Given a signed rational number $a$ returns the next element in the Calkin-Wilf sequence with negative numbers interleaved. The sequence begins $0, 1, -1, 1/2, -1/2, 2, -2, 1/3, -1/3, \ldots$. Starting with zero, this generates every rational number once and only once, but not in order of minimal height.

Examples

julia> next_signed_calkin_wilf(-ZZ(51)//(17))
-1//4
source

Random generation

Nemo.rand_bitsMethod
rand_bits(::QQField, b::Int)

Return a random signed rational whose numerator and denominator both have $b$ bits before canonicalisation. Note that the resulting numerator and denominator can be smaller than $b$ bits.

source

Special functions

The following special functions are available for specific rings in Nemo.

Nemo.harmonicMethod
harmonic(n::Int)

Return the harmonic number $H_n = 1 + 1/2 + 1/3 + \cdots + 1/n$. Table lookup is used for $H_n$ whose numerator and denominator fit in a single limb. For larger $n$, a divide and conquer strategy is used.

Examples

julia> a = harmonic(12)
-86021//27720
source
Nemo.bernoulliMethod
bernoulli(n::Int)

Return the Bernoulli number $B_n$ for nonnegative $n$.

See also bernoulli_cache.

Examples

julia> d = bernoulli(12)
--691//2730
source
Nemo.bernoulli_cacheMethod
bernoulli_cache(n::Int)

Precomputes and caches all the Bernoulli numbers up to $B_n$. This is much faster than repeatedly calling bernoulli(k). Once cached, subsequent calls to bernoulli(k) for any $k \le n$ will read from the cache, making them virtually free.

See also bernoulli.

Examples

julia> bernoulli_cache(100)
+9//2
source

Rational enumeration

Various methods exist to enumerate rationals.

Nemo.next_minimalMethod
next_minimal(a::QQFieldElem)

Given $a$, return the next rational number in the sequence obtained by enumerating all positive denominators $q$, and for each $q$ enumerating the numerators $1 \le p < q$ in order and generating both $p/q$ and $q/p$, but skipping all gcd$(p,q) \neq 1$. Starting with zero, this generates every nonnegative rational number once and only once, with the first few entries being $0, 1, 1/2, 2, 1/3, 3, 2/3, 3/2, 1/4, 4, 3/4, 4/3, \ldots$. This enumeration produces the rational numbers in order of minimal height. It has the disadvantage of being somewhat slower to compute than the Calkin-Wilf enumeration. If $a < 0$ we throw a DomainError().

Examples

julia> next_minimal(ZZ(2)//3)
+3//2
source
Nemo.next_signed_minimalMethod
next_signed_minimal(a::QQFieldElem)

Given a signed rational number $a$ assumed to be in canonical form, return the next element in the minimal-height sequence generated by next_minimal but with negative numbers interleaved. The sequence begins $0, 1, -1, 1/2, -1/2, 2, -2, 1/3, -1/3, \ldots$. Starting with zero, this generates every rational number once and only once, in order of minimal height.

Examples

julia> next_signed_minimal(-ZZ(21)//31)
+31//21
source
Nemo.next_calkin_wilfMethod
next_calkin_wilf(a::QQFieldElem)

Return the next number after $a$ in the breadth-first traversal of the Calkin-Wilf tree. Starting with zero, this generates every nonnegative rational number once and only once, with the first few entries being $0, 1, 1/2, 2, 1/3, 3/2, 2/3, 3, 1/4, 4/3, 3/5, 5/2, 2/5, \ldots$. Despite the appearance of the initial entries, the Calkin-Wilf enumeration does not produce the rational numbers in order of height: some small fractions will appear late in the sequence. This order has the advantage of being faster to produce than the minimal-height order.

Examples

julia> next_calkin_wilf(ZZ(321)//113)
+113//244
source
Nemo.next_signed_calkin_wilfMethod
next_signed_calkin_wilf(a::QQFieldElem)

Given a signed rational number $a$ returns the next element in the Calkin-Wilf sequence with negative numbers interleaved. The sequence begins $0, 1, -1, 1/2, -1/2, 2, -2, 1/3, -1/3, \ldots$. Starting with zero, this generates every rational number once and only once, but not in order of minimal height.

Examples

julia> next_signed_calkin_wilf(-ZZ(51)//(17))
+1//4
source

Random generation

Nemo.rand_bitsMethod
rand_bits(::QQField, b::Int)

Return a random signed rational whose numerator and denominator both have $b$ bits before canonicalisation. Note that the resulting numerator and denominator can be smaller than $b$ bits.

source

Special functions

The following special functions are available for specific rings in Nemo.

Nemo.harmonicMethod
harmonic(n::Int)

Return the harmonic number $H_n = 1 + 1/2 + 1/3 + \cdots + 1/n$. Table lookup is used for $H_n$ whose numerator and denominator fit in a single limb. For larger $n$, a divide and conquer strategy is used.

Examples

julia> a = harmonic(12)
+86021//27720
source
Nemo.bernoulliMethod
bernoulli(n::Int)

Return the Bernoulli number $B_n$ for nonnegative $n$.

See also bernoulli_cache.

Examples

julia> d = bernoulli(12)
+-691//2730
source
Nemo.bernoulli_cacheMethod
bernoulli_cache(n::Int)

Precomputes and caches all the Bernoulli numbers up to $B_n$. This is much faster than repeatedly calling bernoulli(k). Once cached, subsequent calls to bernoulli(k) for any $k \le n$ will read from the cache, making them virtually free.

See also bernoulli.

Examples

julia> bernoulli_cache(100)
 
 julia> e = bernoulli(100)
--94598037819122125295227433069493721872702841533066936133385696204311395415197247711//33330
source
Nemo.dedekind_sumMethod
dedekind_sum(h::ZZRingElem, k::ZZRingElem)

Return the Dedekind sum $s(h,k)$ for arbitrary $h$ and $k$.

Examples

julia> b = dedekind_sum(12, 13)
+-94598037819122125295227433069493721872702841533066936133385696204311395415197247711//33330
source
Nemo.dedekind_sumMethod
dedekind_sum(h::ZZRingElem, k::ZZRingElem)

Return the Dedekind sum $s(h,k)$ for arbitrary $h$ and $k$.

Examples

julia> b = dedekind_sum(12, 13)
 -11//13
 
 julia> c = dedekind_sum(-120, ZZ(1305))
--575//522
source
Nemo.simplest_betweenMethod
  simplest_between(l::QQFieldElem, r::QQFieldElem)

Return the simplest fraction in the closed interval $[l, r]$. A canonical fraction $a_1 / b_1$ is defined to be simpler than $a_2 / b_2$ if and only if $b_1 < b_2$ or $b_1 = b_2$ and $a_1 < a_2$.

Examples

julia> simplest_between(QQ(1//10), QQ(3//10))
-1//4
source
+-575//522source
Nemo.simplest_betweenMethod
  simplest_between(l::QQFieldElem, r::QQFieldElem)

Return the simplest fraction in the closed interval $[l, r]$. A canonical fraction $a_1 / b_1$ is defined to be simpler than $a_2 / b_2$ if and only if $b_1 < b_2$ or $b_1 = b_2$ and $a_1 < a_2$.

Examples

julia> simplest_between(QQ(1//10), QQ(3//10))
+1//4
source
diff --git a/dev/gfp/index.html b/dev/gfp/index.html index a4539cc7a..eb6f440bd 100644 --- a/dev/gfp/index.html +++ b/dev/gfp/index.html @@ -8,4 +8,4 @@ 3 julia> b = order(F) -3 +3 diff --git a/dev/index.html b/dev/index.html index e174d3c9f..758aead68 100644 --- a/dev/index.html +++ b/dev/index.html @@ -71,4 +71,4 @@ Arb = "/prefix/for/libarb" [e21ec000-9f72-519e-ba6d-10061e575a27] -Antic = "/prefix/for/libantic"

(If only a specific library should be overridden, only the specific entry should be added.)

Experimental threading support for flint

Enabling a threaded version of flint can be done by setting the environment variable NEMO_THREADED=1. To set the actual number of threads, use Nemo.flint_set_num_threads($numberofthreads).

+Antic = "/prefix/for/libantic"

(If only a specific library should be overridden, only the specific entry should be added.)

Experimental threading support for flint

Enabling a threaded version of flint can be done by setting the environment variable NEMO_THREADED=1. To set the actual number of threads, use Nemo.flint_set_num_threads($numberofthreads).

diff --git a/dev/integer/index.html b/dev/integer/index.html index 51539f525..b2be74c0d 100644 --- a/dev/integer/index.html +++ b/dev/integer/index.html @@ -2,7 +2,7 @@ Integers · Nemo.jl

Integers

The default integer type in Nemo is provided by Flint. The associated ring of integers is represented by the constant parent object called FlintZZ.

For convenience we define

ZZ = FlintZZ

so that integers can be constructed using ZZ instead of FlintZZ. Note that this is the name of a specific parent object, not the name of its type.

The types of the integer ring parent objects and elements of the associated rings of integers are given in the following table according to the library providing them.

LibraryElement typeParent type
FlintZZRingElemZZRing

All integer element types belong directly to the abstract type RingElem and all the integer ring parent object types belong to the abstract type Ring.

A lot of code will want to accept both ZZRingElem integers and Julia integers, that is, subtypes of Base.Integer. Thus for convenience we define

IntegerUnion = Union{Integer,ZZRingElem}

Integer functionality

Nemo integers provide all of the ring and Euclidean ring functionality of AbstractAlgebra.jl.

https://nemocas.github.io/AbstractAlgebra.jl/stable/ring

https://nemocas.github.io/AbstractAlgebra.jl/stable/euclidean_interface

Below, we describe the functionality that is specific to the Nemo/Flint integer ring.

Constructors

ZZ(n::Integer)

Coerce a Julia integer value into the integer ring.

ZZ(n::String)

Parse the given string as an integer.

ZZ(n::Float64)
 ZZ(n::Float32)
 ZZ(n::Float16)
-ZZ(n::BigFloat)

Coerce the given floating point number into the integer ring, assuming that it can be exactly represented as an integer.

Basic manipulation

Base.signMethod
sign(a::ZZRingElem)

Return the sign of $a$, i.e. $+1$, $0$ or $-1$.

source
Base.sizeMethod
size(a::ZZRingElem)

Return the number of limbs required to store the absolute value of $a$.

source
Nemo.fitsMethod
fits(::Type{UInt}, a::ZZRingElem)

Return true if $a$ fits into a UInt, otherwise return false.

source
Nemo.fitsMethod
fits(::Type{Int}, a::ZZRingElem)

Return true if $a$ fits into an Int, otherwise return false.

source
Base.denominatorMethod
denominator(a::ZZRingElem)

Return the denominator of $a$ thought of as a rational. Always returns $1$.

source
Base.numeratorMethod
numerator(a::ZZRingElem)

Return the numerator of $a$ thought of as a rational. Always returns $a$.

source

Examples

julia> a = ZZ(12)
+ZZ(n::BigFloat)

Coerce the given floating point number into the integer ring, assuming that it can be exactly represented as an integer.

Basic manipulation

Base.signMethod
sign(a::ZZRingElem)

Return the sign of $a$, i.e. $+1$, $0$ or $-1$.

source
Base.sizeMethod
size(a::ZZRingElem)

Return the number of limbs required to store the absolute value of $a$.

source
Nemo.fitsMethod
fits(::Type{UInt}, a::ZZRingElem)

Return true if $a$ fits into a UInt, otherwise return false.

source
Nemo.fitsMethod
fits(::Type{Int}, a::ZZRingElem)

Return true if $a$ fits into an Int, otherwise return false.

source
Base.denominatorMethod
denominator(a::ZZRingElem)

Return the denominator of $a$ thought of as a rational. Always returns $1$.

source
Base.numeratorMethod
numerator(a::ZZRingElem)

Return the numerator of $a$ thought of as a rational. Always returns $a$.

source

Examples

julia> a = ZZ(12)
 12
 
 julia> is_unit(a)
@@ -59,7 +59,7 @@
 false
 
 julia> cmpabs(a, b)
-1

Shifting

Base.:<<Method
<<(x::ZZRingElem, c::Int)

Return $2^cx$ where $c \geq 0$.

source
Base.:>>Method
>>(x::ZZRingElem, c::Int)

Return $x/2^c$, discarding any remainder, where $c \geq 0$.

source

Examples

julia> a = ZZ(12)
+1

Shifting

Base.:<<Method
<<(x::ZZRingElem, c::Int)

Return $2^cx$ where $c \geq 0$.

source
Base.:>>Method
>>(x::ZZRingElem, c::Int)

Return $x/2^c$, discarding any remainder, where $c \geq 0$.

source

Examples

julia> a = ZZ(12)
 12
 
 julia> a << 3
@@ -67,7 +67,7 @@
 
 julia> a >> 5
 0

Modular arithmetic

Nemo.sqrtmodMethod
sqrtmod(x::ZZRingElem, m::ZZRingElem)

Return a square root of $x (\mod m)$ if one exists. The remainder will be in the range $[0, m)$. We require that $m$ is prime, otherwise the algorithm may not terminate.

Examples

julia> sqrtmod(ZZ(12), ZZ(13))
-5
source
AbstractAlgebra.crtFunction
crt(r1::ZZRingElem, m1::ZZRingElem, r2::ZZRingElem, m2::ZZRingElem, signed=false; check::Bool=true)
+5
source
AbstractAlgebra.crtFunction
crt(r1::ZZRingElem, m1::ZZRingElem, r2::ZZRingElem, m2::ZZRingElem, signed=false; check::Bool=true)
 crt(r1::ZZRingElem, m1::ZZRingElem, r2::Union{Int, UInt}, m2::Union{Int, UInt}, signed=false; check::Bool=true)
 crt(r::Vector{ZZRingElem}, m::Vector{ZZRingElem}, signed=false; check::Bool=true)
 crt_with_lcm(r1::ZZRingElem, m1::ZZRingElem, r2::ZZRingElem, m2::ZZRingElem, signed=false; check::Bool=true)
@@ -76,27 +76,27 @@
 44
 
 julia> crt(ZZ(5), ZZ(13), 7, 37, true)
-44
source

Integer logarithm

Integer logarithm

Nemo.flogMethod
flog(x::ZZRingElem, c::ZZRingElem)
 flog(x::ZZRingElem, c::Int)

Return the floor of the logarithm of $x$ to base $c$.

Examples

julia> flog(ZZ(12), ZZ(2))
 3
 
 julia> flog(ZZ(12), 3)
 2
-
source
Nemo.clogMethod
clog(x::ZZRingElem, c::ZZRingElem)
 clog(x::ZZRingElem, c::Int)

Return the ceiling of the logarithm of $x$ to base $c$.

Examples

julia> clog(ZZ(12), ZZ(2))
 4
 
 julia> clog(ZZ(12), 3)
 3
-
source

Integer roots

Base.isqrtMethod
isqrt(x::ZZRingElem)

Return the floor of the square root of $x$.

Examples

julia> isqrt(ZZ(13))
+
source

Integer roots

Base.isqrtMethod
isqrt(x::ZZRingElem)

Return the floor of the square root of $x$.

Examples

julia> isqrt(ZZ(13))
 3
-
source
Nemo.isqrtremMethod
isqrtrem(x::ZZRingElem)

Return a tuple $s, r$ consisting of the floor $s$ of the square root of $x$ and the remainder $r$, i.e. such that $x = s^2 + r$. We require $x \geq 0$.

Examples

julia> isqrtrem(ZZ(13))
+
source
Nemo.isqrtremMethod
isqrtrem(x::ZZRingElem)

Return a tuple $s, r$ consisting of the floor $s$ of the square root of $x$ and the remainder $r$, i.e. such that $x = s^2 + r$. We require $x \geq 0$.

Examples

julia> isqrtrem(ZZ(13))
 (3, 4)
-
source
AbstractAlgebra.rootMethod
root(x::ZZRingElem, n::Int; check::Bool=true)

Return the $n$-the root of $x$. We require $n > 0$ and that $x \geq 0$ if $n$ is even. By default the function tests whether the input was a perfect $n$-th power and if not raises an exception. If check=false this check is omitted.

Examples

julia> root(ZZ(27), 3; check=true)
-3
source
AbstractAlgebra.irootMethod
iroot(x::ZZRingElem, n::Int)

Return the integer truncation of the $n$-the root of $x$ (round towards zero). We require $n > 0$ and that $x \geq 0$ if $n$ is even.

Examples

julia> iroot(ZZ(13), 3)
-2
source

Number theoretic functionality

Nemo.divisibleMethod
divisible(x::ZZRingElem, y::Int)

Return true if $x$ is divisible by $y$, otherwise return false. We require $x \neq 0$.

source
Nemo.divisibleMethod
divisible(x::ZZRingElem, y::ZZRingElem)

Return true if $x$ is divisible by $y$, otherwise return false. We require $x \neq 0$.

source
AbstractAlgebra.is_squareMethod
is_square(f::PolyRingElem{T}) where T <: RingElement

Return true if $f$ is a perfect square.

is_square(a::FracElem{T}) where T <: RingElem

Return true if $a$ is a square.

AbstractAlgebra.rootMethod
root(x::ZZRingElem, n::Int; check::Bool=true)

Return the $n$-the root of $x$. We require $n > 0$ and that $x \geq 0$ if $n$ is even. By default the function tests whether the input was a perfect $n$-th power and if not raises an exception. If check=false this check is omitted.

Examples

julia> root(ZZ(27), 3; check=true)
+3
source
AbstractAlgebra.irootMethod
iroot(x::ZZRingElem, n::Int)

Return the integer truncation of the $n$-the root of $x$ (round towards zero). We require $n > 0$ and that $x \geq 0$ if $n$ is even.

Examples

julia> iroot(ZZ(13), 3)
+2
source

Number theoretic functionality

Nemo.divisibleMethod
divisible(x::ZZRingElem, y::Int)

Return true if $x$ is divisible by $y$, otherwise return false. We require $x \neq 0$.

source
Nemo.divisibleMethod
divisible(x::ZZRingElem, y::ZZRingElem)

Return true if $x$ is divisible by $y$, otherwise return false. We require $x \neq 0$.

source
AbstractAlgebra.is_squareMethod
is_square(f::PolyRingElem{T}) where T <: RingElement

Return true if $f$ is a perfect square.

is_square(a::FracElem{T}) where T <: RingElem

Return true if $a$ is a square.

Nemo.is_primeMethod
is_prime(x::ZZRingElem)
 is_prime(x::Int)

Return true if $x$ is a prime number, otherwise return false.

Examples

julia> is_prime(ZZ(13))
-true
source
AbstractAlgebra.is_probable_primeMethod
is_probable_prime(x::ZZRingElem)

Return true if $x$ is very probably a prime number, otherwise return false. No counterexamples are known to this test, but it is conjectured that infinitely many exist.

source
AbstractAlgebra.is_probable_primeMethod
is_probable_prime(x::ZZRingElem)

Return true if $x$ is very probably a prime number, otherwise return false. No counterexamples are known to this test, but it is conjectured that infinitely many exist.

source
AbstractAlgebra.factorMethod
factor(a::ZZRingElem)
 factor(a::UInt)
 factor(a::Int)

Return a factorisation of $a$ using a Fac struct (see the documentation on factorisation in Nemo).

Examples

julia> factor(ZZ(12))
 1 * 2^2 * 3
@@ -106,9 +106,9 @@
 
 julia> factor(12)
 1 * 2^2 * 3
-
source
Nemo.divisor_lenstraMethod
divisor_lenstra(n::ZZRingElem, r::ZZRingElem, m::ZZRingElem)

If $n$ has a factor which lies in the residue class $r (\mod m)$ for $0 < r < m < n$, this function returns such a factor. Otherwise it returns $0$. This is only efficient if $m$ is at least the cube root of $n$. We require gcd$(r, m) = 1$ and this condition is not checked.

source
Base.factorialMethod
factorial(x::ZZRingElem)

Return the factorial of $x$, i.e. $x! = 1.2.3\ldots x$. We require $x \geq 0$.

Examples

julia> factorial(ZZ(100))
-93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
source
Nemo.rising_factorialMethod
rising_factorial(x::ZZRingElem, n::ZZRingElem)

Return the rising factorial of $x$, i.e. $x(x + 1)(x + 2)\cdots (x + n - 1)$. If $n < 0$ we throw a DomainError().

source
Nemo.rising_factorialMethod
rising_factorial(x::ZZRingElem, n::Int)

Return the rising factorial of $x$, i.e. $x(x + 1)(x + 2)\ldots (x + n - 1)$. If $n < 0$ we throw a DomainError().

source
Nemo.rising_factorialMethod
rising_factorial(x::Int, n::Int)

Return the rising factorial of $x$, i.e. $x(x + 1)(x + 2)\ldots (x + n - 1)$. If $n < 0$ we throw a DomainError().

source
Nemo.primorialMethod
primorial(x::ZZRingElem)

Return the primorial of $x$, i.e. the product of all primes less than or equal to $x$. If $x < 0$ we throw a DomainError().

source
Nemo.primorialMethod
primorial(x::Int)

Return the primorial of $x$, i.e. the product of all primes less than or equal to $x$. If $x < 0$ we throw a DomainError().

source
Nemo.fibonacciMethod
fibonacci(x::Int)

Return the $x$-th Fibonacci number $F_x$. We define $F_1 = 1$, $F_2 = 1$ and $F_{i + 1} = F_i + F_{i - 1}$ for all integers $i$.

source
Nemo.fibonacciMethod
fibonacci(x::ZZRingElem)

Return the $x$-th Fibonacci number $F_x$. We define $F_1 = 1$, $F_2 = 1$ and $F_{i + 1} = F_i + F_{i - 1}$ for all integers $i$.

source
Base.binomialMethod
binomial(n::ZZRingElem, k::ZZRingElem)

Return the binomial coefficient $\frac{n (n-1) \cdots (n-k+1)}{k!}$. If $k < 0$ we return $0$, and the identity binomial(n, k) == binomial(n - 1, k - 1) + binomial(n - 1, k) always holds for integers n and k.

source
Base.binomialMethod
binomial(n::UInt, k::UInt, ::ZZRing)

Return the binomial coefficient $\frac{n!}{(n - k)!k!}$ as an ZZRingElem.

source
Nemo.moebius_muMethod
moebius_mu(x::Int)

Return the Moebius mu function of $x$ as an Int. The value returned is either $-1$, $0$ or $1$. If $x \leq 0$ we throw a DomainError().

source
Nemo.moebius_muMethod
moebius_mu(x::ZZRingElem)

Return the Moebius mu function of $x$ as an Int. The value returned is either $-1$, $0$ or $1$. If $x \leq 0$ we throw a DomainError().

source
Nemo.jacobi_symbolMethod
jacobi_symbol(x::Int, y::Int)

Return the value of the Jacobi symbol $\left(\frac{x}{y}\right)$. The modulus $y$ must be odd and positive, otherwise a DomainError is thrown.

source
Nemo.jacobi_symbolMethod
jacobi_symbol(x::ZZRingElem, y::ZZRingElem)

Return the value of the Jacobi symbol $\left(\frac{x}{y}\right)$. The modulus $y$ must be odd and positive, otherwise a DomainError is thrown.

source
Nemo.kronecker_symbolMethod
kronecker_symbol(x::ZZRingElem, y::ZZRingElem)
-kronecker_symbol(x::Int, y::Int)

Return the value of the Kronecker symbol $\left(\frac{x}{y}\right)$. The definition is as per Henri Cohen's book, "A Course in Computational Algebraic Number Theory", Definition 1.4.8.

source
Nemo.divisor_lenstraMethod
divisor_lenstra(n::ZZRingElem, r::ZZRingElem, m::ZZRingElem)

If $n$ has a factor which lies in the residue class $r (\mod m)$ for $0 < r < m < n$, this function returns such a factor. Otherwise it returns $0$. This is only efficient if $m$ is at least the cube root of $n$. We require gcd$(r, m) = 1$ and this condition is not checked.

source
Base.factorialMethod
factorial(x::ZZRingElem)

Return the factorial of $x$, i.e. $x! = 1.2.3\ldots x$. We require $x \geq 0$.

Examples

julia> factorial(ZZ(100))
+93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
source
Nemo.rising_factorialMethod
rising_factorial(x::ZZRingElem, n::ZZRingElem)

Return the rising factorial of $x$, i.e. $x(x + 1)(x + 2)\cdots (x + n - 1)$. If $n < 0$ we throw a DomainError().

source
Nemo.rising_factorialMethod
rising_factorial(x::ZZRingElem, n::Int)

Return the rising factorial of $x$, i.e. $x(x + 1)(x + 2)\ldots (x + n - 1)$. If $n < 0$ we throw a DomainError().

source
Nemo.rising_factorialMethod
rising_factorial(x::Int, n::Int)

Return the rising factorial of $x$, i.e. $x(x + 1)(x + 2)\ldots (x + n - 1)$. If $n < 0$ we throw a DomainError().

source
Nemo.primorialMethod
primorial(x::ZZRingElem)

Return the primorial of $x$, i.e. the product of all primes less than or equal to $x$. If $x < 0$ we throw a DomainError().

source
Nemo.primorialMethod
primorial(x::Int)

Return the primorial of $x$, i.e. the product of all primes less than or equal to $x$. If $x < 0$ we throw a DomainError().

source
Nemo.fibonacciMethod
fibonacci(x::Int)

Return the $x$-th Fibonacci number $F_x$. We define $F_1 = 1$, $F_2 = 1$ and $F_{i + 1} = F_i + F_{i - 1}$ for all integers $i$.

source
Nemo.fibonacciMethod
fibonacci(x::ZZRingElem)

Return the $x$-th Fibonacci number $F_x$. We define $F_1 = 1$, $F_2 = 1$ and $F_{i + 1} = F_i + F_{i - 1}$ for all integers $i$.

source
Base.binomialMethod
binomial(n::ZZRingElem, k::ZZRingElem)

Return the binomial coefficient $\frac{n (n-1) \cdots (n-k+1)}{k!}$. If $k < 0$ we return $0$, and the identity binomial(n, k) == binomial(n - 1, k - 1) + binomial(n - 1, k) always holds for integers n and k.

source
Base.binomialMethod
binomial(n::UInt, k::UInt, ::ZZRing)

Return the binomial coefficient $\frac{n!}{(n - k)!k!}$ as an ZZRingElem.

source
Nemo.moebius_muMethod
moebius_mu(x::Int)

Return the Moebius mu function of $x$ as an Int. The value returned is either $-1$, $0$ or $1$. If $x \leq 0$ we throw a DomainError().

source
Nemo.moebius_muMethod
moebius_mu(x::ZZRingElem)

Return the Moebius mu function of $x$ as an Int. The value returned is either $-1$, $0$ or $1$. If $x \leq 0$ we throw a DomainError().

source
Nemo.jacobi_symbolMethod
jacobi_symbol(x::Int, y::Int)

Return the value of the Jacobi symbol $\left(\frac{x}{y}\right)$. The modulus $y$ must be odd and positive, otherwise a DomainError is thrown.

source
Nemo.jacobi_symbolMethod
jacobi_symbol(x::ZZRingElem, y::ZZRingElem)

Return the value of the Jacobi symbol $\left(\frac{x}{y}\right)$. The modulus $y$ must be odd and positive, otherwise a DomainError is thrown.

source
Nemo.kronecker_symbolMethod
kronecker_symbol(x::ZZRingElem, y::ZZRingElem)
+kronecker_symbol(x::Int, y::Int)

Return the value of the Kronecker symbol $\left(\frac{x}{y}\right)$. The definition is as per Henri Cohen's book, "A Course in Computational Algebraic Number Theory", Definition 1.4.8.

source
Nemo.divisor_sigmaMethod
divisor_sigma(x::ZZRingElem, y::Int)
 divisor_sigma(x::ZZRingElem, y::ZZRingElem)
 divisor_sigma(x::Int, y::Int)

Return the value of the sigma function, i.e. $\sum_{0 < d \;| x} d^y$. If $x \leq 0$ or $y < 0$ we throw a DomainError().

Examples

julia> divisor_sigma(ZZ(32), 10)
 1127000493261825
@@ -117,51 +117,51 @@
 1127000493261825
 
 julia> divisor_sigma(32, 10)
-1127000493261825
source
Nemo.euler_phiMethod
euler_phi(x::ZZRingElem)
 euler_phi(x::Int)

Return the value of the Euler phi function at $x$, i.e. the number of positive integers up to $x$ (inclusive) that are coprime with $x$. An exception is raised if $x \leq 0$.

Examples

julia> euler_phi(ZZ(12480))
 3072
 
 julia> euler_phi(12480)
-3072
source
Nemo.number_of_partitionsMethod
number_of_partitions(x::Int)
 number_of_partitions(x::ZZRingElem)

Return the number of partitions of $x$.

Examples

julia> number_of_partitions(100)
 190569292
 
 julia> number_of_partitions(ZZ(1000))
-24061467864032622473692149727991
source
Nemo.is_perfect_powerMethod
is_perfect_power(a::IntegerUnion)

Returns whether $a$ is a perfect power, that is, whether $a = m^r$ for some integer $m$ and $r > 1$.

source
Nemo.is_prime_power_with_dataMethod
is_prime_power_with_data(q::IntegerUnion) -> Bool, ZZRingElem, Int

Returns a flag indicating whether $q$ is a prime power and integers $e, p$ such that $q = p^e$. If $q$ is a prime power, than $p$ is a prime.

source

Digits and bases

Base.binMethod
bin(n::ZZRingElem)

Return $n$ as a binary string.

Examples

julia> bin(ZZ(12))
-"1100"
source
Base.octMethod
oct(n::ZZRingElem)

Return $n$ as a octal string.

Examples

julia> oct(ZZ(12))
-"14"
source
Base.decMethod
dec(n::ZZRingElem)

Return $n$ as a decimal string.

Examples

julia> dec(ZZ(12))
-"12"
source
Base.hexMethod
hex(n::ZZRingElem) = base(n, 16)

Return $n$ as a hexadecimal string.

Examples

julia> hex(ZZ(12))
-"c"
source
Nemo.baseMethod
base(n::ZZRingElem, b::Integer)

Return $n$ as a string in base $b$. We require $2 \leq b \leq 62$.

Examples

julia> base(ZZ(12), 13)
-"c"
source
Base.ndigitsMethod
ndigits(x::ZZRingElem, b::Integer)

Return the number of digits of $x$ in the base $b$ (default is $b = 10$).

Examples

julia> ndigits(ZZ(12), 3)
-3
source
Nemo.nbitsMethod
nbits(x::ZZRingElem)

Return the number of binary bits of $x$. We return zero if $x = 0$.

Examples

julia> nbits(ZZ(12))
-4
source

Bit twiddling

Nemo.popcountMethod
popcount(x::ZZRingElem)

Return the number of ones in the binary representation of $x$.

Examples

julia> popcount(ZZ(12))
-2
source
Nemo.prevpow2Method
prevpow2(x::ZZRingElem)

Return the previous power of $2$ up to including $x$.

source
Nemo.nextpow2Method
nextpow2(x::ZZRingElem)

Return the next power of $2$ that is at least $x$.

Examples

julia> nextpow2(ZZ(12))
-16
source
Base.trailing_zerosMethod
trailing_zeros(x::ZZRingElem)

Return the number of trailing zeros in the binary representation of $x$.

source
Nemo.clrbit!Method
clrbit!(x::ZZRingElem, c::Int)

Clear bit $c$ of $x$, where the least significant bit is the $0$-th bit. Note that this function modifies its input in-place.

Examples

julia> a = ZZ(12)
+24061467864032622473692149727991
source
Nemo.is_perfect_powerMethod
is_perfect_power(a::IntegerUnion)

Returns whether $a$ is a perfect power, that is, whether $a = m^r$ for some integer $m$ and $r > 1$.

source
Nemo.is_prime_power_with_dataMethod
is_prime_power_with_data(q::IntegerUnion) -> Bool, ZZRingElem, Int

Returns a flag indicating whether $q$ is a prime power and integers $e, p$ such that $q = p^e$. If $q$ is a prime power, than $p$ is a prime.

source

Digits and bases

Base.binMethod
bin(n::ZZRingElem)

Return $n$ as a binary string.

Examples

julia> bin(ZZ(12))
+"1100"
source
Base.octMethod
oct(n::ZZRingElem)

Return $n$ as a octal string.

Examples

julia> oct(ZZ(12))
+"14"
source
Base.decMethod
dec(n::ZZRingElem)

Return $n$ as a decimal string.

Examples

julia> dec(ZZ(12))
+"12"
source
Base.hexMethod
hex(n::ZZRingElem) = base(n, 16)

Return $n$ as a hexadecimal string.

Examples

julia> hex(ZZ(12))
+"c"
source
Nemo.baseMethod
base(n::ZZRingElem, b::Integer)

Return $n$ as a string in base $b$. We require $2 \leq b \leq 62$.

Examples

julia> base(ZZ(12), 13)
+"c"
source
Base.ndigitsMethod
ndigits(x::ZZRingElem, b::Integer)

Return the number of digits of $x$ in the base $b$ (default is $b = 10$).

Examples

julia> ndigits(ZZ(12), 3)
+3
source
Nemo.nbitsMethod
nbits(x::ZZRingElem)

Return the number of binary bits of $x$. We return zero if $x = 0$.

Examples

julia> nbits(ZZ(12))
+4
source

Bit twiddling

Nemo.popcountMethod
popcount(x::ZZRingElem)

Return the number of ones in the binary representation of $x$.

Examples

julia> popcount(ZZ(12))
+2
source
Nemo.prevpow2Method
prevpow2(x::ZZRingElem)

Return the previous power of $2$ up to including $x$.

source
Nemo.nextpow2Method
nextpow2(x::ZZRingElem)

Return the next power of $2$ that is at least $x$.

Examples

julia> nextpow2(ZZ(12))
+16
source
Base.trailing_zerosMethod
trailing_zeros(x::ZZRingElem)

Return the number of trailing zeros in the binary representation of $x$.

source
Nemo.clrbit!Method
clrbit!(x::ZZRingElem, c::Int)

Clear bit $c$ of $x$, where the least significant bit is the $0$-th bit. Note that this function modifies its input in-place.

Examples

julia> a = ZZ(12)
 12
 
 julia> clrbit!(a, 3)
 
 julia> a
-4
source
Nemo.setbit!Method
setbit!(x::ZZRingElem, c::Int)

Set bit $c$ of $x$, where the least significant bit is the $0$-th bit. Note that this function modifies its input in-place.

Examples

julia> a = ZZ(12)
+4
source
Nemo.setbit!Method
setbit!(x::ZZRingElem, c::Int)

Set bit $c$ of $x$, where the least significant bit is the $0$-th bit. Note that this function modifies its input in-place.

Examples

julia> a = ZZ(12)
 12
 
 julia> setbit!(a, 0)
 
 julia> a
-13
source
Nemo.combit!Method
combit!(x::ZZRingElem, c::Int)

Complement bit $c$ of $x$, where the least significant bit is the $0$-th bit. Note that this function modifies its input in-place.

Examples

julia> a = ZZ(12)
+13
source
Nemo.combit!Method
combit!(x::ZZRingElem, c::Int)

Complement bit $c$ of $x$, where the least significant bit is the $0$-th bit. Note that this function modifies its input in-place.

Examples

julia> a = ZZ(12)
 12
 
 julia> combit!(a, 2)
 
 julia> a
-8
source
Nemo.tstbitMethod
tstbit(x::ZZRingElem, c::Int)

Return bit $i$ of x (numbered from 0) as true for 1 or false for 0.

Examples

julia> a = ZZ(12)
+8
source
Nemo.tstbitMethod
tstbit(x::ZZRingElem, c::Int)

Return bit $i$ of x (numbered from 0) as true for 1 or false for 0.

Examples

julia> a = ZZ(12)
 12
 
 julia> tstbit(a, 0)
 false
 
 julia> tstbit(a, 2)
-true
source

Random generation

Nemo.rand_bitsMethod
rand_bits(::ZZRing, b::Int)

Return a random signed integer whose absolute value has $b$ bits.

source
Nemo.rand_bits_primeMethod
rand_bits_prime(::ZZRing, n::Int, proved::Bool=true)

Return a random prime number with the given number of bits. If only a probable prime is required, one can pass proved=false.

source

Examples

a = rand_bits(ZZ, 23)
+true
source

Random generation

Nemo.rand_bitsMethod
rand_bits(::ZZRing, b::Int)

Return a random signed integer whose absolute value has $b$ bits.

source
Nemo.rand_bits_primeMethod
rand_bits_prime(::ZZRing, n::Int, proved::Bool=true)

Return a random prime number with the given number of bits. If only a probable prime is required, one can pass proved=false.

source

Examples

a = rand_bits(ZZ, 23)
 b = rand_bits_prime(ZZ, 7)

Complex Integers

The Gaussian integer type in Nemo is provided by a pair of Flint integers. The associated ring of integers and the fraction field can be retrieved by Nemo.GaussianIntegers() and Nemo.GaussianRationals().

Examples

julia> ZZi = Nemo.GaussianIntegers()
 Gaussian integer ring
 
@@ -181,4 +181,4 @@
 4//5 + 3//5*im
 
 julia> abs2(a//b)
-1
+1 diff --git a/dev/matrix/index.html b/dev/matrix/index.html index 098a58922..7fdb5ae31 100644 --- a/dev/matrix/index.html +++ b/dev/matrix/index.html @@ -1,43 +1,43 @@ -Matrices · Nemo.jl

Matrices

Nemo allow the creation of dense matrices over any computable ring $R$. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of matrices over numerous specific rings, usually provided by C/C++ libraries.

The following table shows each of the matrix types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of matrix (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.Mat{T}Generic.MatSpace{T}
$\mathbb{Z}$FlintZZMatrixZZMatrixSpace
$\mathbb{Z}/n\mathbb{Z}$ (small $n$)FlintzzModMatrixzzModMatrixSpace
$\mathbb{Z}/n\mathbb{Z}$ (large $n$)FlintZZModMatrixZZModMatrixSpace
$\mathbb{Q}$FlintQQMatrixQQMatrixSpace
$\mathbb{Z}/p\mathbb{Z}$ (small $p$)FlintfpMatrixfpMatrixSpace
$\mathbb{F}_{p^n}$ (small $p$)FlintfqPolyRepMatrixfqPolyRepMatrixSpace
$\mathbb{F}_{p^n}$ (large $p$)FlintFqPolyRepMatrix`FqPolyRepMatrixSpace
$\mathbb{R}$ (arbitrary precision)ArbRealMatRealMatSpace
$\mathbb{C}$ (arbitrary precision)ArbComplexMatComplexMatSpace
$\mathbb{R}$ (fixed precision)Arbarb_matArbMatSpace
$\mathbb{C}$ (fixed precision)Arbacb_matAcbMatSpace

The dimensions and base ring $R$ of a generic matrix are stored in its parent object.

All matrix element types belong to the abstract type MatElem and all of the matrix space types belong to the abstract type MatSpace. This enables one to write generic functions that can accept any Nemo matrix type.

Note that the preferred way to create matrices is not to use the type constructors but to use the matrix function, see also the Matrix element constructors section of the AbstractAlgebra manual.

Matrix functionality

All matrix spaces in Nemo provide the matrix functionality of AbstractAlgebra:

https://nemocas.github.io/AbstractAlgebra.jl/stable/matrix

Some of this functionality is provided in Nemo by C libraries, such as Flint, for various specific rings.

In the following, we list the functionality which is provided in addition to the generic matrix functionality, for specific rings in Nemo.

Comparison operators

Nemo.overlapsMethod
overlaps(x::RealMat, y::RealMat)

Returns true if all entries of $x$ overlap with the corresponding entry of $y$, otherwise return false.

source
Nemo.overlapsMethod
overlaps(x::ComplexMat, y::ComplexMat)

Returns true if all entries of $x$ overlap with the corresponding entry of $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealMat, y::RealMat)

Returns true if all entries of $x$ contain the corresponding entry of $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexMat, y::ComplexMat)

Returns true if all entries of $x$ contain the corresponding entry of $y$, otherwise return false.

source

In addition we have the following ad hoc comparison operators.

Examples

C = RR[1 2; 3 4]
+Matrices · Nemo.jl

Matrices

Nemo allow the creation of dense matrices over any computable ring $R$. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of matrices over numerous specific rings, usually provided by C/C++ libraries.

The following table shows each of the matrix types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of matrix (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.Mat{T}Generic.MatSpace{T}
$\mathbb{Z}$FlintZZMatrixZZMatrixSpace
$\mathbb{Z}/n\mathbb{Z}$ (small $n$)FlintzzModMatrixzzModMatrixSpace
$\mathbb{Z}/n\mathbb{Z}$ (large $n$)FlintZZModMatrixZZModMatrixSpace
$\mathbb{Q}$FlintQQMatrixQQMatrixSpace
$\mathbb{Z}/p\mathbb{Z}$ (small $p$)FlintfpMatrixfpMatrixSpace
$\mathbb{F}_{p^n}$ (small $p$)FlintfqPolyRepMatrixfqPolyRepMatrixSpace
$\mathbb{F}_{p^n}$ (large $p$)FlintFqPolyRepMatrix`FqPolyRepMatrixSpace
$\mathbb{R}$ (arbitrary precision)ArbRealMatRealMatSpace
$\mathbb{C}$ (arbitrary precision)ArbComplexMatComplexMatSpace
$\mathbb{R}$ (fixed precision)Arbarb_matArbMatSpace
$\mathbb{C}$ (fixed precision)Arbacb_matAcbMatSpace

The dimensions and base ring $R$ of a generic matrix are stored in its parent object.

All matrix element types belong to the abstract type MatElem and all of the matrix space types belong to the abstract type MatSpace. This enables one to write generic functions that can accept any Nemo matrix type.

Note that the preferred way to create matrices is not to use the type constructors but to use the matrix function, see also the Matrix element constructors section of the AbstractAlgebra manual.

Matrix functionality

All matrix spaces in Nemo provide the matrix functionality of AbstractAlgebra:

https://nemocas.github.io/AbstractAlgebra.jl/stable/matrix

Some of this functionality is provided in Nemo by C libraries, such as Flint, for various specific rings.

In the following, we list the functionality which is provided in addition to the generic matrix functionality, for specific rings in Nemo.

Comparison operators

Nemo.overlapsMethod
overlaps(x::RealMat, y::RealMat)

Returns true if all entries of $x$ overlap with the corresponding entry of $y$, otherwise return false.

source
Nemo.overlapsMethod
overlaps(x::ComplexMat, y::ComplexMat)

Returns true if all entries of $x$ overlap with the corresponding entry of $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealMat, y::RealMat)

Returns true if all entries of $x$ contain the corresponding entry of $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexMat, y::ComplexMat)

Returns true if all entries of $x$ contain the corresponding entry of $y$, otherwise return false.

source

In addition we have the following ad hoc comparison operators.

Examples

C = RR[1 2; 3 4]
 D = RR["1 +/- 0.1" "2 +/- 0.1"; "3 +/- 0.1" "4 +/- 0.1"]
 overlaps(C, D)
-contains(D, C)

Scaling

Base.:>>Method
>>(x::ZZMatrix, y::Int)

Return $x/2^y$ where rounding is towards zero.

source

Examples

S = matrix_space(ZZ, 3, 3)
+contains(D, C)

Scaling

Base.:>>Method
>>(x::ZZMatrix, y::Int)

Return $x/2^y$ where rounding is towards zero.

source

Examples

S = matrix_space(ZZ, 3, 3)
 
 A = S([ZZ(2) 3 5; 1 4 7; 9 6 3])
 
 B = A<<5
-C = B>>2

Determinant

Nemo.det_divisorMethod
det_divisor(x::ZZMatrix)

Return some positive divisor of the determinant of $x$, if the determinant is nonzero, otherwise return zero.

source
Nemo.det_given_divisorMethod
det_given_divisor(x::ZZMatrix, d::Integer, proved=true)

Return the determinant of $x$ given a positive divisor of its determinant. If proved == true (the default), the output is guaranteed to be correct, otherwise a heuristic algorithm is used.

source
Nemo.det_given_divisorMethod
det_given_divisor(x::ZZMatrix, d::ZZRingElem, proved=true)

Return the determinant of $x$ given a positive divisor of its determinant. If proved == true (the default), the output is guaranteed to be correct, otherwise a heuristic algorithm is used.

source

Examples

S = matrix_space(ZZ, 3, 3)
+C = B>>2

Determinant

Nemo.det_divisorMethod
det_divisor(x::ZZMatrix)

Return some positive divisor of the determinant of $x$, if the determinant is nonzero, otherwise return zero.

source
Nemo.det_given_divisorMethod
det_given_divisor(x::ZZMatrix, d::Integer, proved=true)

Return the determinant of $x$ given a positive divisor of its determinant. If proved == true (the default), the output is guaranteed to be correct, otherwise a heuristic algorithm is used.

source
Nemo.det_given_divisorMethod
det_given_divisor(x::ZZMatrix, d::ZZRingElem, proved=true)

Return the determinant of $x$ given a positive divisor of its determinant. If proved == true (the default), the output is guaranteed to be correct, otherwise a heuristic algorithm is used.

source

Examples

S = matrix_space(ZZ, 3, 3)
 
 A = S([ZZ(2) 3 5; 1 4 7; 9 6 3])
 
 c = det_divisor(A)
-d = det_given_divisor(A, c)

Linear solving

Nemo.cansolveMethod
cansolve(a::ZZMatrix, b::ZZMatrix) -> Bool, ZZMatrix

Return true and a matrix $x$ such that $ax = b$, or false and some matrix in case $x$ does not exist.

source
Nemo.solve_dixonMethod
solve_dixon(a::ZZMatrix, b::ZZMatrix)

Return a tuple $(x, m)$ consisting of a column vector $x$ such that $ax = b \pmod{m}$. The element $b$ must be a column vector with the same number > of rows as $a$ and $a$ must be a square matrix. If these conditions are not met or $(x, d)$ does not exist, an exception is raised.

source
Nemo.solve_dixonMethod
solve_dixon(a::QQMatrix, b::QQMatrix)

Solve $ax = b$ by clearing denominators and using Dixon's algorithm. This is usually faster for large systems.

source

Examples

S = matrix_space(ZZ, 3, 3)
+d = det_given_divisor(A, c)

Linear solving

Nemo.cansolveMethod
cansolve(a::ZZMatrix, b::ZZMatrix) -> Bool, ZZMatrix

Return true and a matrix $x$ such that $ax = b$, or false and some matrix in case $x$ does not exist.

source
Nemo.solve_dixonMethod
solve_dixon(a::ZZMatrix, b::ZZMatrix)

Return a tuple $(x, m)$ consisting of a column vector $x$ such that $ax = b \pmod{m}$. The element $b$ must be a column vector with the same number > of rows as $a$ and $a$ must be a square matrix. If these conditions are not met or $(x, d)$ does not exist, an exception is raised.

source
Nemo.solve_dixonMethod
solve_dixon(a::QQMatrix, b::QQMatrix)

Solve $ax = b$ by clearing denominators and using Dixon's algorithm. This is usually faster for large systems.

source

Examples

S = matrix_space(ZZ, 3, 3)
 T = matrix_space(ZZ, 3, 1)
 
 A = S([ZZ(2) 3 5; 1 4 7; 9 2 2])
 B = T([ZZ(4), 5, 7])
 
-X, m = solve_dixon(A, B)

Pseudo inverse

AbstractAlgebra.pseudo_invMethod
pseudo_inv(x::ZZMatrix)

Return a tuple $(z, d)$ consisting of a matrix $z$ and denominator $d$ such that $z/d$ is the inverse of $x$.

source

Examples

S = matrix_space(ZZ, 3, 3)
+X, m = solve_dixon(A, B)

Pseudo inverse

AbstractAlgebra.pseudo_invMethod
pseudo_inv(x::ZZMatrix)

Return a tuple $(z, d)$ consisting of a matrix $z$ and denominator $d$ such that $z/d$ is the inverse of $x$.

source

Examples

S = matrix_space(ZZ, 3, 3)
 
 A = S([1 0 1; 2 3 1; 5 6 7])
 
-B, d = pseudo_inv(A)

Nullspace

Nemo.nullspace_right_rationalMethod
nullspace_right_rational(x::ZZMatrix)

Return a tuple $(r, U)$ consisting of a matrix $U$ such that the first $r$ columns form the right rational nullspace of $x$, i.e. a set of vectors over $\mathbb{Z}$ giving a $\mathbb{Q}$-basis for the nullspace of $x$ considered as a matrix over $\mathbb{Q}$.

source

Modular reduction

Nemo.reduce_modMethod
reduce_mod(x::ZZMatrix, y::Integer)

Reduce the entries of $x$ modulo $y$ and return the result.

source
Nemo.reduce_modMethod
reduce_mod(x::ZZMatrix, y::ZZRingElem)

Reduce the entries of $x$ modulo $y$ and return the result.

source

Examples

S = matrix_space(ZZ, 3, 3)
+B, d = pseudo_inv(A)

Nullspace

Nemo.nullspace_right_rationalMethod
nullspace_right_rational(x::ZZMatrix)

Return a tuple $(r, U)$ consisting of a matrix $U$ such that the first $r$ columns form the right rational nullspace of $x$, i.e. a set of vectors over $\mathbb{Z}$ giving a $\mathbb{Q}$-basis for the nullspace of $x$ considered as a matrix over $\mathbb{Q}$.

source

Modular reduction

Nemo.reduce_modMethod
reduce_mod(x::ZZMatrix, y::Integer)

Reduce the entries of $x$ modulo $y$ and return the result.

source
Nemo.reduce_modMethod
reduce_mod(x::ZZMatrix, y::ZZRingElem)

Reduce the entries of $x$ modulo $y$ and return the result.

source

Examples

S = matrix_space(ZZ, 3, 3)
 
 A = S([ZZ(2) 3 5; 1 4 7; 9 2 2])
 
 reduce_mod(A, ZZ(5))
-reduce_mod(A, 2)

Lifting

AbstractAlgebra.liftMethod
lift(a::T) where {T <: Zmodn_mat}

Return a lift of the matrix $a$ to a matrix over $\mathbb{Z}$, i.e. where the entries of the returned matrix are those of $a$ lifted to $\mathbb{Z}$.

source
AbstractAlgebra.liftMethod
lift(a::fpMatrix)

Return a lift of the matrix $a$ to a matrix over $\mathbb{Z}$, i.e. where the entries of the returned matrix are those of $a$ lifted to $\mathbb{Z}$.

source

Examples

R = residue_ring(ZZ, 7)
+reduce_mod(A, 2)

Lifting

AbstractAlgebra.liftMethod
lift(a::T) where {T <: Zmodn_mat}

Return a lift of the matrix $a$ to a matrix over $\mathbb{Z}$, i.e. where the entries of the returned matrix are those of $a$ lifted to $\mathbb{Z}$.

source
AbstractAlgebra.liftMethod
lift(a::fpMatrix)

Return a lift of the matrix $a$ to a matrix over $\mathbb{Z}$, i.e. where the entries of the returned matrix are those of $a$ lifted to $\mathbb{Z}$.

source

Examples

R = residue_ring(ZZ, 7)
 S = matrix_space(R, 3, 3)
 
 a = S([4 5 6; 7 3 2; 1 4 5])
 
- b = lift(a)

Special matrices

Nemo.hadamardMethod
hadamard(R::ZZMatrixSpace)

Return the Hadamard matrix for the given matrix space. The number of rows and columns must be equal.

source
Nemo.is_hadamardMethod
is_hadamard(x::ZZMatrix)

Return true if the given matrix is Hadamard, otherwise return false.

source
Nemo.hilbertMethod
hilbert(R::QQMatrixSpace)

Return the Hilbert matrix in the given matrix space. This is the matrix with entries $H_{i,j} = 1/(i + j - 1)$.

source

Examples

R = matrix_space(ZZ, 3, 3)
+ b = lift(a)

Special matrices

Nemo.hadamardMethod
hadamard(R::ZZMatrixSpace)

Return the Hadamard matrix for the given matrix space. The number of rows and columns must be equal.

source
Nemo.is_hadamardMethod
is_hadamard(x::ZZMatrix)

Return true if the given matrix is Hadamard, otherwise return false.

source
Nemo.hilbertMethod
hilbert(R::QQMatrixSpace)

Return the Hilbert matrix in the given matrix space. This is the matrix with entries $H_{i,j} = 1/(i + j - 1)$.

source

Examples

R = matrix_space(ZZ, 3, 3)
 S = matrix_space(QQ, 3, 3)
 
 A = hadamard(R)
 is_hadamard(A)
-B = hilbert(R)

Hermite Normal Form

AbstractAlgebra.hnf_with_transformMethod
hnf_with_transform(x::ZZMatrix)

Compute a tuple $(H, T)$ where $H$ is the Hermite normal form of $x$ and $T$ is a transformation matrix so that $H = Tx$.

source
Nemo.hnf_modularMethod
hnf_modular(x::ZZMatrix, d::ZZRingElem)

Compute the Hermite normal form of $x$ given that $d$ is a multiple of the determinant of the nonzero rows of $x$.

source
Nemo.hnf_modular_eldivMethod
hnf_modular_eldiv(x::ZZMatrix, d::ZZRingElem)

Compute the Hermite normal form of $x$ given that $d$ is a multiple of the largest elementary divisor of $x$. The matrix $x$ must have full rank.

source
AbstractAlgebra.is_hnfMethod
is_hnf(x::ZZMatrix)

Return true if the given matrix is in Hermite Normal Form, otherwise return false.

source

Examples

S = matrix_space(ZZ, 3, 3)
+B = hilbert(R)

Hermite Normal Form

AbstractAlgebra.hnf_with_transformMethod
hnf_with_transform(x::ZZMatrix)

Compute a tuple $(H, T)$ where $H$ is the Hermite normal form of $x$ and $T$ is a transformation matrix so that $H = Tx$.

source
Nemo.hnf_modularMethod
hnf_modular(x::ZZMatrix, d::ZZRingElem)

Compute the Hermite normal form of $x$ given that $d$ is a multiple of the determinant of the nonzero rows of $x$.

source
Nemo.hnf_modular_eldivMethod
hnf_modular_eldiv(x::ZZMatrix, d::ZZRingElem)

Compute the Hermite normal form of $x$ given that $d$ is a multiple of the largest elementary divisor of $x$. The matrix $x$ must have full rank.

source
AbstractAlgebra.is_hnfMethod
is_hnf(x::ZZMatrix)

Return true if the given matrix is in Hermite Normal Form, otherwise return false.

source

Examples

S = matrix_space(ZZ, 3, 3)
 
 A = S([ZZ(2) 3 5; 1 4 7; 19 3 7])
 
@@ -45,7 +45,7 @@
 H, T = hnf_with_transform(A)
 M = hnf_modular(A, ZZ(27))
 N = hnf_modular_eldiv(A, ZZ(27))
-is_hnf(M)

Lattice basis reduction

Nemo provides LLL lattice basis reduction. Optionally one can specify the setup using a context object created by the following function.

lll_ctx(delta::Float64, eta::Float64, rep=:zbasis, gram=:approx)

Return a LLL context object specifying LLL parameters $\delta$ and $\eta$ and specifying the representation as either :zbasis or :gram and the Gram type as either :approx or :exact.

Nemo.lllMethod
lll(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Return the LLL reduction of the matrix $x$. By default the matrix $x$ is a $\mathbb{Z}$-basis and the Gram matrix is maintained throughout in approximate form. The LLL is performed with reduction parameters $\delta = 0.99$ and $\eta = 0.51$. All of these defaults can be overridden by specifying an optional context object.

source
Nemo.lll_with_transformMethod
lll_with_transform(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Compute a tuple $(L, T)$ where $L$ is the LLL reduction of $a$ and $T$ is a transformation matrix so that $L = Ta$. All the default parameters can be overridden by supplying an optional context object.

source
Nemo.lll_gramMethod
lll_gram(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))

Given the Gram matrix $x$ of a matrix, compute the Gram matrix of its LLL reduction.

source
Nemo.lll_gram_with_transformMethod
lll_gram_with_transform(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))

Given the Gram matrix $x$ of a matrix $M$, compute a tuple $(L, T)$ where $L$ is the gram matrix of the LLL reduction of the matrix and $T$ is a transformation matrix so that $L = TM$.

source
Nemo.lll_with_removalMethod
lll_with_removal(x::ZZMatrix, b::ZZRingElem, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Compute the LLL reduction of $x$ and throw away rows whose norm exceeds the given bound $b$. Return a tuple $(r, L)$ where the first $r$ rows of $L$ are the rows remaining after removal.

source
Nemo.lll_with_removal_transformMethod
lll_with_removal_transform(x::ZZMatrix, b::ZZRingElem, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Compute a tuple $(r, L, T)$ where the first $r$ rows of $L$ are those remaining from the LLL reduction after removal of vectors with norm exceeding the bound $b$ and $T$ is a transformation matrix so that $L = Tx$.

source
Nemo.lll!Method
lll!(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Perform the LLL reduction of the matrix $x$ inplace. By default the matrix $x$ is a > $\mathbb{Z}$-basis and the Gram matrix is maintained throughout in approximate form. The LLL is performed with reduction parameters $\delta = 0.99$ and $\eta = 0.51$. All of these defaults can be overridden by specifying an optional context object.

source
Nemo.lll_gram!Method
lll_gram!(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))

Given the Gram matrix $x$ of a matrix, compute the Gram matrix of its LLL reduction inplace.

source

Examples

S = matrix_space(ZZ, 3, 3)
+is_hnf(M)

Lattice basis reduction

Nemo provides LLL lattice basis reduction. Optionally one can specify the setup using a context object created by the following function.

lll_ctx(delta::Float64, eta::Float64, rep=:zbasis, gram=:approx)

Return a LLL context object specifying LLL parameters $\delta$ and $\eta$ and specifying the representation as either :zbasis or :gram and the Gram type as either :approx or :exact.

Nemo.lllMethod
lll(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Return the LLL reduction of the matrix $x$. By default the matrix $x$ is a $\mathbb{Z}$-basis and the Gram matrix is maintained throughout in approximate form. The LLL is performed with reduction parameters $\delta = 0.99$ and $\eta = 0.51$. All of these defaults can be overridden by specifying an optional context object.

source
Nemo.lll_with_transformMethod
lll_with_transform(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Compute a tuple $(L, T)$ where $L$ is the LLL reduction of $a$ and $T$ is a transformation matrix so that $L = Ta$. All the default parameters can be overridden by supplying an optional context object.

source
Nemo.lll_gramMethod
lll_gram(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))

Given the Gram matrix $x$ of a matrix, compute the Gram matrix of its LLL reduction.

source
Nemo.lll_gram_with_transformMethod
lll_gram_with_transform(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))

Given the Gram matrix $x$ of a matrix $M$, compute a tuple $(L, T)$ where $L$ is the gram matrix of the LLL reduction of the matrix and $T$ is a transformation matrix so that $L = TM$.

source
Nemo.lll_with_removalMethod
lll_with_removal(x::ZZMatrix, b::ZZRingElem, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Compute the LLL reduction of $x$ and throw away rows whose norm exceeds the given bound $b$. Return a tuple $(r, L)$ where the first $r$ rows of $L$ are the rows remaining after removal.

source
Nemo.lll_with_removal_transformMethod
lll_with_removal_transform(x::ZZMatrix, b::ZZRingElem, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Compute a tuple $(r, L, T)$ where the first $r$ rows of $L$ are those remaining from the LLL reduction after removal of vectors with norm exceeding the bound $b$ and $T$ is a transformation matrix so that $L = Tx$.

source
Nemo.lll!Method
lll!(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))

Perform the LLL reduction of the matrix $x$ inplace. By default the matrix $x$ is a > $\mathbb{Z}$-basis and the Gram matrix is maintained throughout in approximate form. The LLL is performed with reduction parameters $\delta = 0.99$ and $\eta = 0.51$. All of these defaults can be overridden by specifying an optional context object.

source
Nemo.lll_gram!Method
lll_gram!(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))

Given the Gram matrix $x$ of a matrix, compute the Gram matrix of its LLL reduction inplace.

source

Examples

S = matrix_space(ZZ, 3, 3)
 
 A = S([ZZ(2) 3 5; 1 4 7; 19 3 7])
 
@@ -56,7 +56,7 @@
 G, T = lll_gram_with_transform(gram(A))
 
 r, L = lll_with_removal(A, ZZ(100))
-r, L, T = lll_with_removal_transform(A, ZZ(100))

Smith Normal Form

Nemo.snf_diagonalMethod
snf_diagonal(x::ZZMatrix)

Given a diagonal matrix $x$ compute the Smith normal form of $x$.

source

Examples

S = matrix_space(ZZ, 3, 3)
+r, L, T = lll_with_removal_transform(A, ZZ(100))

Smith Normal Form

Nemo.snf_diagonalMethod
snf_diagonal(x::ZZMatrix)

Given a diagonal matrix $x$ compute the Smith normal form of $x$.

source

Examples

S = matrix_space(ZZ, 3, 3)
 
 A = S([ZZ(2) 3 5; 1 4 7; 19 3 7])
 
@@ -65,12 +65,12 @@
 
 B = S([ZZ(2) 0 0; 0 4 0; 0 0 7])
 
-C = snf_diagonal(B)

Strong Echelon Form

Nemo.strong_echelon_formMethod
strong_echelon_form(a::zzModMatrix)

Return the strong echeleon form of $a$. The matrix $a$ must have at least as many rows as columns.

source
Nemo.strong_echelon_formMethod
strong_echelon_form(a::fpMatrix)

Return the strong echeleon form of $a$. The matrix $a$ must have at least as many rows as columns.

source

Examples

R = residue_ring(ZZ, 12)
+C = snf_diagonal(B)

Strong Echelon Form

Nemo.strong_echelon_formMethod
strong_echelon_form(a::zzModMatrix)

Return the strong echeleon form of $a$. The matrix $a$ must have at least as many rows as columns.

source
Nemo.strong_echelon_formMethod
strong_echelon_form(a::fpMatrix)

Return the strong echeleon form of $a$. The matrix $a$ must have at least as many rows as columns.

source

Examples

R = residue_ring(ZZ, 12)
 S = matrix_space(R, 3, 3)
 
 A = S([4 1 0; 0 0 5; 0 0 0 ])
 
-B = strong_echelon_form(A)

Howell Form

Nemo.howell_formMethod
howell_form(a::zzModMatrix)

Return the Howell normal form of $a$. The matrix $a$ must have at least as many rows as columns.

source
Nemo.howell_formMethod
howell_form(a::fpMatrix)

Return the Howell normal form of $a$. The matrix $a$ must have at least as many rows as columns.

source

Examples

R = residue_ring(ZZ, 12)
+B = strong_echelon_form(A)

Howell Form

Nemo.howell_formMethod
howell_form(a::zzModMatrix)

Return the Howell normal form of $a$. The matrix $a$ must have at least as many rows as columns.

source
Nemo.howell_formMethod
howell_form(a::fpMatrix)

Return the Howell normal form of $a$. The matrix $a$ must have at least as many rows as columns.

source

Examples

R = residue_ring(ZZ, 12)
 S = matrix_space(R, 3, 3)
 
 A = S([4 1 0; 0 0 5; 0 0 0 ])
@@ -85,9 +85,9 @@
 julia> B = gram_schmidt_orthogonalisation(A)
 [4   -11//5     95//123]
 [2    22//5   -190//123]
-[0        5    209//123]
source

Exponential

Examples

A = RR[2 0 0; 0 3 0; 0 0 1]
+[0        5    209//123]
source

Exponential

Examples

A = RR[2 0 0; 0 3 0; 0 0 1]
 
-B = exp(A)

Norm

Nemo.bound_inf_normMethod
bound_inf_norm(x::RealMat)

Returns a nonnegative element $z$ of type arb, such that $z$ is an upper bound for the infinity norm for every matrix in $x$

source
Nemo.bound_inf_normMethod
bound_inf_norm(x::ComplexMat)

Returns a nonnegative element $z$ of type acb, such that $z$ is an upper bound for the infinity norm for every matrix in $x$

source

Examples

A = RR[1 2 3; 4 5 6; 7 8 9]
+B = exp(A)

Norm

Nemo.bound_inf_normMethod
bound_inf_norm(x::RealMat)

Returns a nonnegative element $z$ of type arb, such that $z$ is an upper bound for the infinity norm for every matrix in $x$

source
Nemo.bound_inf_normMethod
bound_inf_norm(x::ComplexMat)

Returns a nonnegative element $z$ of type acb, such that $z$ is an upper bound for the infinity norm for every matrix in $x$

source

Examples

A = RR[1 2 3; 4 5 6; 7 8 9]
 
 d = bound_inf_norm(A)

Shifting

Examples

A = RR[1 2 3; 4 5 6; 7 8 9]
 
@@ -98,7 +98,7 @@
 isreal(A)
 
 isreal(onei(CC)*A)

Conversion to Julia matrices

Julia matrices use a different data structure than Nemo matrices. Conversion to Julia matrices is usually only required for interfacing with other packages. It isn't necessary to convert Nemo matrices to Julia matrices in order to manipulate them.

This conversion can be performed with standard Julia syntax, such as the following, where A is an ZZMatrix:

Matrix{Int}(A)
-Matrix{BigInt}(A)

In case the matrix cannot be converted without loss, an InexactError is thrown: in this case, cast to a matrix of BigInts rather than Ints.

Eigenvalues and Eigenvectors (experimental)

LinearAlgebra.eigvalsMethod
eigvals(A::ComplexMat)

Returns the eigenvalues of A as a vector of tuples (ComplexFieldElem, Int). Each tuple (z, k) corresponds to a cluster of k eigenvalues of $A$.

This function is experimental.

source
Nemo.eigvals_simpleMethod
eigvals_simple(A::ComplexMat, algorithm::Symbol = :default)

Returns the eigenvalues of A as a vector of acb. It is assumed that A has only simple eigenvalues.

The algorithm used can be changed by setting the algorithm keyword to :vdhoeven_mourrain or :rump.

This function is experimental.

source
A = CC[1 2 3; 0 4 5; 0 0 6]
+Matrix{BigInt}(A)

In case the matrix cannot be converted without loss, an InexactError is thrown: in this case, cast to a matrix of BigInts rather than Ints.

Eigenvalues and Eigenvectors (experimental)

LinearAlgebra.eigvalsMethod
eigvals(A::ComplexMat)

Returns the eigenvalues of A as a vector of tuples (ComplexFieldElem, Int). Each tuple (z, k) corresponds to a cluster of k eigenvalues of $A$.

This function is experimental.

source
Nemo.eigvals_simpleMethod
eigvals_simple(A::ComplexMat, algorithm::Symbol = :default)

Returns the eigenvalues of A as a vector of acb. It is assumed that A has only simple eigenvalues.

The algorithm used can be changed by setting the algorithm keyword to :vdhoeven_mourrain or :rump.

This function is experimental.

source
A = CC[1 2 3; 0 4 5; 0 0 6]
 eigvals_simple(A)
 A = CC[2 2 3; 0 2 5; 0 0 2])
-eigvals(A)
+eigvals(A) diff --git a/dev/misc/index.html b/dev/misc/index.html index 531d92ef5..eb51e3b6f 100644 --- a/dev/misc/index.html +++ b/dev/misc/index.html @@ -13,4 +13,4 @@ end f(n) = x^n -end

Alternatively, one can disable precompilation by adding __precompile__(false) inside A. Note that this might have other unwanted side effects.

+end

Alternatively, one can disable precompilation by adding __precompile__(false) inside A. Note that this might have other unwanted side effects.

diff --git a/dev/mpolynomial/index.html b/dev/mpolynomial/index.html index d11a6ba25..1ff87772d 100644 --- a/dev/mpolynomial/index.html +++ b/dev/mpolynomial/index.html @@ -1,2 +1,2 @@ -Multivariate polynomials · Nemo.jl

Multivariate polynomials

Introduction

Nemo allow the creation of sparse, distributed multivariate polynomials over any computable ring $R$. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of polynomials over numerous specific rings, usually provided by C/C++ libraries.

The following table shows each of the polynomial types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of polynomial (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.MPoly{T}Generic.MPolyRing{T}
$\mathbb{Z}$FlintZZMPolyRingElemZZMPolyRing
$\mathbb{Z}/n\mathbb{Z}$ (small $n$)FlintzzModMPolyRingElemzzModMPolyRing
$\mathbb{Q}$FlintQQMPolyRingElemQQMPolyRing
$\mathbb{Z}/p\mathbb{Z}$ (small prime $p$)FlintfpMPolyRingElemfpMPolyRing
$\mathbb{F}_{p^n}$ (small $p$)FlintfqPolyRepMPolyRingElemfqPolyRepMPolyRing

The string representation of the variables and the base ring $R$ of a generic polynomial is stored in its parent object.

All polynomial element types belong to the abstract type MPolyRingElem and all of the polynomial ring types belong to the abstract type MPolyRing. This enables one to write generic functions that can accept any Nemo multivariate polynomial type.

Polynomial functionality

All multivariate polynomial types in Nemo provide the multivariate polynomial functionality described by AbstractAlgebra:

https://nemocas.github.io/AbstractAlgebra.jl/stable/mpolynomial

Generic multivariate polynomials are also available.

We describe here only functions that are in addition to that guaranteed by AbstractAlgebra.jl, for specific coefficient rings.

+Multivariate polynomials · Nemo.jl

Multivariate polynomials

Introduction

Nemo allow the creation of sparse, distributed multivariate polynomials over any computable ring $R$. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of polynomials over numerous specific rings, usually provided by C/C++ libraries.

The following table shows each of the polynomial types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of polynomial (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.MPoly{T}Generic.MPolyRing{T}
$\mathbb{Z}$FlintZZMPolyRingElemZZMPolyRing
$\mathbb{Z}/n\mathbb{Z}$ (small $n$)FlintzzModMPolyRingElemzzModMPolyRing
$\mathbb{Q}$FlintQQMPolyRingElemQQMPolyRing
$\mathbb{Z}/p\mathbb{Z}$ (small prime $p$)FlintfpMPolyRingElemfpMPolyRing
$\mathbb{F}_{p^n}$ (small $p$)FlintfqPolyRepMPolyRingElemfqPolyRepMPolyRing

The string representation of the variables and the base ring $R$ of a generic polynomial is stored in its parent object.

All polynomial element types belong to the abstract type MPolyRingElem and all of the polynomial ring types belong to the abstract type MPolyRing. This enables one to write generic functions that can accept any Nemo multivariate polynomial type.

Polynomial functionality

All multivariate polynomial types in Nemo provide the multivariate polynomial functionality described by AbstractAlgebra:

https://nemocas.github.io/AbstractAlgebra.jl/stable/mpolynomial

Generic multivariate polynomials are also available.

We describe here only functions that are in addition to that guaranteed by AbstractAlgebra.jl, for specific coefficient rings.

diff --git a/dev/numberfield/index.html b/dev/numberfield/index.html index fa0a2d239..5814448a7 100644 --- a/dev/numberfield/index.html +++ b/dev/numberfield/index.html @@ -1,6 +1,6 @@ Number field arithmetic · Nemo.jl

Number field arithmetic

Number fields are provided in Nemo by Antic. This allows construction of absolute number fields and basic arithmetic computations therein.

Number fields are constructed using the AnticNumberField function. However, for convenience we define

number_field = AnticNumberField

so that number fields can be constructed using number_field rather than AnticNumberField.

The types of number field elements in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.

LibraryFieldElement typeParent type
Antic$\mathbb{Q}[x]/(f)$nf_elemAnticNumberField

All the number field types belong to the Field abstract type and the number field element types belong to the FieldElem abstract type.

The Hecke.jl library radically expands on number field functionality, providing ideals, orders, class groups, relative extensions, class field theory, etc.

The basic number field element type used in Hecke is the Nemo/antic number field element type, making the two libraries tightly integrated.

https://thofma.github.io/Hecke.jl/stable/

Number field functionality

The number fields in Nemo provide all of the AbstractAlgebra field functionality:

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

Below, we document the additional functionality provided for number field elements.

Constructors

In order to construct number field elements in Nemo, one must first construct the number field itself. This is accomplished with one of the following constructors.

Nemo.number_fieldMethod
number_field(f::QQPolyRingElem, s::VarName;
-            cached::Bool = true, check::Bool = true)

Return a tuple $R, x$ consisting of the parent object $R$ and generator $x$ of the number field $\mathbb{Q}[x]/(f)$ where $f$ is the supplied polynomial. The supplied string s specifies how the generator of the number field should be printed. If s is not specified, it defaults to _a.

source
Nemo.cyclotomic_fieldMethod
cyclotomic_field(n::Int, s::VarName = "z_$n", t = "_\$"; cached = true)

Return a tuple $R, x$ consisting of the parent object $R$ and generator $x$ of the $n$-th cyclotomic field, $\mathbb{Q}(\zeta_n)$. The supplied string s specifies how the generator of the number field should be printed. If provided, the string t specifies how the generator of the polynomial ring from which the number field is constructed, should be printed. If it is not supplied, a default dollar sign will be used to represent the variable.

source
Nemo.cyclotomic_real_subfieldMethod
cyclotomic_real_subfield(n::Int, s::VarName = "(z_$n + 1/z_$n)", t = "\$"; cached = true)

Return a tuple $R, x$ consisting of the parent object $R$ and generator $x$ of the totally real subfield of the $n$-th cyclotomic field, $\mathbb{Q}(\zeta_n)$. The supplied string s specifies how the generator of the number field should be printed. If provided, the string t specifies how the generator of the polynomial ring from which the number field is constructed, should be printed. If it is not supplied, a default dollar sign will be used to represent the variable.

source

Here are some examples of creating number fields and making use of the resulting parent objects to coerce various elements into those fields.

Examples

R, x = polynomial_ring(QQ, "x")
+            cached::Bool = true, check::Bool = true)

Return a tuple $R, x$ consisting of the parent object $R$ and generator $x$ of the number field $\mathbb{Q}[x]/(f)$ where $f$ is the supplied polynomial. The supplied string s specifies how the generator of the number field should be printed. If s is not specified, it defaults to _a.

source
Nemo.cyclotomic_fieldMethod
cyclotomic_field(n::Int, s::VarName = "z_$n", t = "_\$"; cached = true)

Return a tuple $R, x$ consisting of the parent object $R$ and generator $x$ of the $n$-th cyclotomic field, $\mathbb{Q}(\zeta_n)$. The supplied string s specifies how the generator of the number field should be printed. If provided, the string t specifies how the generator of the polynomial ring from which the number field is constructed, should be printed. If it is not supplied, a default dollar sign will be used to represent the variable.

source
Nemo.cyclotomic_real_subfieldMethod
cyclotomic_real_subfield(n::Int, s::VarName = "(z_$n + 1/z_$n)", t = "\$"; cached = true)

Return a tuple $R, x$ consisting of the parent object $R$ and generator $x$ of the totally real subfield of the $n$-th cyclotomic field, $\mathbb{Q}(\zeta_n)$. The supplied string s specifies how the generator of the number field should be printed. If provided, the string t specifies how the generator of the polynomial ring from which the number field is constructed, should be printed. If it is not supplied, a default dollar sign will be used to represent the variable.

source

Here are some examples of creating number fields and making use of the resulting parent objects to coerce various elements into those fields.

Examples

R, x = polynomial_ring(QQ, "x")
 K, a = number_field(x^3 + 3x + 1, "a")
 L, b = CyclotomicField(5, "b")
 M, c = CyclotomicRealField(5, "c")
@@ -9,15 +9,15 @@
 f = L(b)
 g = L(ZZ(11))
 h = L(ZZ(11)//3)
-k = M(x)

Number field element constructors

AbstractAlgebra.genMethod
gen(a::AnticNumberField)

Return the generator of the given number field, i.e., a symbolic root of the defining polynomial.

source

The easiest way of constructing number field elements is to use element arithmetic with the generator, to construct the desired element by its representation as a polynomial. See the following examples for how to do this.

Examples

R, x = polynomial_ring(QQ, "x")
+k = M(x)

Number field element constructors

AbstractAlgebra.genMethod
gen(a::AnticNumberField)

Return the generator of the given number field, i.e., a symbolic root of the defining polynomial.

source

The easiest way of constructing number field elements is to use element arithmetic with the generator, to construct the desired element by its representation as a polynomial. See the following examples for how to do this.

Examples

R, x = polynomial_ring(QQ, "x")
 K, a = number_field(x^3 + 3x + 1, "a")
 
 d = gen(K)
-f = a^2 + 2a - 7

Basic functionality

AbstractAlgebra.mul_red!Method
mul_red!(z::nf_elem, x::nf_elem, y::nf_elem, red::Bool)

Multiply $x$ by $y$ and set the existing number field element $z$ to the result. Reduction modulo the defining polynomial is only performed if red is set to true. Note that $x$ and $y$ must be reduced. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.

source
AbstractAlgebra.Generic.reduce!Method
reduce!(x::nf_elem)

Reduce the given number field element by the defining polynomial, in-place. This only needs to be done after accumulating values computed by mul_red! where reduction has not been performed. All standard Nemo number field functions automatically reduce their outputs.

source

The following coercion function is provided for a number field $R$.

R(f::QQPolyRingElem)

Coerce the given rational polynomial into the number field $R$, i.e. consider the polynomial to be the representation of a number field element and return it.

Conversely, if $R$ is the polynomial ring to which the generating polynomial of a number field belongs, then we can coerce number field elements into the ring $R$ using the following function.

R(b::nf_elem)

Coerce the given number field element into the polynomial ring $R$ of which the number field is a quotient.

Examples

R, x = polynomial_ring(QQ, "x")
+f = a^2 + 2a - 7

Basic functionality

AbstractAlgebra.mul_red!Method
mul_red!(z::nf_elem, x::nf_elem, y::nf_elem, red::Bool)

Multiply $x$ by $y$ and set the existing number field element $z$ to the result. Reduction modulo the defining polynomial is only performed if red is set to true. Note that $x$ and $y$ must be reduced. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.

source
AbstractAlgebra.Generic.reduce!Method
reduce!(x::nf_elem)

Reduce the given number field element by the defining polynomial, in-place. This only needs to be done after accumulating values computed by mul_red! where reduction has not been performed. All standard Nemo number field functions automatically reduce their outputs.

source

The following coercion function is provided for a number field $R$.

R(f::QQPolyRingElem)

Coerce the given rational polynomial into the number field $R$, i.e. consider the polynomial to be the representation of a number field element and return it.

Conversely, if $R$ is the polynomial ring to which the generating polynomial of a number field belongs, then we can coerce number field elements into the ring $R$ using the following function.

R(b::nf_elem)

Coerce the given number field element into the polynomial ring $R$ of which the number field is a quotient.

Examples

R, x = polynomial_ring(QQ, "x")
 K, a = number_field(x^3 + 3x + 1, "a")
 
 f = R(a^2 + 2a + 3)
-g = K(x^2 + 2x + 1)

Basic manipulation

AbstractAlgebra.varMethod
var(a::AnticNumberField)

Returns the identifier (as a symbol, not a string), that is used for printing the generator of the given number field.

source
AbstractAlgebra.is_genMethod
is_gen(a::nf_elem)

Return true if the given number field element is the generator of the number field, otherwise return false.

source
AbstractAlgebra.coeffMethod
coeff(x::nf_elem, n::Int)

Return the $n$-th coefficient of the polynomial representation of the given number field element. Coefficients are numbered from $0$, starting with the constant coefficient.

source
Base.denominatorMethod
denominator(a::nf_elem)

Return the denominator of the polynomial representation of the given number field element.

source
AbstractAlgebra.degreeMethod
degree(a::AnticNumberField)

Return the degree of the given number field, i.e. the degree of its defining polynomial.

source

Examples

R, x = polynomial_ring(QQ, "x")
+g = K(x^2 + 2x + 1)

Basic manipulation

AbstractAlgebra.varMethod
var(a::AnticNumberField)

Returns the identifier (as a symbol, not a string), that is used for printing the generator of the given number field.

source
AbstractAlgebra.is_genMethod
is_gen(a::nf_elem)

Return true if the given number field element is the generator of the number field, otherwise return false.

source
AbstractAlgebra.coeffMethod
coeff(x::nf_elem, n::Int)

Return the $n$-th coefficient of the polynomial representation of the given number field element. Coefficients are numbered from $0$, starting with the constant coefficient.

source
Base.denominatorMethod
denominator(a::nf_elem)

Return the denominator of the polynomial representation of the given number field element.

source
AbstractAlgebra.degreeMethod
degree(a::AnticNumberField)

Return the degree of the given number field, i.e. the degree of its defining polynomial.

source

Examples

R, x = polynomial_ring(QQ, "x")
 K, a = number_field(x^3 + 3x + 1, "a")
 
 d = a^2 + 2a - 7
@@ -27,7 +27,7 @@
 is_gen(m)
 q = degree(K)
 r, s = signature(K)
-v = var(R)

Norm and trace

LinearAlgebra.normMethod
norm(a::nf_elem)

Return the absolute norm of $a$. The result will be a rational number.

source
LinearAlgebra.trMethod
tr(a::nf_elem)

Return the absolute trace of $a$. The result will be a rational number.

source

Examples

julia> R, x = polynomial_ring(QQ, "x")
+v = var(R)

Norm and trace

LinearAlgebra.normMethod
norm(a::nf_elem)

Return the absolute norm of $a$. The result will be a rational number.

source
LinearAlgebra.trMethod
tr(a::nf_elem)

Return the absolute trace of $a$. The result will be a rational number.

source

Examples

julia> R, x = polynomial_ring(QQ, "x")
 (Univariate polynomial ring in x over QQ, x)
 
 julia> K, a = number_field(x^3 + 3x + 1, "a")
@@ -40,4 +40,4 @@
 113
 
 julia> f = tr(c)
--15
+-15 diff --git a/dev/padic/index.html b/dev/padic/index.html index b6e9ccb64..bdacf659b 100644 --- a/dev/padic/index.html +++ b/dev/padic/index.html @@ -1,16 +1,16 @@ -Padics · Nemo.jl

Padics

P-adic fields are provided in Nemo by Flint. This allows construction of $p$-adic fields for any prime $p$.

P-adic fields are constructed using the FlintPadicField function. However, for convenience we define

PadicField = FlintPadicField

so that $p$-adic fields can be constructed using PadicField rather than FlintPadicField. Note that this is the name of the constructor, but not of padic field type.

The types of $p$-adic fields in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.

LibraryFieldElement typeParent type
Flint$\mathbb{Q}_p$padicPadicField

All the $p$-adic field types belong to the Field abstract type and the $p$-adic field element types belong to the FieldElem abstract type.

P-adic functionality

P-adic fields in Nemo implement all the AbstractAlgebra field functionality:.

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

Below, we document all the additional function that is provide by Nemo for p-adic fields.

Constructors

In order to construct $p$-adic field elements in Nemo, one must first construct the $p$-adic field itself. This is accomplished with one of the following constructors.

Nemo.FlintPadicFieldMethod
FlintPadicField(p::Integer, prec::Int; kw...)

Returns the parent object for the $p$-adic field for given prime $p$, where the default absolute precision of elements of the field is given by prec.

source

It is also possible to call the inner constructor directly. It has the following form.

FlintPadicField(p::ZZRingElem, prec::Int)

Returns the parent object for the $p$-adic field for given prime $p$, where the default absolute precision of elements of the field is given by prec.

Here are some examples of creating $p$-adic fields and making use of the resulting parent objects to coerce various elements into those fields.

Examples

R = PadicField(7, 30)
+Padics · Nemo.jl

Padics

P-adic fields are provided in Nemo by Flint. This allows construction of $p$-adic fields for any prime $p$.

P-adic fields are constructed using the FlintPadicField function. However, for convenience we define

PadicField = FlintPadicField

so that $p$-adic fields can be constructed using PadicField rather than FlintPadicField. Note that this is the name of the constructor, but not of padic field type.

The types of $p$-adic fields in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.

LibraryFieldElement typeParent type
Flint$\mathbb{Q}_p$padicPadicField

All the $p$-adic field types belong to the Field abstract type and the $p$-adic field element types belong to the FieldElem abstract type.

P-adic functionality

P-adic fields in Nemo implement all the AbstractAlgebra field functionality:.

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

Below, we document all the additional function that is provide by Nemo for p-adic fields.

Constructors

In order to construct $p$-adic field elements in Nemo, one must first construct the $p$-adic field itself. This is accomplished with one of the following constructors.

Nemo.FlintPadicFieldMethod
FlintPadicField(p::Integer, prec::Int; kw...)

Returns the parent object for the $p$-adic field for given prime $p$, where the default absolute precision of elements of the field is given by prec.

source

It is also possible to call the inner constructor directly. It has the following form.

FlintPadicField(p::ZZRingElem, prec::Int)

Returns the parent object for the $p$-adic field for given prime $p$, where the default absolute precision of elements of the field is given by prec.

Here are some examples of creating $p$-adic fields and making use of the resulting parent objects to coerce various elements into those fields.

Examples

R = PadicField(7, 30)
 S = PadicField(ZZ(65537), 30)
 
 a = R()
 b = S(1)
 c = S(ZZ(123))
-d = R(ZZ(1)//7^2)

Big-oh notation

Elements of p-adic fields can be constructed using the big-oh notation. For this purpose we define the following functions.

AbstractAlgebra.OMethod
O(R::FlintPadicField, m::Integer)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintPadicField, m::ZZRingElem)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintPadicField, m::QQFieldElem)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source

The $O(p^n)$ construction can be used to construct $p$-adic values of precision $n$ by adding it to integer values representing the $p$-adic value modulo $p^n$ as in the examples.

Examples

R = PadicField(7, 30)
+d = R(ZZ(1)//7^2)

Big-oh notation

Elements of p-adic fields can be constructed using the big-oh notation. For this purpose we define the following functions.

AbstractAlgebra.OMethod
O(R::FlintPadicField, m::Integer)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintPadicField, m::ZZRingElem)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintPadicField, m::QQFieldElem)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source

The $O(p^n)$ construction can be used to construct $p$-adic values of precision $n$ by adding it to integer values representing the $p$-adic value modulo $p^n$ as in the examples.

Examples

R = PadicField(7, 30)
 S = PadicField(ZZ(65537), 30)
 
 c = 1 + 2*7 + 4*7^2 + O(R, 7^3)
 d = 13 + 357*ZZ(65537) + O(S, ZZ(65537)^12)
-f = ZZ(1)//7^2 + ZZ(2)//7 + 3 + 4*7 + O(R, 7^2)

Beware that the expression 1 + 2*p + 3*p^2 + O(R, p^n) is actually computed as a normal Julia expression. Therefore if {Int} values are used instead of Flint integers or Julia bignums, overflow may result in evaluating the value.

Basic manipulation

Base.precisionMethod
precision(a::padic)

Return the precision of the given $p$-adic field element, i.e. if the element is known to $O(p^n)$ this function will return $n$.

source
AbstractAlgebra.valuationMethod
valuation(a::padic)

Return the valuation of the given $p$-adic field element, i.e. if the given element is divisible by $p^n$ but not a higher power of $p$ then the function will return $n$.

source

Examples

R = PadicField(7, 30)
+f = ZZ(1)//7^2 + ZZ(2)//7 + 3 + 4*7 + O(R, 7^2)

Beware that the expression 1 + 2*p + 3*p^2 + O(R, p^n) is actually computed as a normal Julia expression. Therefore if {Int} values are used instead of Flint integers or Julia bignums, overflow may result in evaluating the value.

Basic manipulation

Base.precisionMethod
precision(a::padic)

Return the precision of the given $p$-adic field element, i.e. if the element is known to $O(p^n)$ this function will return $n$.

source
AbstractAlgebra.valuationMethod
valuation(a::padic)

Return the valuation of the given $p$-adic field element, i.e. if the given element is divisible by $p^n$ but not a higher power of $p$ then the function will return $n$.

source

Examples

R = PadicField(7, 30)
 
 a = 1 + 2*7 + 4*7^2 + O(R, 7^3)
 b = 7^2 + 3*7^3 + O(R, 7^5)
@@ -20,7 +20,7 @@
 m = prime(R)
 n = valuation(b)
 p = lift(FlintZZ, a)
-q = lift(FlintQQ, divexact(a, b))

Square root

Base.sqrtMethod
sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement

Return the square root of the given Puiseux series $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Base.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement

Return the square root of $f$. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.

Base.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem

Return the square root of $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

sqrt(a::FieldElem)

Return the square root of the element a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Examples

R = PadicField(7, 30)
+q = lift(FlintQQ, divexact(a, b))

Square root

Base.sqrtMethod
Base.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement

Return the square root of $f$. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.

Base.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem

Return the square root of $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

sqrt(a::FieldElem)

Return the square root of the element a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement

Return the square root of the given Puiseux series $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Examples

R = PadicField(7, 30)
 
 a = 1 + 7 + 2*7^2 + O(R, 7^3)
 b = 2 + 3*7 + O(R, 7^5)
@@ -29,7 +29,7 @@
 d = sqrt(a)
 f = sqrt(b)
 f = sqrt(c)
-g = sqrt(R(121))

Special functions

Base.expMethod
exp(a::Generic.LaurentSeriesElem)

Return the exponential of the power series $a$.

exp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the exponential of the given Puiseux series $a$.

exp(a::AbsPowerSeriesRingElem)

Return the exponential of the power series $a$.

exp(a::RelPowerSeriesRingElem)

Return the exponential of the power series $a$.

Base.logMethod
log(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the logarithm of the given Puiseux series $a$.

log(a::SeriesElem{T}) where T <: FieldElement

Return the logarithm of the power series $a$.

Nemo.teichmullerMethod
teichmuller(a::padic)

Return the Teichmuller lift of the $p$-adic value $a$. We require the valuation of $a$ to be nonnegative. The precision of the output will be the same as the precision of the input. For convenience, if $a$ is congruent to zero modulo $p$ we return zero. If the input is not valid an exception is thrown.

source

Examples

R = PadicField(7, 30)
+g = sqrt(R(121))

Special functions

Base.expMethod
exp(a::AbsPowerSeriesRingElem)

Return the exponential of the power series $a$.

exp(a::RelPowerSeriesRingElem)

Return the exponential of the power series $a$.

exp(a::Generic.LaurentSeriesElem)

Return the exponential of the power series $a$.

exp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the exponential of the given Puiseux series $a$.

Base.logMethod
log(a::SeriesElem{T}) where T <: FieldElement

Return the logarithm of the power series $a$.

log(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the logarithm of the given Puiseux series $a$.

Nemo.teichmullerMethod
teichmuller(a::padic)

Return the Teichmuller lift of the $p$-adic value $a$. We require the valuation of $a$ to be nonnegative. The precision of the output will be the same as the precision of the input. For convenience, if $a$ is congruent to zero modulo $p$ we return zero. If the input is not valid an exception is thrown.

source

Examples

R = PadicField(7, 30)
 
 a = 1 + 7 + 2*7^2 + O(R, 7^3)
 b = 2 + 5*7 + 3*7^2 + O(R, 7^3)
@@ -39,4 +39,4 @@
 d = log(a)
 c = exp(R(0))
 d = log(R(1))
-f = teichmuller(b)
+f = teichmuller(b)
diff --git a/dev/polynomial/index.html b/dev/polynomial/index.html index 0fc5216c3..e88b510c4 100644 --- a/dev/polynomial/index.html +++ b/dev/polynomial/index.html @@ -1,5 +1,5 @@ -Univariate polynomials · Nemo.jl

Univariate polynomials

Introduction

Nemo allow the creation of dense, univariate polynomials over any computable ring $R$. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of polynomials over numerous specific rings, usually provided by C/C++ libraries.

The following table shows each of the polynomial types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of polynomial (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.Poly{T}Generic.PolyRing{T}
$\mathbb{Z}$FlintZZPolyRingElemZZPolyRing
$\mathbb{Z}/n\mathbb{Z}$ (small $n$)FlintzzModPolyRingElemzzModPolyRing
$\mathbb{Z}/n\mathbb{Z}$ (large $n$)FlintZZModPolyRingElemZZModPolyRing
$\mathbb{Q}$FlintQQPolyRingElemQQPolyRing
$\mathbb{Z}/p\mathbb{Z}$ (small prime $p$)FlintfpPolyRingElemfpPolyRing
$\mathbb{Z}/p\mathbb{Z}$ (large prime $p$)FlintFpPolyRingElemFpPolyRing
$\mathbb{F}_{p^n}$ (small $p$)FlintfqPolyRepPolyRingElemfqPolyRepPolyRing
$\mathbb{F}_{p^n}$ (large $p$)FlintFqPolyRepPolyRingElemFqPolyRepPolyRing
$\mathbb{R}$ (arbitrary precision)ArbRealPolyRealPolyRing
$\mathbb{C}$ (arbitrary precision)ArbComplexPolyComplexPolyRing
$\mathbb{R}$ (fixed precision)Arbarb_polyArbPolyRing
$\mathbb{C}$ (fixed precision)Arbacb_polyAcbPolyRing

The string representation of the variable and the base ring $R$ of a generic polynomial is stored in its parent object.

All polynomial element types belong to the abstract type PolyRingElem and all of the polynomial ring types belong to the abstract type PolyRing. This enables one to write generic functions that can accept any Nemo univariate polynomial type.

Polynomial functionality

All univariate polynomial types in Nemo provide the AbstractAlgebra univariate polynomial functionality:

https://nemocas.github.io/AbstractAlgebra.jl/stable/polynomial

Generic polynomials are also available.

We describe here only functions that are in addition to that guaranteed by AbstractAlgebra.jl, for specific coefficient rings.

Remove and valuation

Nemo.evaluate2Method
evaluate2(x::RealPoly, y::RingElement)

Return a tuple $p, q$ consisting of the polynomial $x$ evaluated at $y$ and its derivative evaluated at $y$.

source
Nemo.evaluate2Method
evaluate2(x::ComplexPoly, y::RingElement; prec::Int = precision(Balls))

Return a tuple $p, q$ consisting of the polynomial $x$ evaluated at $y$ and its derivative evaluated at $y$.

source

Examples

RR = RealField(64)
+Univariate polynomials · Nemo.jl

Univariate polynomials

Introduction

Nemo allow the creation of dense, univariate polynomials over any computable ring $R$. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of polynomials over numerous specific rings, usually provided by C/C++ libraries.

The following table shows each of the polynomial types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of polynomial (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.Poly{T}Generic.PolyRing{T}
$\mathbb{Z}$FlintZZPolyRingElemZZPolyRing
$\mathbb{Z}/n\mathbb{Z}$ (small $n$)FlintzzModPolyRingElemzzModPolyRing
$\mathbb{Z}/n\mathbb{Z}$ (large $n$)FlintZZModPolyRingElemZZModPolyRing
$\mathbb{Q}$FlintQQPolyRingElemQQPolyRing
$\mathbb{Z}/p\mathbb{Z}$ (small prime $p$)FlintfpPolyRingElemfpPolyRing
$\mathbb{Z}/p\mathbb{Z}$ (large prime $p$)FlintFpPolyRingElemFpPolyRing
$\mathbb{F}_{p^n}$ (small $p$)FlintfqPolyRepPolyRingElemfqPolyRepPolyRing
$\mathbb{F}_{p^n}$ (large $p$)FlintFqPolyRepPolyRingElemFqPolyRepPolyRing
$\mathbb{R}$ (arbitrary precision)ArbRealPolyRealPolyRing
$\mathbb{C}$ (arbitrary precision)ArbComplexPolyComplexPolyRing
$\mathbb{R}$ (fixed precision)Arbarb_polyArbPolyRing
$\mathbb{C}$ (fixed precision)Arbacb_polyAcbPolyRing

The string representation of the variable and the base ring $R$ of a generic polynomial is stored in its parent object.

All polynomial element types belong to the abstract type PolyRingElem and all of the polynomial ring types belong to the abstract type PolyRing. This enables one to write generic functions that can accept any Nemo univariate polynomial type.

Polynomial functionality

All univariate polynomial types in Nemo provide the AbstractAlgebra univariate polynomial functionality:

https://nemocas.github.io/AbstractAlgebra.jl/stable/polynomial

Generic polynomials are also available.

We describe here only functions that are in addition to that guaranteed by AbstractAlgebra.jl, for specific coefficient rings.

Remove and valuation

Nemo.evaluate2Method
evaluate2(x::RealPoly, y::RingElement)

Return a tuple $p, q$ consisting of the polynomial $x$ evaluated at $y$ and its derivative evaluated at $y$.

source
Nemo.evaluate2Method
evaluate2(x::ComplexPoly, y::RingElement; prec::Int = precision(Balls))

Return a tuple $p, q$ consisting of the polynomial $x$ evaluated at $y$ and its derivative evaluated at $y$.

source

Examples

RR = RealField(64)
 T, z = polynomial_ring(RR, "z")
    
 h = z^2 + 2z + 1
@@ -7,10 +7,10 @@
 s, t = evaluate2(h, RR("2.0 +/- 0.1"))

Signature

Nemo.signatureMethod
signature(f::ZZPolyRingElem)

Return the signature of $f$, i.e. a tuple $(r, s)$ such that $r$ is the number of real roots of $f$ and $s$ is half the number of complex roots.

Examples

julia> R, x = polynomial_ring(ZZ, "x");
 
 julia> signature(x^3 + 3x + 1)
-(1, 1)
source
Nemo.signatureMethod
signature(f::QQPolyRingElem)

Return the signature of $f$, i.e. a tuple $(r, s)$ such that $r$ is the number of real roots of $f$ and $s$ is half the number of complex roots.

Examples

julia> R, x = polynomial_ring(QQ, "x");
+(1, 1)
source
Nemo.signatureMethod
signature(f::QQPolyRingElem)

Return the signature of $f$, i.e. a tuple $(r, s)$ such that $r$ is the number of real roots of $f$ and $s$ is half the number of complex roots.

Examples

julia> R, x = polynomial_ring(QQ, "x");
 
 julia> signature(x^3 + 3x + 1)
-(1, 1)
source

Root finding

AbstractAlgebra.Generic.rootsMethod
roots(x::ComplexPoly; target=0, isolate_real=false, initial_prec=0, max_prec=0, max_iter=0)

Attempts to isolate the complex roots of the complex polynomial $x$ by iteratively refining balls in which they lie.

This is done by increasing the working precision, starting at initial_prec. The maximal number of iterations can be set using max_iter and the maximal precision can be set using max_prec.

If isolate_real is set and $x$ is strictly real, then the real roots will be isolated from the non-real roots. Every root will have either zero, positive or negative real part.

It is assumed that $x$ is squarefree.

source

Examples

CC = ComplexField(64)
+(1, 1)
source

Root finding

AbstractAlgebra.Generic.rootsMethod
roots(x::ComplexPoly; target=0, isolate_real=false, initial_prec=0, max_prec=0, max_iter=0)

Attempts to isolate the complex roots of the complex polynomial $x$ by iteratively refining balls in which they lie.

This is done by increasing the working precision, starting at initial_prec. The maximal number of iterations can be set using max_iter and the maximal precision can be set using max_prec.

If isolate_real is set and $x$ is strictly real, then the real roots will be isolated from the non-real roots. Every root will have either zero, positive or negative real part.

It is assumed that $x$ is squarefree.

source

Examples

CC = ComplexField(64)
 C, y = polynomial_ring(CC, "y")
 
 m = y^2 + 2y + 3
@@ -20,17 +20,17 @@
 
 p = y^7 - 1
 
-r = roots(n, isolate_real = true)

Construction from roots

Nemo.from_rootsMethod
from_roots(R::ArbPolyRing, b::Vector{arb})

Construct a polynomial in the given polynomial ring from a list of its roots.

source
Nemo.from_rootsMethod
from_roots(R::AcbPolyRing, b::Vector{acb})

Construct a polynomial in the given polynomial ring from a list of its roots.

source

Examples

RR = RealField(64)
+r = roots(n, isolate_real = true)

Construction from roots

Nemo.from_rootsMethod
from_roots(R::ArbPolyRing, b::Vector{arb})

Construct a polynomial in the given polynomial ring from a list of its roots.

source
Nemo.from_rootsMethod
from_roots(R::AcbPolyRing, b::Vector{acb})

Construct a polynomial in the given polynomial ring from a list of its roots.

source

Examples

RR = RealField(64)
 R, x = polynomial_ring(RR, "x")
 
 xs = arb[inv(RR(i)) for i=1:5]
-f = from_roots(R, xs)

Bounding absolute values of roots

Nemo.roots_upper_boundMethod
roots_upper_bound(x::RealPoly) -> arb

Returns an upper bound for the absolute value of all complex roots of $x$.

source
Nemo.roots_upper_boundMethod
roots_upper_bound(x::ComplexPoly) -> arb

Returns an upper bound for the absolute value of all complex roots of $x$.

source

Lifting

When working over a residue ring it is useful to be able to lift to the base ring of the residue ring, e.g. from $\mathbb{Z}/n\mathbb{Z}$ to $\mathbb{Z}$.

AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, y::zzModPolyRingElem)

Lift from a polynomial over $\mathbb{Z}/n\mathbb{Z}$ to a polynomial over $\mathbb{Z}$ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.

source
AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, y::fpPolyRingElem)

Lift from a polynomial over $\mathbb{Z}/n\mathbb{Z}$ to a polynomial over $\mathbb{Z}$ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.

source
AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, y::ZZModPolyRingElem)

Lift from a polynomial over $\mathbb{Z}/n\mathbb{Z}$ to a polynomial over $\mathbb{Z}$ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.

source
AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, y::FpPolyRingElem)

Lift from a polynomial over $\mathbb{Z}/n\mathbb{Z}$ to a polynomial over $\mathbb{Z}$ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.

source

Examples

R = residue_ring(ZZ, 123456789012345678949)
+f = from_roots(R, xs)

Bounding absolute values of roots

Nemo.roots_upper_boundMethod
roots_upper_bound(x::RealPoly) -> arb

Returns an upper bound for the absolute value of all complex roots of $x$.

source
Nemo.roots_upper_boundMethod
roots_upper_bound(x::ComplexPoly) -> arb

Returns an upper bound for the absolute value of all complex roots of $x$.

source

Lifting

When working over a residue ring it is useful to be able to lift to the base ring of the residue ring, e.g. from $\mathbb{Z}/n\mathbb{Z}$ to $\mathbb{Z}$.

AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, y::zzModPolyRingElem)

Lift from a polynomial over $\mathbb{Z}/n\mathbb{Z}$ to a polynomial over $\mathbb{Z}$ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.

source
AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, y::fpPolyRingElem)

Lift from a polynomial over $\mathbb{Z}/n\mathbb{Z}$ to a polynomial over $\mathbb{Z}$ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.

source
AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, y::ZZModPolyRingElem)

Lift from a polynomial over $\mathbb{Z}/n\mathbb{Z}$ to a polynomial over $\mathbb{Z}$ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.

source
AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, y::FpPolyRingElem)

Lift from a polynomial over $\mathbb{Z}/n\mathbb{Z}$ to a polynomial over $\mathbb{Z}$ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.

source

Examples

R = residue_ring(ZZ, 123456789012345678949)
 S, x = polynomial_ring(R, "x")
 T, y = polynomial_ring(ZZ, "y")
 
 f = x^2 + 2x + 1
 
-a = lift(T, f)

Overlapping and containment

Occasionally it is useful to be able to tell when inexact polynomials overlap or contain other exact or inexact polynomials. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::RealPoly, y::RealPoly)

Return true if the coefficient balls of $x$ overlap the coefficient balls of $y$, otherwise return false.

source
Nemo.overlapsMethod
overlaps(x::ComplexPoly, y::ComplexPoly)

Return true if the coefficient boxes of $x$ overlap the coefficient boxes of $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealPoly, y::RealPoly)

Return true if the coefficient balls of $x$ contain the corresponding coefficient balls of $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexPoly, y::ComplexPoly)

Return true if the coefficient boxes of $x$ contain the corresponding coefficient boxes of $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealPoly, y::ZZPolyRingElem)

Return true if the coefficient balls of $x$ contain the corresponding exact coefficients of $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealPoly, y::QQPolyRingElem)

Return true if the coefficient balls of $x$ contain the corresponding exact coefficients of $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexPoly, y::ZZPolyRingElem)

Return true if the coefficient boxes of $x$ contain the corresponding exact coefficients of $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexPoly, y::QQPolyRingElem)

Return true if the coefficient boxes of $x$ contain the corresponding exact coefficients of $y$, otherwise return false.

source

It is sometimes also useful to be able to determine if there is a unique integer contained in the coefficient of an inexact constant polynomial.

Nemo.unique_integerMethod
unique_integer(x::RealPoly)

Return a tuple (t, z) where $t$ is true if there is a unique integer contained in each of the coefficients of $x$, otherwise sets $t$ to false. In the former case, $z$ is set to the integer polynomial.

source
Nemo.unique_integerMethod
unique_integer(x::ComplexPoly)

Return a tuple (t, z) where $t$ is true if there is a unique integer contained in the (constant) polynomial $x$, along with that integer $z$ in case it is, otherwise sets $t$ to false.

source

Examples

RR = RealField(64)
+a = lift(T, f)

Overlapping and containment

Occasionally it is useful to be able to tell when inexact polynomials overlap or contain other exact or inexact polynomials. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::RealPoly, y::RealPoly)

Return true if the coefficient balls of $x$ overlap the coefficient balls of $y$, otherwise return false.

source
Nemo.overlapsMethod
overlaps(x::ComplexPoly, y::ComplexPoly)

Return true if the coefficient boxes of $x$ overlap the coefficient boxes of $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealPoly, y::RealPoly)

Return true if the coefficient balls of $x$ contain the corresponding coefficient balls of $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexPoly, y::ComplexPoly)

Return true if the coefficient boxes of $x$ contain the corresponding coefficient boxes of $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealPoly, y::ZZPolyRingElem)

Return true if the coefficient balls of $x$ contain the corresponding exact coefficients of $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealPoly, y::QQPolyRingElem)

Return true if the coefficient balls of $x$ contain the corresponding exact coefficients of $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexPoly, y::ZZPolyRingElem)

Return true if the coefficient boxes of $x$ contain the corresponding exact coefficients of $y$, otherwise return false.

source
Base.containsMethod
contains(x::ComplexPoly, y::QQPolyRingElem)

Return true if the coefficient boxes of $x$ contain the corresponding exact coefficients of $y$, otherwise return false.

source

It is sometimes also useful to be able to determine if there is a unique integer contained in the coefficient of an inexact constant polynomial.

Nemo.unique_integerMethod
unique_integer(x::RealPoly)

Return a tuple (t, z) where $t$ is true if there is a unique integer contained in each of the coefficients of $x$, otherwise sets $t$ to false. In the former case, $z$ is set to the integer polynomial.

source
Nemo.unique_integerMethod
unique_integer(x::ComplexPoly)

Return a tuple (t, z) where $t$ is true if there is a unique integer contained in the (constant) polynomial $x$, along with that integer $z$ in case it is, otherwise sets $t$ to false.

source

Examples

RR = RealField(64)
 CC = ComplexField(64)
 R, x = polynomial_ring(RR, "x")
 C, y = polynomial_ring(CC, "y")
@@ -47,7 +47,7 @@
 overlaps(f, k)
 contains(n, m)
 t, z = unique_integer(k)
-isreal(n)

Factorisation

Certain polynomials can be factored (ZZPolyRingElem',zzModPolyRingElem,fpPolyRingElem,ZZModPolyRingElem,FpPolyRingElem,FqPolyRepPolyRingElem,fqPolyRepPolyRingElem`) and the interface follows the specification in AbstractAlgebra.jl. The following additional functions are available.

Nemo.factor_distinct_degMethod
factor_distinct_deg(x::zzModPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::fpPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::ZZModPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::ZZModPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::FqPolyRepPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::fqPolyRepPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source

Examples

R = residue_ring(ZZ, 23)
+isreal(n)

Factorisation

Certain polynomials can be factored (ZZPolyRingElem',zzModPolyRingElem,fpPolyRingElem,ZZModPolyRingElem,FpPolyRingElem,FqPolyRepPolyRingElem,fqPolyRepPolyRingElem`) and the interface follows the specification in AbstractAlgebra.jl. The following additional functions are available.

Nemo.factor_distinct_degMethod
factor_distinct_deg(x::zzModPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::fpPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::ZZModPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::ZZModPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::FqPolyRepPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source
Nemo.factor_distinct_degMethod
factor_distinct_deg(x::fqPolyRepPolyRingElem)

Return the distinct degree factorisation of a squarefree polynomial $x$.

source

Examples

R = residue_ring(ZZ, 23)
 S, x = polynomial_ring(R, "x")
 
 f = x^2 + 2x + 1
@@ -55,7 +55,7 @@
 
 R = factor(f*g)
 S = factor_squarefree(f*g)
-T = factor_distinct_deg((x + 1)*g*(x^5+x^3+x+1))

Special functions

Nemo.cyclotomicMethod
cyclotomic(n::Int, x::ZZPolyRingElem)

Return the $n$th cyclotomic polynomial, defined as $\Phi_n(x) = \prod_{\omega} (x-\omega),$ where $\omega$ runs over all the $n$th primitive roots of unity.

source
Nemo.swinnerton_dyerMethod
swinnerton_dyer(n::Int, x::ZZPolyRingElem)

Return the Swinnerton-Dyer polynomial $S_n$, defined as the integer polynomial $S_n = \prod (x \pm \sqrt{2} \pm \sqrt{3} \pm \sqrt{5} \pm \ldots \pm \sqrt{p_n})$ where $p_n$ denotes the $n$-th prime number and all combinations of signs are taken. This polynomial has degree $2^n$ and is irreducible over the integers (it is the minimal polynomial of $\sqrt{2} + \ldots + \sqrt{p_n}$).

source
Nemo.cos_minpolyMethod
cos_minpoly(n::Int, x::ZZPolyRingElem)

Return the minimal polynomial of $2 \cos(2 \pi / n)$. For suitable choice of $n$, this gives the minimal polynomial of $2 \cos(a \pi)$ or $2 \sin(a \pi)$ for any rational $a$.

source
Nemo.theta_qexpMethod
theta_qexp(e::Int, n::Int, x::ZZPolyRingElem)

Return the $q$-expansion to length $n$ of the Jacobi theta function raised to the power $r$, i.e. $\vartheta(q)^r$ where $\vartheta(q) = 1 + \sum_{k=1}^{\infty} q^{k^2}$.

source
Nemo.eta_qexpMethod
eta_qexp(e::Int, n::Int, x::ZZPolyRingElem)

Return the $q$-expansion to length $n$ of the Dedekind eta function (without the leading factor $q^{1/24}$) raised to the power $r$, i.e. $(q^{-1/24} \eta(q))^r = \prod_{k=1}^{\infty} (1 - q^k)^r$. In particular, $r = -1$ gives the generating function of the partition function $p(k)$, and $r = 24$ gives, after multiplication by $q$, the modular discriminant $\Delta(q)$ which generates the Ramanujan tau function $\tau(k)$.

source

Examples

R, x = polynomial_ring(ZZ, "x")
+T = factor_distinct_deg((x + 1)*g*(x^5+x^3+x+1))

Special functions

Nemo.cyclotomicMethod
cyclotomic(n::Int, x::ZZPolyRingElem)

Return the $n$th cyclotomic polynomial, defined as $\Phi_n(x) = \prod_{\omega} (x-\omega),$ where $\omega$ runs over all the $n$th primitive roots of unity.

source
Nemo.swinnerton_dyerMethod
swinnerton_dyer(n::Int, x::ZZPolyRingElem)

Return the Swinnerton-Dyer polynomial $S_n$, defined as the integer polynomial $S_n = \prod (x \pm \sqrt{2} \pm \sqrt{3} \pm \sqrt{5} \pm \ldots \pm \sqrt{p_n})$ where $p_n$ denotes the $n$-th prime number and all combinations of signs are taken. This polynomial has degree $2^n$ and is irreducible over the integers (it is the minimal polynomial of $\sqrt{2} + \ldots + \sqrt{p_n}$).

source
Nemo.cos_minpolyMethod
cos_minpoly(n::Int, x::ZZPolyRingElem)

Return the minimal polynomial of $2 \cos(2 \pi / n)$. For suitable choice of $n$, this gives the minimal polynomial of $2 \cos(a \pi)$ or $2 \sin(a \pi)$ for any rational $a$.

source
Nemo.theta_qexpMethod
theta_qexp(e::Int, n::Int, x::ZZPolyRingElem)

Return the $q$-expansion to length $n$ of the Jacobi theta function raised to the power $r$, i.e. $\vartheta(q)^r$ where $\vartheta(q) = 1 + \sum_{k=1}^{\infty} q^{k^2}$.

source
Nemo.eta_qexpMethod
eta_qexp(e::Int, n::Int, x::ZZPolyRingElem)

Return the $q$-expansion to length $n$ of the Dedekind eta function (without the leading factor $q^{1/24}$) raised to the power $r$, i.e. $(q^{-1/24} \eta(q))^r = \prod_{k=1}^{\infty} (1 - q^k)^r$. In particular, $r = -1$ gives the generating function of the partition function $p(k)$, and $r = 24$ gives, after multiplication by $q$, the modular discriminant $\Delta(q)$ which generates the Ramanujan tau function $\tau(k)$.

source

Examples

R, x = polynomial_ring(ZZ, "x")
 S, y = polynomial_ring(R, "y")
 
 h = cyclotomic(120, x)
@@ -63,4 +63,4 @@
 k = cos_minpoly(30, x)
 l = theta_qexp(3, 30, x)
 m = eta_qexp(24, 30, x)
-o = cyclotomic(10, 1 + x + x^2)
+o = cyclotomic(10, 1 + x + x^2) diff --git a/dev/puiseux/index.html b/dev/puiseux/index.html index 9bffdd03f..bf315c1a5 100644 --- a/dev/puiseux/index.html +++ b/dev/puiseux/index.html @@ -1,5 +1,5 @@ -Puiseux series · Nemo.jl

Puiseux series

Nemo allows the creation of Puiseux series over any computable ring $R$. Puiseux series are series of the form $a_jx^{j/m} + a_{j+1}x^{(j+1)/m} + \cdots + a_{k-1}x^{(k-1)/m} + O(x^{k/m})$ where $m$ is a positive integer, $a_i \in R$ and the relative precision $k - j$ is at most equal to some specified precision $n$.

There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of Puiseux series over numerous specific rings, usually provided by C/C++ libraries.

The following table shows each of the Puiseux series types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of series (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jl`Generic.PuiseuxSeriesRingElem{T}Generic.PuiseuxSeriesRing{T}
Generic field $K$AbstractAlgebra.jl`Generic.PuiseuxSeriesFieldElem{T}Generic.PuiseuxSeriesField{T}
$\mathbb{Z}$FlintFlintPuiseuxSeriesRingElem{ZZLaurentSeriesRingElem}FlintPuiseuxSeriesRing{ZZLaurentSeriesRingElem}

For convenience, FlintPuiseuxSeriesRingElem and FlintPuiseuxSeriesFieldElem both belong to a union type called FlintPuiseuxSeriesElem.

The maximum relative precision, the string representation of the variable and the base ring $R$ of a generic power series are stored in the parent object.

Note that unlike most other Nemo types, Puiseux series are parameterised by the type of the underlying Laurent series type (which must exist before Nemo can make use of it), instead of the type of the coefficients.

Puiseux power series

Puiseux series have their maximum relative precision capped at some value prec_max. This refers to the maximum precision of the underlying Laurent series. See the description of the generic Puiseux series in AbstractAlgebra.jl for details.

There are numerous important things to be aware of when working with Puiseux series, or series in general. Please refer to the documentation of generic Puiseux series and series in general in AbstractAlgebra.jl for details.

Puiseux series functionality

Puiseux series rings in Nemo implement all the same functionality that is available for AbstractAlgebra series rings, with the exception of the pol_length and polcoeff functions:

https://nemocas.github.io/AbstractAlgebra.jl/stable/series

In addition, generic Puiseux series are provided by AbstractAlgebra.jl

We list below only the functionality that differs from that described in AbstractAlgebra, for specific rings provided by Nemo.

Special functions

Base.sqrtMethod
sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement

Return the square root of the given Puiseux series $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Base.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement

Return the square root of $f$. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.

Base.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem

Return the square root of $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Base.expMethod
exp(a::Generic.LaurentSeriesElem)

Return the exponential of the power series $a$.

exp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the exponential of the given Puiseux series $a$.

exp(a::AbsPowerSeriesRingElem)

Return the exponential of the power series $a$.

exp(a::RelPowerSeriesRingElem)

Return the exponential of the power series $a$.

Nemo.eta_qexpMethod
eta_qexp(x::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})

Return the $q$-series for eta evaluated at $x$, which must currently be a rational power of the generator of the Puiseux series ring.

source

Examples

julia> S, z = PuiseuxSeriesRing(ZZ, 30, "z")
+Puiseux series · Nemo.jl

Puiseux series

Nemo allows the creation of Puiseux series over any computable ring $R$. Puiseux series are series of the form $a_jx^{j/m} + a_{j+1}x^{(j+1)/m} + \cdots + a_{k-1}x^{(k-1)/m} + O(x^{k/m})$ where $m$ is a positive integer, $a_i \in R$ and the relative precision $k - j$ is at most equal to some specified precision $n$.

There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of Puiseux series over numerous specific rings, usually provided by C/C++ libraries.

The following table shows each of the Puiseux series types available in Nemo, the base ring $R$, and the Julia/Nemo types for that kind of series (the type information is mainly of concern to developers).

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jl`Generic.PuiseuxSeriesRingElem{T}Generic.PuiseuxSeriesRing{T}
Generic field $K$AbstractAlgebra.jl`Generic.PuiseuxSeriesFieldElem{T}Generic.PuiseuxSeriesField{T}
$\mathbb{Z}$FlintFlintPuiseuxSeriesRingElem{ZZLaurentSeriesRingElem}FlintPuiseuxSeriesRing{ZZLaurentSeriesRingElem}

For convenience, FlintPuiseuxSeriesRingElem and FlintPuiseuxSeriesFieldElem both belong to a union type called FlintPuiseuxSeriesElem.

The maximum relative precision, the string representation of the variable and the base ring $R$ of a generic power series are stored in the parent object.

Note that unlike most other Nemo types, Puiseux series are parameterised by the type of the underlying Laurent series type (which must exist before Nemo can make use of it), instead of the type of the coefficients.

Puiseux power series

Puiseux series have their maximum relative precision capped at some value prec_max. This refers to the maximum precision of the underlying Laurent series. See the description of the generic Puiseux series in AbstractAlgebra.jl for details.

There are numerous important things to be aware of when working with Puiseux series, or series in general. Please refer to the documentation of generic Puiseux series and series in general in AbstractAlgebra.jl for details.

Puiseux series functionality

Puiseux series rings in Nemo implement all the same functionality that is available for AbstractAlgebra series rings, with the exception of the pol_length and polcoeff functions:

https://nemocas.github.io/AbstractAlgebra.jl/stable/series

In addition, generic Puiseux series are provided by AbstractAlgebra.jl

We list below only the functionality that differs from that described in AbstractAlgebra, for specific rings provided by Nemo.

Special functions

Base.sqrtMethod
Base.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement

Return the square root of $f$. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.

Base.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem

Return the square root of $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement

Return the square root of the given Puiseux series $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Base.expMethod
exp(a::AbsPowerSeriesRingElem)

Return the exponential of the power series $a$.

exp(a::RelPowerSeriesRingElem)

Return the exponential of the power series $a$.

exp(a::Generic.LaurentSeriesElem)

Return the exponential of the power series $a$.

exp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the exponential of the given Puiseux series $a$.

Nemo.eta_qexpMethod
eta_qexp(x::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})

Return the $q$-series for eta evaluated at $x$, which must currently be a rational power of the generator of the Puiseux series ring.

source

Examples

julia> S, z = PuiseuxSeriesRing(ZZ, 30, "z")
 (Puiseux series ring in z over ZZ, z + O(z^31))
 
 julia> a = 1 + z + 3z^2 + O(z^5)
@@ -9,4 +9,4 @@
 1 + z + 3*z^2 + O(z^5)
 
 julia> k = eta_qexp(z)
-z^(1//24) - z^(25//24) + O(z^(31//24))
+z^(1//24) - z^(25//24) + O(z^(31//24))
diff --git a/dev/qadic/index.html b/dev/qadic/index.html index d4af85e4a..411986f65 100644 --- a/dev/qadic/index.html +++ b/dev/qadic/index.html @@ -1,5 +1,5 @@ -Qadics · Nemo.jl

Qadics

Q-adic fields, that is, unramified extensions of p-adic fields, are provided in Nemo by Flint. This allows construction of $q$-adic fields for any prime power $q$.

Q-adic fields are constructed using the FlintQadicField function. However, for convenience we define

QadicField = FlintQadicField

so that $q$-adic fields can be constructed using QadicField rather than FlintQadicField. Note that this is the name of the constructor, but not of qadic field type.

The types of $q$-adic fields in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.

LibraryFieldElement typeParent type
Flint$\mathbb{Q}_q$qadicQadicField

All the $q$-adic field types belong to the Field abstract type and the $q$-adic field element types belong to the FieldElem abstract type.

P-adic functionality

Q-adic fields in Nemo provide all the functionality described in AbstractAlgebra for fields:.

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

Below, we document all the additional function that is provide by Nemo for q-adic fields.

Constructors

In order to construct $q$-adic field elements in Nemo, one must first construct the $q$-adic field itself. This is accomplished with one of the following constructors.

Nemo.FlintQadicFieldMethod
FlintQadicField(p::Integer, d::Int, prec::Int, var::String = "a")

Returns the parent object for the $q$-adic field for given prime $p$ and degree $d$, where the default absolute precision of elements of the field is given by prec and the generator is printed as var.

source

It is also possible to call the inner constructor directly. It has the following form.

FlintQadicField(p::ZZRingElem, d::Int, prec::Int)

Returns the parent object for the $q$-adic field for given prime $p$ and degree $d$, where the default absolute precision of elements of the field is given by prec. It also return the uniformizer p with the default precision.

Here are some examples of creating $q$-adic fields and making use of the resulting parent objects to coerce various elements into those fields.

Examples

julia> R, p = QadicField(7, 1, 30);
+Qadics · Nemo.jl

Qadics

Q-adic fields, that is, unramified extensions of p-adic fields, are provided in Nemo by Flint. This allows construction of $q$-adic fields for any prime power $q$.

Q-adic fields are constructed using the FlintQadicField function. However, for convenience we define

QadicField = FlintQadicField

so that $q$-adic fields can be constructed using QadicField rather than FlintQadicField. Note that this is the name of the constructor, but not of qadic field type.

The types of $q$-adic fields in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.

LibraryFieldElement typeParent type
Flint$\mathbb{Q}_q$qadicQadicField

All the $q$-adic field types belong to the Field abstract type and the $q$-adic field element types belong to the FieldElem abstract type.

P-adic functionality

Q-adic fields in Nemo provide all the functionality described in AbstractAlgebra for fields:.

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

Below, we document all the additional function that is provide by Nemo for q-adic fields.

Constructors

In order to construct $q$-adic field elements in Nemo, one must first construct the $q$-adic field itself. This is accomplished with one of the following constructors.

Nemo.FlintQadicFieldMethod
FlintQadicField(p::Integer, d::Int, prec::Int, var::String = "a")

Returns the parent object for the $q$-adic field for given prime $p$ and degree $d$, where the default absolute precision of elements of the field is given by prec and the generator is printed as var.

source

It is also possible to call the inner constructor directly. It has the following form.

FlintQadicField(p::ZZRingElem, d::Int, prec::Int)

Returns the parent object for the $q$-adic field for given prime $p$ and degree $d$, where the default absolute precision of elements of the field is given by prec. It also return the uniformizer p with the default precision.

Here are some examples of creating $q$-adic fields and making use of the resulting parent objects to coerce various elements into those fields.

Examples

julia> R, p = QadicField(7, 1, 30);
 
 julia> S, _ = QadicField(ZZ(65537), 1, 30);
 
@@ -13,7 +13,7 @@
 123*65537^0 + O(65537^30)
 
 julia> d = R(ZZ(1)//7^2)
-7^-2 + O(7^28)

Big-oh notation

Elements of p-adic fields can be constructed using the big-oh notation. For this purpose we define the following functions.

AbstractAlgebra.OMethod
O(R::FlintQadicField, m::Integer)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintQadicField, m::ZZRingElem)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintQadicField, m::QQFieldElem)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source

The $O(p^n)$ construction can be used to construct $q$-adic values of precision $n$ by adding it to integer values representing the $q$-adic value modulo $p^n$ as in the examples.

Examples

julia> R, _ = QadicField(7, 1, 30);
+7^-2 + O(7^28)

Big-oh notation

Elements of p-adic fields can be constructed using the big-oh notation. For this purpose we define the following functions.

AbstractAlgebra.OMethod
O(R::FlintQadicField, m::Integer)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintQadicField, m::ZZRingElem)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source
AbstractAlgebra.OMethod
O(R::FlintQadicField, m::QQFieldElem)

Construct the value $0 + O(p^n)$ given $m = p^n$. An exception results if $m$ is not found to be a power of p = prime(R).

source

The $O(p^n)$ construction can be used to construct $q$-adic values of precision $n$ by adding it to integer values representing the $q$-adic value modulo $p^n$ as in the examples.

Examples

julia> R, _ = QadicField(7, 1, 30);
 
 julia> S, _ = QadicField(ZZ(65537), 1, 30);
 
@@ -24,7 +24,7 @@
 13*65537^0 + 357*65537^1 + O(65537^12)
 
 julia> f = ZZ(1)//7^2 + ZZ(2)//7 + 3 + 4*7 + O(R, 7^2)
-7^-2 + 2*7^-1 + 3*7^0 + 4*7^1 + O(7^2)

Beware that the expression 1 + 2*p + 3*p^2 + O(R, p^n) is actually computed as a normal Julia expression. Therefore if {Int} values are used instead of Flint integers or Julia bignums, overflow may result in evaluating the value.

Basic manipulation

Base.precisionMethod
precision(a::qadic)

Return the precision of the given $q$-adic field element, i.e. if the element is known to $O(p^n)$ this function will return $n$.

source
AbstractAlgebra.valuationMethod
valuation(a::qadic)

Return the valuation of the given $q$-adic field element, i.e. if the given element is divisible by $p^n$ but not a higher power of $q$ then the function will return $n$.

source
AbstractAlgebra.liftMethod
lift(R::QQPolyRing, a::qadic)

Return a lift of the given $q$-adic field element to $\mathbb{Q}[x]$.

source
AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, a::qadic)

Return a lift of the given $q$-adic field element to $\mathbb{Z}[x]$ if possible.

source

Examples

R, _ = QadicField(7, 1, 30);
+7^-2 + 2*7^-1 + 3*7^0 + 4*7^1 + O(7^2)

Beware that the expression 1 + 2*p + 3*p^2 + O(R, p^n) is actually computed as a normal Julia expression. Therefore if {Int} values are used instead of Flint integers or Julia bignums, overflow may result in evaluating the value.

Basic manipulation

Base.precisionMethod
precision(a::qadic)

Return the precision of the given $q$-adic field element, i.e. if the element is known to $O(p^n)$ this function will return $n$.

source
AbstractAlgebra.valuationMethod
valuation(a::qadic)

Return the valuation of the given $q$-adic field element, i.e. if the given element is divisible by $p^n$ but not a higher power of $q$ then the function will return $n$.

source
AbstractAlgebra.liftMethod
lift(R::QQPolyRing, a::qadic)

Return a lift of the given $q$-adic field element to $\mathbb{Q}[x]$.

source
AbstractAlgebra.liftMethod
lift(R::ZZPolyRing, a::qadic)

Return a lift of the given $q$-adic field element to $\mathbb{Z}[x]$ if possible.

source

Examples

R, _ = QadicField(7, 1, 30);
 
 a = 1 + 2*7 + 4*7^2 + O(R, 7^3)
 b = 7^2 + 3*7^3 + O(R, 7^5)
@@ -36,7 +36,7 @@
 Qx, x = FlintQQ["x"]
 p = lift(Qx, a)
 Zy, y = FlintZZ["y"]
-q = lift(Zy, divexact(a, b))

Square root

Base.sqrtMethod
sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement

Return the square root of the given Puiseux series $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Base.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement

Return the square root of $f$. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.

Base.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem

Return the square root of $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

sqrt(a::FieldElem)

Return the square root of the element a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Examples

julia> R, _ = QadicField(7, 1, 30);
+q = lift(Zy, divexact(a, b))

Square root

Base.sqrtMethod
Base.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement

Return the square root of $f$. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.

Base.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem

Return the square root of $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

sqrt(a::FieldElem)

Return the square root of the element a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement

Return the square root of the given Puiseux series $a$. By default the function will throw an exception if the input is not square. If check=false this test is omitted.

Examples

julia> R, _ = QadicField(7, 1, 30);
 
 julia> a = 1 + 7 + 2*7^2 + O(R, 7^3)
 7^0 + 7^1 + 2*7^2 + O(7^3)
@@ -57,7 +57,7 @@
 7^1 + 7^2 + O(7^3)
 
 julia> g = sqrt(R(121))
-4*7^0 + 7^1 + O(7^30)

Special functions

Base.expMethod
exp(a::Generic.LaurentSeriesElem)

Return the exponential of the power series $a$.

exp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the exponential of the given Puiseux series $a$.

exp(a::AbsPowerSeriesRingElem)

Return the exponential of the power series $a$.

exp(a::RelPowerSeriesRingElem)

Return the exponential of the power series $a$.

Base.logMethod
log(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the logarithm of the given Puiseux series $a$.

log(a::SeriesElem{T}) where T <: FieldElement

Return the logarithm of the power series $a$.

Nemo.teichmullerMethod
teichmuller(a::qadic)

Return the Teichmuller lift of the $q$-adic value $a$. We require the valuation of $a$ to be nonnegative. The precision of the output will be the same as the precision of the input. For convenience, if $a$ is congruent to zero modulo $q$ we return zero. If the input is not valid an exception is thrown.

source
Nemo.frobeniusMethod
frobenius(a::qadic, e::Int = 1)

Return the image of the $e$-th power of Frobenius on the $q$-adic value $a$. The precision of the output will be the same as the precision of the input.

source

Examples

julia> R, _ = QadicField(7, 1, 30);
+4*7^0 + 7^1 + O(7^30)

Special functions

Base.expMethod
exp(a::AbsPowerSeriesRingElem)

Return the exponential of the power series $a$.

exp(a::RelPowerSeriesRingElem)

Return the exponential of the power series $a$.

exp(a::Generic.LaurentSeriesElem)

Return the exponential of the power series $a$.

exp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the exponential of the given Puiseux series $a$.

Base.logMethod
log(a::SeriesElem{T}) where T <: FieldElement

Return the logarithm of the power series $a$.

log(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement

Return the logarithm of the given Puiseux series $a$.

Nemo.teichmullerMethod
teichmuller(a::qadic)

Return the Teichmuller lift of the $q$-adic value $a$. We require the valuation of $a$ to be nonnegative. The precision of the output will be the same as the precision of the input. For convenience, if $a$ is congruent to zero modulo $q$ we return zero. If the input is not valid an exception is thrown.

source
Nemo.frobeniusMethod
frobenius(a::qadic, e::Int = 1)

Return the image of the $e$-th power of Frobenius on the $q$-adic value $a$. The precision of the output will be the same as the precision of the input.

source

Examples

julia> R, _ = QadicField(7, 1, 30);
 
 julia> a = 1 + 7 + 2*7^2 + O(R, 7^3)
 7^0 + 7^1 + 2*7^2 + O(7^3)
@@ -84,4 +84,4 @@
 2*7^0 + 4*7^1 + 6*7^2 + O(7^3)
 
 julia> g = frobenius(a, 2)
-7^0 + 7^1 + 2*7^2 + O(7^3)
+7^0 + 7^1 + 2*7^2 + O(7^3)
diff --git a/dev/rational/index.html b/dev/rational/index.html index b7daf1071..c91fe94b3 100644 --- a/dev/rational/index.html +++ b/dev/rational/index.html @@ -1,2 +1,2 @@ -Rationals · Nemo.jl

Rationals

Nemo provides much functionality for the rational numbers. See the section on Fraction Fields where all the basic functionality is documented, along with the extra functionality only available for the rational numbers themselves.

+Rationals · Nemo.jl

Rationals

Nemo provides much functionality for the rational numbers. See the section on Fraction Fields where all the basic functionality is documented, along with the extra functionality only available for the rational numbers themselves.

diff --git a/dev/real/index.html b/dev/real/index.html index b97368ceb..442c09f80 100644 --- a/dev/real/index.html +++ b/dev/real/index.html @@ -1,10 +1,10 @@ Arbitrary precision real balls · Nemo.jl

Arbitrary precision real balls

Arbitrary precision real ball arithmetic is supplied by Arb which provides a ball representation which tracks error bounds rigorously. Real numbers are represented in mid-rad interval form $[m \pm r] = [m-r, m+r]$.

The types of real balls in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.

LibraryFieldElement typeParent type
Arb$\mathbb{R}$ (balls)RealFieldElemRealField

The real field types belong to the Field abstract type and the types of elements in this field, i.e. balls in this case, belong to the FieldElem abstract type.

Real ball functionality

Real balls in Nemo provide all the field functionality described in AbstractAlgebra:

https://nemocas.github.io/AbstractAlgebra.jl/stable/field

Below, we document the additional functionality provided for real balls.

Precision management

Precision for ball arithmetic and creation of elements can be controlled using the functions:

Base.precisionMethod
precision(::Type{Balls})

Return the precision for ball arithmetic.

Examples

julia> set_precision!(Balls, 200); precision(Balls)
-200
source
AbstractAlgebra.set_precision!Method
set_precision!(::Type{Balls}, n::Int)

Set the precision for all ball arithmetic to be n.

Examples

julia> const_pi(RealField())
 [3.141592653589793239 +/- 5.96e-19]
 
 julia> set_precision!(Balls, 200); const_pi(RealField())
-[3.14159265358979323846264338327950288419716939937510582097494 +/- 5.73e-60]
source
AbstractAlgebra.set_precision!Method
set_precision!(f, ::Type{Balls}, n::Int)

Change ball arithmetic precision to n for the duration of f..

Examples

julia> set_precision!(Balls, 4) do
+[3.14159265358979323846264338327950288419716939937510582097494 +/- 5.73e-60]
source
AbstractAlgebra.set_precision!Method
set_precision!(f, ::Type{Balls}, n::Int)

Change ball arithmetic precision to n for the duration of f..

Examples

julia> set_precision!(Balls, 4) do
          const_pi(RealField())
        end
 [3e+0 +/- 0.376]
@@ -12,7 +12,7 @@
 julia> set_precision!(Balls, 200) do
          const_pi(RealField())
        end
-[3.1415926535897932385 +/- 3.74e-20]
source
Info

This functions are not thread-safe.

Constructors

In order to construct real balls in Nemo, one must first construct the Arb real field itself. This is accomplished with the following constructor.

RealField()

Here is an example of creating the real field and using the resulting parent object to coerce values into the resulting field.

Examples

julia> RR = RealField()
+[3.1415926535897932385 +/- 3.74e-20]
source
Info

This functions are not thread-safe.

Constructors

In order to construct real balls in Nemo, one must first construct the Arb real field itself. This is accomplished with the following constructor.

RealField()

Here is an example of creating the real field and using the resulting parent object to coerce values into the resulting field.

Examples

julia> RR = RealField()
 Real field
 
 julia> a = RR("0.25")
@@ -39,7 +39,7 @@
 Real field
 
 julia> convert(Float64, RR(1//3))
-0.3333333333333333

Basic manipulation

Nemo.is_nonzeroMethod
is_nonzero(x::RealFieldElem)

Return true if $x$ is certainly not equal to zero, otherwise return false.

source
Base.isfiniteMethod
isfinite(x::RealFieldElem)

Return true if $x$ is finite, i.e. having finite midpoint and radius, otherwise return false.

source
Nemo.is_exactMethod
is_exact(x::RealFieldElem)

Return true if $x$ is exact, i.e. has zero radius, otherwise return false.

source
Base.isintegerMethod
isinteger(x::RealFieldElem)

Return true if $x$ is an exact integer, otherwise return false.

source
Nemo.is_positiveMethod
is_positive(x::RealFieldElem)

Return true if $x$ is certainly positive, otherwise return false.

source
Nemo.is_nonnegativeMethod
is_nonnegative(x::RealFieldElem)

Return true if $x$ is certainly nonnegative, otherwise return false.

source
AbstractAlgebra.is_negativeMethod
is_negative(x::RealFieldElem)

Return true if $x$ is certainly negative, otherwise return false.

source
Nemo.is_nonpositiveMethod
is_nonpositive(x::RealFieldElem)

Return true if $x$ is certainly nonpositive, otherwise return false.

source
Nemo.midpointMethod
midpoint(x::RealFieldElem)

Return the midpoint of the ball $x$ as an Arb ball.

source
Nemo.radiusMethod
radius(x::RealFieldElem)

Return the radius of the ball $x$ as an Arb ball.

source
Nemo.accuracy_bitsMethod
accuracy_bits(x::RealFieldElem)

Return the relative accuracy of $x$ measured in bits, capped between typemax(Int) and -typemax(Int).

source

Examples

julia> RR = RealField()
+0.3333333333333333

Basic manipulation

Nemo.is_nonzeroMethod
is_nonzero(x::RealFieldElem)

Return true if $x$ is certainly not equal to zero, otherwise return false.

source
Base.isfiniteMethod
isfinite(x::RealFieldElem)

Return true if $x$ is finite, i.e. having finite midpoint and radius, otherwise return false.

source
Nemo.is_exactMethod
is_exact(x::RealFieldElem)

Return true if $x$ is exact, i.e. has zero radius, otherwise return false.

source
Base.isintegerMethod
isinteger(x::RealFieldElem)

Return true if $x$ is an exact integer, otherwise return false.

source
Nemo.is_positiveMethod
is_positive(x::RealFieldElem)

Return true if $x$ is certainly positive, otherwise return false.

source
Nemo.is_nonnegativeMethod
is_nonnegative(x::RealFieldElem)

Return true if $x$ is certainly nonnegative, otherwise return false.

source
AbstractAlgebra.is_negativeMethod
is_negative(x::RealFieldElem)

Return true if $x$ is certainly negative, otherwise return false.

source
Nemo.is_nonpositiveMethod
is_nonpositive(x::RealFieldElem)

Return true if $x$ is certainly nonpositive, otherwise return false.

source
Nemo.midpointMethod
midpoint(x::RealFieldElem)

Return the midpoint of the ball $x$ as an Arb ball.

source
Nemo.radiusMethod
radius(x::RealFieldElem)

Return the radius of the ball $x$ as an Arb ball.

source
Nemo.accuracy_bitsMethod
accuracy_bits(x::RealFieldElem)

Return the relative accuracy of $x$ measured in bits, capped between typemax(Int) and -typemax(Int).

source

Examples

julia> RR = RealField()
 Real field
 
 julia> a = RR("1.2 +/- 0.001")
@@ -82,7 +82,7 @@
 print(x, "\n", y, "\n", mid, "\n", rad)

which generates

[+/- 3.01]
 [1e+1 +/- 4.01]
 1.0000000000000000000
-[2.0000000037252902985 +/- 3.81e-20]

The first reason that c is not printed as [1 +/- 2] is that the midpoint does not have a greater exponent than the radius in its scientific notation. For similar reasons y is not printed as [12 +/- 2].

The second reason is that we get an additional error term after our addition. As we see, radius(c) is not equal to $2$, which when printed rounds it up to a reasonable decimal place. This is because real balls keep track of rounding errors of basic arithmetic.

Containment

It is often necessary to determine whether a given exact value or ball is contained in a given real ball or whether two balls overlap. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::RealFieldElem, y::RealFieldElem)

Returns true if any part of the ball $x$ overlaps any part of the ball $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::RealFieldElem)

Returns true if the ball $x$ contains the ball $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::Integer)

Returns true if the ball $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::ZZRingElem)

Returns true if the ball $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::QQFieldElem)

Returns true if the ball $x$ contains the given rational value, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::Rational{T}) where {T <: Integer}

Returns true if the ball $x$ contains the given rational value, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::BigFloat)

Returns true if the ball $x$ contains the given floating point value, otherwise return false.

source

The following functions are also provided for determining if a ball intersects a certain part of the real number line.

Nemo.contains_zeroMethod
contains_zero(x::RealFieldElem)

Returns true if the ball $x$ contains zero, otherwise return false.

source
Nemo.contains_negativeMethod
contains_negative(x::RealFieldElem)

Returns true if the ball $x$ contains any negative value, otherwise return false.

source
Nemo.contains_positiveMethod
contains_positive(x::RealFieldElem)

Returns true if the ball $x$ contains any positive value, otherwise return false.

source
Nemo.contains_nonnegativeMethod
contains_nonnegative(x::RealFieldElem)

Returns true if the ball $x$ contains any nonnegative value, otherwise return false.

source
Nemo.contains_nonpositiveMethod
contains_nonpositive(x::RealFieldElem)

Returns true if the ball $x$ contains any nonpositive value, otherwise return false.

source

Examples

julia> RR = RealField()
+[2.0000000037252902985 +/- 3.81e-20]

The first reason that c is not printed as [1 +/- 2] is that the midpoint does not have a greater exponent than the radius in its scientific notation. For similar reasons y is not printed as [12 +/- 2].

The second reason is that we get an additional error term after our addition. As we see, radius(c) is not equal to $2$, which when printed rounds it up to a reasonable decimal place. This is because real balls keep track of rounding errors of basic arithmetic.

Containment

It is often necessary to determine whether a given exact value or ball is contained in a given real ball or whether two balls overlap. The following functions are provided for this purpose.

Nemo.overlapsMethod
overlaps(x::RealFieldElem, y::RealFieldElem)

Returns true if any part of the ball $x$ overlaps any part of the ball $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::RealFieldElem)

Returns true if the ball $x$ contains the ball $y$, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::Integer)

Returns true if the ball $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::ZZRingElem)

Returns true if the ball $x$ contains the given integer value, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::QQFieldElem)

Returns true if the ball $x$ contains the given rational value, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::Rational{T}) where {T <: Integer}

Returns true if the ball $x$ contains the given rational value, otherwise return false.

source
Base.containsMethod
contains(x::RealFieldElem, y::BigFloat)

Returns true if the ball $x$ contains the given floating point value, otherwise return false.

source

The following functions are also provided for determining if a ball intersects a certain part of the real number line.

Nemo.contains_zeroMethod
contains_zero(x::RealFieldElem)

Returns true if the ball $x$ contains zero, otherwise return false.

source
Nemo.contains_negativeMethod
contains_negative(x::RealFieldElem)

Returns true if the ball $x$ contains any negative value, otherwise return false.

source
Nemo.contains_positiveMethod
contains_positive(x::RealFieldElem)

Returns true if the ball $x$ contains any positive value, otherwise return false.

source
Nemo.contains_nonnegativeMethod
contains_nonnegative(x::RealFieldElem)

Returns true if the ball $x$ contains any nonnegative value, otherwise return false.

source
Nemo.contains_nonpositiveMethod
contains_nonpositive(x::RealFieldElem)

Returns true if the ball $x$ contains any nonpositive value, otherwise return false.

source

Examples

julia> RR = RealField()
 Real field
 
 julia> x = RR("1 +/- 0.001")
@@ -107,7 +107,7 @@
 false
 
 julia> contains_positive(y)
-true

Comparison

Nemo provides a full range of comparison operations for Arb balls. Note that a ball is considered less than another ball if every value in the first ball is less than every value in the second ball, etc.

In addition to the standard comparison operators, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.

Base.isequalMethod
isequal(x::RealFieldElem, y::RealFieldElem)

Return true if the balls $x$ and $y$ are precisely equal, i.e. have the same midpoints and radii.

source

We also provide a full range of ad hoc comparison operators. These are implemented directly in Julia, but we document them as though isless and == were provided.

Function
==(x::RealFieldElem, y::Integer)
==(x::Integer, y::RealFieldElem)
==(x::RealFieldElem, y::ZZRingElem)
==(x::ZZRingElem, y::RealFieldElem)
==(x::RealFieldElem, y::Float64)
==(x::Float64, y::RealFieldElem)
isless(x::RealFieldElem, y::Integer)
isless(x::Integer, y::RealFieldElem)
isless(x::RealFieldElem, y::ZZRingElem)
isless(x::ZZRingElem, y::RealFieldElem)
isless(x::RealFieldElem, y::Float64)
isless(x::Float64, y::RealFieldElem)
isless(x::RealFieldElem, y::BigFloat)
isless(x::BigFloat, y::RealFieldElem)
isless(x::RealFieldElem, y::QQFieldElem)
isless(x::QQFieldElem, y::RealFieldElem)

Examples

julia> RR = RealField()
+true

Comparison

Nemo provides a full range of comparison operations for Arb balls. Note that a ball is considered less than another ball if every value in the first ball is less than every value in the second ball, etc.

In addition to the standard comparison operators, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.

Base.isequalMethod
isequal(x::RealFieldElem, y::RealFieldElem)

Return true if the balls $x$ and $y$ are precisely equal, i.e. have the same midpoints and radii.

source

We also provide a full range of ad hoc comparison operators. These are implemented directly in Julia, but we document them as though isless and == were provided.

Function
==(x::RealFieldElem, y::Integer)
==(x::Integer, y::RealFieldElem)
==(x::RealFieldElem, y::ZZRingElem)
==(x::ZZRingElem, y::RealFieldElem)
==(x::RealFieldElem, y::Float64)
==(x::Float64, y::RealFieldElem)
isless(x::RealFieldElem, y::Integer)
isless(x::Integer, y::RealFieldElem)
isless(x::RealFieldElem, y::ZZRingElem)
isless(x::ZZRingElem, y::RealFieldElem)
isless(x::RealFieldElem, y::Float64)
isless(x::Float64, y::RealFieldElem)
isless(x::RealFieldElem, y::BigFloat)
isless(x::BigFloat, y::RealFieldElem)
isless(x::RealFieldElem, y::QQFieldElem)
isless(x::QQFieldElem, y::RealFieldElem)

Examples

julia> RR = RealField()
 Real field
 
 julia> x = RR("1 +/- 0.001")
@@ -146,7 +146,7 @@
 [-2.52e+7 +/- 4.26e+4]
 
 julia> b = ldexp(x, -ZZ(15))
-[-9.16e-5 +/- 7.78e-8]

Miscellaneous operations

Nemo.add_error!Method
add_error!(x::RealFieldElem, y::RealFieldElem)

Adds the absolute values of the midpoint and radius of $y$ to the radius of $x$.

source
Nemo.trimMethod
trim(x::RealFieldElem)

Return an arb interval containing $x$ but which may be more economical, by rounding off insignificant bits from the midpoint.

source
Nemo.unique_integerMethod
unique_integer(x::RealFieldElem)

Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the interval $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.

source
Nemo.setunionMethod
setunion(x::RealFieldElem, y::RealFieldElem)

Return an arb containing the union of the intervals represented by $x$ and $y$.

source

Examples

julia> RR = RealField()
+[-9.16e-5 +/- 7.78e-8]

Miscellaneous operations

Nemo.add_error!Method
add_error!(x::RealFieldElem, y::RealFieldElem)

Adds the absolute values of the midpoint and radius of $y$ to the radius of $x$.

source
Nemo.trimMethod
trim(x::RealFieldElem)

Return an arb interval containing $x$ but which may be more economical, by rounding off insignificant bits from the midpoint.

source
Nemo.unique_integerMethod
unique_integer(x::RealFieldElem)

Return a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the interval $x$ contains a unique integer. If this is the case, the second return value is set to this unique integer.

source
Nemo.setunionMethod
setunion(x::RealFieldElem, y::RealFieldElem)

Return an arb containing the union of the intervals represented by $x$ and $y$.

source

Examples

julia> RR = RealField()
 Real field
 
 julia> x = RR("-3 +/- 0.001")
@@ -162,7 +162,7 @@
 (true, -3)
 
 julia> d = setunion(x, y)
-[+/- 3.01]

Constants

Nemo.const_piMethod
const_pi(r::RealField)

Return $\pi = 3.14159\ldots$ as an element of $r$.

source
Nemo.const_eMethod
const_e(r::RealField)

Return $e = 2.71828\ldots$ as an element of $r$.

source
Nemo.const_log2Method
const_log2(r::RealField)

Return $\log(2) = 0.69314\ldots$ as an element of $r$.

source
Nemo.const_log10Method
const_log10(r::RealField)

Return $\log(10) = 2.302585\ldots$ as an element of $r$.

source
Nemo.const_eulerMethod
const_euler(r::RealField)

Return Euler's constant $\gamma = 0.577215\ldots$ as an element of $r$.

source
Nemo.const_catalanMethod
const_catalan(r::RealField)

Return Catalan's constant $C = 0.915965\ldots$ as an element of $r$.

source
Nemo.const_khinchinMethod
const_khinchin(r::RealField)

Return Khinchin's constant $K = 2.685452\ldots$ as an element of $r$.

source
Nemo.const_glaisherMethod
const_glaisher(r::RealField)

Return Glaisher's constant $A = 1.282427\ldots$ as an element of $r$.

source

Examples

julia> RR = RealField()
+[+/- 3.01]

Constants

Nemo.const_piMethod
const_pi(r::RealField)

Return $\pi = 3.14159\ldots$ as an element of $r$.

source
Nemo.const_eMethod
const_e(r::RealField)

Return $e = 2.71828\ldots$ as an element of $r$.

source
Nemo.const_log2Method
const_log2(r::RealField)

Return $\log(2) = 0.69314\ldots$ as an element of $r$.

source
Nemo.const_log10Method
const_log10(r::RealField)

Return $\log(10) = 2.302585\ldots$ as an element of $r$.

source
Nemo.const_eulerMethod
const_euler(r::RealField)

Return Euler's constant $\gamma = 0.577215\ldots$ as an element of $r$.

source
Nemo.const_catalanMethod
const_catalan(r::RealField)

Return Catalan's constant $C = 0.915965\ldots$ as an element of $r$.

source
Nemo.const_khinchinMethod
const_khinchin(r::RealField)

Return Khinchin's constant $K = 2.685452\ldots$ as an element of $r$.

source
Nemo.const_glaisherMethod
const_glaisher(r::RealField)

Return Glaisher's constant $A = 1.282427\ldots$ as an element of $r$.

source

Examples

julia> RR = RealField()
 Real field
 
 julia> a = const_pi(RR)
@@ -175,7 +175,7 @@
 [0.5772156649015328606 +/- 4.35e-20]
 
 julia> d = const_glaisher(RR)
-[1.282427129100622637 +/- 3.01e-19]

Mathematical and special functions

Nemo.rsqrtMethod
rsqrt(x::RealFieldElem)

Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$.

source
Nemo.sqrt1pm1Method
sqrt1pm1(x::RealFieldElem)

Return $\sqrt{1+x}-1$, evaluated accurately for small $x$.

source
Nemo.sqrtposMethod
sqrtpos(x::RealFieldElem)

Return the sqrt root of $x$, assuming that $x$ represents a nonnegative number. Thus any negative number in the input interval is discarded.

source
Nemo.gammaMethod
gamma(x::RealFieldElem)

Return the Gamma function evaluated at $x$.

source
Nemo.lgammaMethod
lgamma(x::RealFieldElem)

Return the logarithm of the Gamma function evaluated at $x$.

source
Nemo.rgammaMethod
rgamma(x::RealFieldElem)

Return the reciprocal of the Gamma function evaluated at $x$.

source
Nemo.digammaMethod
digamma(x::RealFieldElem)

Return the logarithmic derivative of the gamma function evaluated at $x$, i.e. $\psi(x)$.

source
Nemo.gammaMethod
gamma(s::RealFieldElem, x::RealFieldElem)

Return the upper incomplete gamma function $\Gamma(s,x)$.

source
Nemo.gamma_regularizedMethod
gamma_regularized(s::RealFieldElem, x::RealFieldElem)

Return the regularized upper incomplete gamma function $\Gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lowerMethod
gamma_lower(s::RealFieldElem, x::RealFieldElem)

Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lower_regularizedMethod
gamma_lower_regularized(s::RealFieldElem, x::RealFieldElem)

Return the regularized lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.zetaMethod
zeta(x::RealFieldElem)

Return the Riemann zeta function evaluated at $x$.

source
Nemo.atan2Method
atan2(y::RealFieldElem, x::RealFieldElem)

Return $\operatorname{atan2}(y,x) = \arg(x+yi)$. Same as atan(y, x).

source
Nemo.agmMethod
agm(x::RealFieldElem, y::RealFieldElem)

Return the arithmetic-geometric mean of $x$ and $y$

source
Nemo.zetaMethod
zeta(s::RealFieldElem, a::RealFieldElem)

Return the Hurwitz zeta function $\zeta(s,a)$.

source
AbstractAlgebra.rootMethod
root(x::RealFieldElem, n::Int)

Return the $n$-th root of $x$. We require $x \geq 0$.

source
Base.factorialMethod
factorial(x::RealFieldElem)

Return the factorial of $x$.

source
Base.factorialMethod
factorial(n::Int, r::RealField)

Return the factorial of $n$ in the given Arb field.

source
Base.binomialMethod
binomial(x::RealFieldElem, n::UInt)

Return the binomial coefficient ${x \choose n}$.

source
Base.binomialMethod
binomial(n::UInt, k::UInt, r::RealField)

Return the binomial coefficient ${n \choose k}$ in the given Arb field.

source
Nemo.fibonacciMethod
fibonacci(n::ZZRingElem, r::RealField)

Return the $n$-th Fibonacci number in the given Arb field.

source
Nemo.fibonacciMethod
fibonacci(n::Int, r::RealField)

Return the $n$-th Fibonacci number in the given Arb field.

source
Nemo.gammaMethod
gamma(x::ZZRingElem, r::RealField)

Return the Gamma function evaluated at $x$ in the given Arb field.

source
Nemo.gammaMethod
gamma(x::QQFieldElem, r::RealField)

Return the Gamma function evaluated at $x$ in the given Arb field.

source
Nemo.zetaMethod
zeta(n::Int, r::RealField)

Return the Riemann zeta function $\zeta(n)$ as an element of the given Arb field.

source
Nemo.bernoulliMethod
bernoulli(n::Int, r::RealField)

Return the $n$-th Bernoulli number as an element of the given Arb field.

source
Nemo.rising_factorialMethod
rising_factorial(x::RealFieldElem, n::Int)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an Arb.

source
Nemo.rising_factorialMethod
rising_factorial(x::QQFieldElem, n::Int, r::RealField)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an element of the given Arb field.

source
Nemo.rising_factorial2Method
rising_factorial2(x::RealFieldElem, n::Int)

Return a tuple containing the rising factorial $x(x + 1)\ldots (x + n - 1)$ and its derivative.

source
Nemo.polylogMethod
polylog(s::Union{RealFieldElem,Int}, a::RealFieldElem)

Return the polylogarithm Li$_s(a)$.

source
AbstractAlgebra.chebyshev_tMethod
chebyshev_t(n::Int, x::RealFieldElem)

Return the value of the Chebyshev polynomial $T_n(x)$.

source
AbstractAlgebra.chebyshev_uMethod
chebyshev_u(n::Int, x::RealFieldElem)

Return the value of the Chebyshev polynomial $U_n(x)$.

source
Nemo.chebyshev_t2Method
chebyshev_t2(n::Int, x::RealFieldElem)

Return the tuple $(T_{n}(x), T_{n-1}(x))$.

source
Nemo.chebyshev_u2Method
chebyshev_u2(n::Int, x::RealFieldElem)

Return the tuple $(U_{n}(x), U_{n-1}(x))$

source
Nemo.bellMethod
bell(n::ZZRingElem, r::RealField)

Return the Bell number $B_n$ as an element of $r$.

source
Nemo.bellMethod
bell(n::Int, r::RealField)

Return the Bell number $B_n$ as an element of $r$.

source
Nemo.numpartMethod
numpart(n::ZZRingElem, r::RealField)

Return the number of partitions $p(n)$ as an element of $r$.

source
Nemo.numpartMethod
numpart(n::Int, r::RealField)

Return the number of partitions $p(n)$ as an element of $r$.

source
Nemo.airy_aiMethod
airy_ai(x::RealFieldElem)

Return the Airy function $\operatorname{Ai}(x)$.

source
Nemo.airy_ai_primeMethod
airy_ai_prime(x::RealFieldElem)

Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$.

source
Nemo.airy_biMethod
airy_bi(x::RealFieldElem)

Return the Airy function $\operatorname{Bi}(x)$.

source
Nemo.airy_bi_primeMethod
airy_bi_prime(x::RealFieldElem)

Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$.

source

Examples

julia> RR = RealField()
+[1.282427129100622637 +/- 3.01e-19]

Mathematical and special functions

Nemo.rsqrtMethod
rsqrt(x::RealFieldElem)

Return the reciprocal of the square root of $x$, i.e. $1/\sqrt{x}$.

source
Nemo.sqrt1pm1Method
sqrt1pm1(x::RealFieldElem)

Return $\sqrt{1+x}-1$, evaluated accurately for small $x$.

source
Nemo.sqrtposMethod
sqrtpos(x::RealFieldElem)

Return the sqrt root of $x$, assuming that $x$ represents a nonnegative number. Thus any negative number in the input interval is discarded.

source
Nemo.gammaMethod
gamma(x::RealFieldElem)

Return the Gamma function evaluated at $x$.

source
Nemo.lgammaMethod
lgamma(x::RealFieldElem)

Return the logarithm of the Gamma function evaluated at $x$.

source
Nemo.rgammaMethod
rgamma(x::RealFieldElem)

Return the reciprocal of the Gamma function evaluated at $x$.

source
Nemo.digammaMethod
digamma(x::RealFieldElem)

Return the logarithmic derivative of the gamma function evaluated at $x$, i.e. $\psi(x)$.

source
Nemo.gammaMethod
gamma(s::RealFieldElem, x::RealFieldElem)

Return the upper incomplete gamma function $\Gamma(s,x)$.

source
Nemo.gamma_regularizedMethod
gamma_regularized(s::RealFieldElem, x::RealFieldElem)

Return the regularized upper incomplete gamma function $\Gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lowerMethod
gamma_lower(s::RealFieldElem, x::RealFieldElem)

Return the lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.gamma_lower_regularizedMethod
gamma_lower_regularized(s::RealFieldElem, x::RealFieldElem)

Return the regularized lower incomplete gamma function $\gamma(s,x) / \Gamma(s)$.

source
Nemo.zetaMethod
zeta(x::RealFieldElem)

Return the Riemann zeta function evaluated at $x$.

source
Nemo.atan2Method
atan2(y::RealFieldElem, x::RealFieldElem)

Return $\operatorname{atan2}(y,x) = \arg(x+yi)$. Same as atan(y, x).

source
Nemo.agmMethod
agm(x::RealFieldElem, y::RealFieldElem)

Return the arithmetic-geometric mean of $x$ and $y$

source
Nemo.zetaMethod
zeta(s::RealFieldElem, a::RealFieldElem)

Return the Hurwitz zeta function $\zeta(s,a)$.

source
AbstractAlgebra.rootMethod
root(x::RealFieldElem, n::Int)

Return the $n$-th root of $x$. We require $x \geq 0$.

source
Base.factorialMethod
factorial(x::RealFieldElem)

Return the factorial of $x$.

source
Base.factorialMethod
factorial(n::Int, r::RealField)

Return the factorial of $n$ in the given Arb field.

source
Base.binomialMethod
binomial(x::RealFieldElem, n::UInt)

Return the binomial coefficient ${x \choose n}$.

source
Base.binomialMethod
binomial(n::UInt, k::UInt, r::RealField)

Return the binomial coefficient ${n \choose k}$ in the given Arb field.

source
Nemo.fibonacciMethod
fibonacci(n::ZZRingElem, r::RealField)

Return the $n$-th Fibonacci number in the given Arb field.

source
Nemo.fibonacciMethod
fibonacci(n::Int, r::RealField)

Return the $n$-th Fibonacci number in the given Arb field.

source
Nemo.gammaMethod
gamma(x::ZZRingElem, r::RealField)

Return the Gamma function evaluated at $x$ in the given Arb field.

source
Nemo.gammaMethod
gamma(x::QQFieldElem, r::RealField)

Return the Gamma function evaluated at $x$ in the given Arb field.

source
Nemo.zetaMethod
zeta(n::Int, r::RealField)

Return the Riemann zeta function $\zeta(n)$ as an element of the given Arb field.

source
Nemo.bernoulliMethod
bernoulli(n::Int, r::RealField)

Return the $n$-th Bernoulli number as an element of the given Arb field.

source
Nemo.rising_factorialMethod
rising_factorial(x::RealFieldElem, n::Int)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an Arb.

source
Nemo.rising_factorialMethod
rising_factorial(x::QQFieldElem, n::Int, r::RealField)

Return the rising factorial $x(x + 1)\ldots (x + n - 1)$ as an element of the given Arb field.

source
Nemo.rising_factorial2Method
rising_factorial2(x::RealFieldElem, n::Int)

Return a tuple containing the rising factorial $x(x + 1)\ldots (x + n - 1)$ and its derivative.

source
Nemo.polylogMethod
polylog(s::Union{RealFieldElem,Int}, a::RealFieldElem)

Return the polylogarithm Li$_s(a)$.

source
AbstractAlgebra.chebyshev_tMethod
chebyshev_t(n::Int, x::RealFieldElem)

Return the value of the Chebyshev polynomial $T_n(x)$.

source
AbstractAlgebra.chebyshev_uMethod
chebyshev_u(n::Int, x::RealFieldElem)

Return the value of the Chebyshev polynomial $U_n(x)$.

source
Nemo.chebyshev_t2Method
chebyshev_t2(n::Int, x::RealFieldElem)

Return the tuple $(T_{n}(x), T_{n-1}(x))$.

source
Nemo.chebyshev_u2Method
chebyshev_u2(n::Int, x::RealFieldElem)

Return the tuple $(U_{n}(x), U_{n-1}(x))$

source
Nemo.bellMethod
bell(n::ZZRingElem, r::RealField)

Return the Bell number $B_n$ as an element of $r$.

source
Nemo.bellMethod
bell(n::Int, r::RealField)

Return the Bell number $B_n$ as an element of $r$.

source
Nemo.numpartMethod
numpart(n::ZZRingElem, r::RealField)

Return the number of partitions $p(n)$ as an element of $r$.

source
Nemo.numpartMethod
numpart(n::Int, r::RealField)

Return the number of partitions $p(n)$ as an element of $r$.

source
Nemo.airy_aiMethod
airy_ai(x::RealFieldElem)

Return the Airy function $\operatorname{Ai}(x)$.

source
Nemo.airy_ai_primeMethod
airy_ai_prime(x::RealFieldElem)

Return the derivative of the Airy function $\operatorname{Ai}^\prime(x)$.

source
Nemo.airy_biMethod
airy_bi(x::RealFieldElem)

Return the Airy function $\operatorname{Bi}(x)$.

source
Nemo.airy_bi_primeMethod
airy_bi_prime(x::RealFieldElem)

Return the derivative of the Airy function $\operatorname{Bi}^\prime(x)$.

source

Examples

julia> RR = RealField()
 Real field
 
 julia> a = floor(exp(RR(1)))
@@ -213,13 +213,13 @@
  0
  0
  0
- 1
source
Nemo.simplest_rational_insideMethod
  simplest_rational_inside(x::RealFieldElem)

Return the simplest fraction inside the ball $x$. A canonical fraction $a_1/b_1$ is defined to be simpler than $a_2/b_2$ iff $b_1 < b_2$ or $b_1 = b_2$ and $a_1 < a_2$.

Examples

julia> RR = RealField()
+ 1
source
Nemo.simplest_rational_insideMethod
  simplest_rational_inside(x::RealFieldElem)

Return the simplest fraction inside the ball $x$. A canonical fraction $a_1/b_1$ is defined to be simpler than $a_2/b_2$ iff $b_1 < b_2$ or $b_1 = b_2$ and $a_1 < a_2$.

Examples

julia> RR = RealField()
 Real field
 
 julia> simplest_rational_inside(const_pi(RR))
-8717442233//2774848045
source

Random generation

Base.randMethod
rand([rng=GLOBAL_RNG,] G::SymmetricGroup)

Return a random permutation from G.

rand(r::RealField; randtype::Symbol=:urandom)

Return a random element in given Arb field.

The randtype default is :urandom which return an arb contained in $[0,1]$.

The rest of the methods return non-uniformly distributed values in order to exercise corner cases. The option :randtest will return a finite number, and :randtest_exact the same but with a zero radius. The option :randtest_precise return an arb with a radius around $2^{-\mathrm{prec}}$ the magnitude of the midpoint, while :randtest_wide return a radius that might be big relative to its midpoint. The :randtest_special-option might return a midpoint and radius whose values are NaN or inf.

source

Examples

RR = RealField()
+8717442233//2774848045
source

Random generation

Base.randMethod
rand([rng=GLOBAL_RNG,] G::SymmetricGroup)

Return a random permutation from G.

rand(r::RealField; randtype::Symbol=:urandom)

Return a random element in given Arb field.

The randtype default is :urandom which return an arb contained in $[0,1]$.

The rest of the methods return non-uniformly distributed values in order to exercise corner cases. The option :randtest will return a finite number, and :randtest_exact the same but with a zero radius. The option :randtest_precise return an arb with a radius around $2^{-\mathrm{prec}}$ the magnitude of the midpoint, while :randtest_wide return a radius that might be big relative to its midpoint. The :randtest_special-option might return a midpoint and radius whose values are NaN or inf.

source

Examples

RR = RealField()
 
 a = rand(RR)
 b = rand(RR; randtype = :null_exact)
 c = rand(RR; randtype = :exact)
-d = rand(RR; randtype = :special)
+d = rand(RR; randtype = :special) diff --git a/dev/residue/index.html b/dev/residue/index.html index 80de2bc19..7f44032d3 100644 --- a/dev/residue/index.html +++ b/dev/residue/index.html @@ -1,6 +1,6 @@ -Residue rings · Nemo.jl

Residue rings

Nemo allows the creation of residue rings of the form $R/(a)$ for an element $a$ of a ring $R$.

We don't require $(a)$ to be a prime or maximal ideal. Instead, we allow the creation of the residue ring $R/(a)$ for any nonzero $a$ and simply raise an exception if an impossible inverse is encountered during computations involving elements of $R/(a)$. Of course, a GCD function must be available for the base ring $R$.

There is a generic implementation of residue rings of this form in AbstractAlgebra.jl, which accepts any ring $R$ as base ring.

The associated types of parent object and elements for each kind of residue rings in Nemo are given in the following table.

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.ResidueRingElem{T}Generic.ResidueRing{T}
$\mathbb{Z}$ (Int modulus)FlintzzModRingElemzzModRing
$\mathbb{Z}$ (ZZ modulus)FlintZZModRingElemZZModRing

The modulus $a$ of a residue ring is stored in its parent object.

All residue element types belong to the abstract type ResElem and all the residue ring parent object types belong to the abstract type ResidueRing. This enables one to write generic functions that accept any Nemo residue type.

Residue functionality

All the residue rings in Nemo provide the functionality described in AbstractAlgebra for residue rings:

https://nemocas.github.io/AbstractAlgebra.jl/stable/residue

In addition, generic residue rings are available.

We describe Nemo specific residue ring functionality below.

GCD

Base.gcdxMethod
gcdx(a::zzModRingElem, b::zzModRingElem)

Compute the extended gcd with the Euclidean structure inherited from $\mathbb{Z}$.

source
Base.gcdxMethod
gcdx(a::ZZModRingElem, b::ZZModRingElem)

Compute the extended gcd with the Euclidean structure inherited from $\mathbb{Z}$.

source

Examples

julia> R = residue_ring(ZZ, 123456789012345678949)
+Residue rings · Nemo.jl

Residue rings

Nemo allows the creation of residue rings of the form $R/(a)$ for an element $a$ of a ring $R$.

We don't require $(a)$ to be a prime or maximal ideal. Instead, we allow the creation of the residue ring $R/(a)$ for any nonzero $a$ and simply raise an exception if an impossible inverse is encountered during computations involving elements of $R/(a)$. Of course, a GCD function must be available for the base ring $R$.

There is a generic implementation of residue rings of this form in AbstractAlgebra.jl, which accepts any ring $R$ as base ring.

The associated types of parent object and elements for each kind of residue rings in Nemo are given in the following table.

Base ringLibraryElement typeParent type
Generic ring $R$AbstractAlgebra.jlGeneric.ResidueRingElem{T}Generic.ResidueRing{T}
$\mathbb{Z}$ (Int modulus)FlintzzModRingElemzzModRing
$\mathbb{Z}$ (ZZ modulus)FlintZZModRingElemZZModRing

The modulus $a$ of a residue ring is stored in its parent object.

All residue element types belong to the abstract type ResElem and all the residue ring parent object types belong to the abstract type ResidueRing. This enables one to write generic functions that accept any Nemo residue type.

Residue functionality

All the residue rings in Nemo provide the functionality described in AbstractAlgebra for residue rings:

https://nemocas.github.io/AbstractAlgebra.jl/stable/residue

In addition, generic residue rings are available.

We describe Nemo specific residue ring functionality below.

GCD

Base.gcdxMethod
gcdx(a::zzModRingElem, b::zzModRingElem)

Compute the extended gcd with the Euclidean structure inherited from $\mathbb{Z}$.

source
Base.gcdxMethod
gcdx(a::ZZModRingElem, b::ZZModRingElem)

Compute the extended gcd with the Euclidean structure inherited from $\mathbb{Z}$.

source

Examples

julia> R = residue_ring(ZZ, 123456789012345678949)
 Integers modulo 123456789012345678949
 
 julia> g, s, t = gcdx(R(123), R(456))
-(1, 123456789012345678928, 41152263004115226322)
+(1, 123456789012345678928, 41152263004115226322)
diff --git a/dev/search/index.html b/dev/search/index.html index bc93bbd69..9f4a468ff 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · Nemo.jl

Loading search...

    +Search · Nemo.jl

    Loading search...

      diff --git a/dev/search_index.js b/dev/search_index.js index c766dcbaa..f2098a12f 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"arb/#Fixed-precision-real-balls","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Fixed precision real ball arithmetic is supplied by Arb which provides a ball representation which tracks error bounds rigorously. Real numbers are represented in mid-rad interval form m pm r = m-r m+r.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The Arb real field is constructed using the ArbField constructor. This constructs the parent object for the Arb real field.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The types of real balls in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Library Field Element type Parent type\nArb mathbbR (balls) arb ArbField","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"All the real field types belong to the Field abstract type and the types of elements in this field, i.e. balls in this case, belong to the FieldElem abstract type.","category":"page"},{"location":"arb/#Real-ball-functionality","page":"Fixed precision real balls","title":"Real ball functionality","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Real balls in Nemo provide all the field functionality described in AbstractAlgebra:","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Below, we document the additional functionality provided for real balls.","category":"page"},{"location":"arb/#Constructors","page":"Fixed precision real balls","title":"Constructors","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"In order to construct real balls in Nemo, one must first construct the Arb real field itself. This is accomplished with the following constructor.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"ArbField(prec::Int)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Return the Arb field with precision in bits prec used for operations on interval midpoints. The precision used for interval radii is a fixed implementation-defined constant (30 bits).","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Here is an example of creating an Arb real field and using the resulting parent object to coerce values into the resulting field.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\na = RR(\"0.25\")\nb = RR(\"0.1 +/- 0.001\")\nc = RR(0.5)\nd = RR(12)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Note that whilst one can coerce double precision floating point values into an Arb real field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb field.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.","category":"page"},{"location":"arb/#Real-ball-constructors","page":"Fixed precision real balls","title":"Real ball constructors","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"ball(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.ball-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.ball","text":"ball(x::arb, y::arb)\n\nConstructs an Arb ball enclosing x_m pm (x_r + y_m + y_r), given the pair (x y) = (x_m pm x_r y_m pm y_r).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\nc = ball(RR(3), RR(\"0.0001\"))","category":"page"},{"location":"arb/#Conversions","page":"Fixed precision real balls","title":"Conversions","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\nconvert(Float64, RR(1//3))","category":"page"},{"location":"arb/#Basic-manipulation","page":"Fixed precision real balls","title":"Basic manipulation","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_nonzero(::arb)","category":"page"},{"location":"arb/#Nemo.is_nonzero-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_nonzero","text":"is_nonzero(x::arb)\n\nReturn true if x is certainly not equal to zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"isfinite(::arb)","category":"page"},{"location":"arb/#Base.isfinite-Tuple{arb}","page":"Fixed precision real balls","title":"Base.isfinite","text":"isfinite(x::arb)\n\nReturn true if x is finite, i.e. having finite midpoint and radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_exact(::arb)","category":"page"},{"location":"arb/#Nemo.is_exact-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_exact","text":"is_exact(x::arb)\n\nReturn true if x is exact, i.e. has zero radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"isinteger(::arb)","category":"page"},{"location":"arb/#Base.isinteger-Tuple{arb}","page":"Fixed precision real balls","title":"Base.isinteger","text":"isinteger(x::arb)\n\nReturn true if x is an exact integer, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_positive(::arb)","category":"page"},{"location":"arb/#Nemo.is_positive-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_positive","text":"is_positive(x::arb)\n\nReturn true if x is certainly positive, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_nonnegative(::arb)","category":"page"},{"location":"arb/#Nemo.is_nonnegative-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_nonnegative","text":"is_nonnegative(x::arb)\n\nReturn true if x is certainly nonnegative, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_negative(::arb)","category":"page"},{"location":"arb/#AbstractAlgebra.is_negative-Tuple{arb}","page":"Fixed precision real balls","title":"AbstractAlgebra.is_negative","text":"is_negative(x::arb)\n\nReturn true if x is certainly negative, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_nonpositive(::arb)","category":"page"},{"location":"arb/#Nemo.is_nonpositive-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_nonpositive","text":"is_nonpositive(x::arb)\n\nReturn true if x is certainly nonpositive, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"midpoint(::arb)","category":"page"},{"location":"arb/#Nemo.midpoint-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.midpoint","text":"midpoint(x::arb)\n\nReturn the midpoint of the ball x as an Arb ball.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"radius(::arb)","category":"page"},{"location":"arb/#Nemo.radius-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.radius","text":"radius(x::arb)\n\nReturn the radius of the ball x as an Arb ball.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"accuracy_bits(::arb)","category":"page"},{"location":"arb/#Nemo.accuracy_bits-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.accuracy_bits","text":"accuracy_bits(x::arb)\n\nReturn the relative accuracy of x measured in bits, capped between typemax(Int) and -typemax(Int).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\na = RR(\"1.2 +/- 0.001\")\nb = RR(3)\n\nis_positive(a)\nisfinite(b)\nisinteger(b)\nis_negative(a)\nc = radius(a)\nd = midpoint(b)\nf = accuracy_bits(a)","category":"page"},{"location":"arb/#Printing","page":"Fixed precision real balls","title":"Printing","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Printing real balls can at first sight be confusing. Lets look at the following example:","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\na = RR(1)\nb = RR(2)\nc = RR(12)\n\nx = ball(a, b)\ny = ball(c, b)\n\nmid = midpoint(x)\nrad = radius(x)\n\nprint(x, \"\\n\", y, \"\\n\", mid, \"\\n\", rad)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"which generates","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"[+/- 3.01]\n[1e+1 +/- 4.01]\n1.0000000000000000000\n[2.0000000037252902985 +/- 3.81e-20]","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The first reason that c is not printed as [1 +/- 2] is that the midpoint does not have a greater exponent than the radius in its scientific notation. For similar reasons y is not printed as [12 +/- 2].","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The second reason is that we get an additional error term after our addition. As we see, radius(c) is not equal to 2, which when printed rounds it up to a reasonable decimal place. This is because real balls keep track of rounding errors of basic arithmetic.","category":"page"},{"location":"arb/#Containment","page":"Fixed precision real balls","title":"Containment","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"It is often necessary to determine whether a given exact value or ball is contained in a given real ball or whether two balls overlap. The following functions are provided for this purpose.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"overlaps(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.overlaps-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.overlaps","text":"overlaps(x::arb, y::arb)\n\nReturns true if any part of the ball x overlaps any part of the ball y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains(::arb, ::arb)","category":"page"},{"location":"arb/#Base.contains-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::arb)\n\nReturns true if the ball x contains the ball y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains(::arb, ::Integer)\ncontains(::arb, ::ZZRingElem)\ncontains(::arb, ::QQFieldElem)\ncontains{T <: Integer}(::arb, ::Rational{T})\ncontains(::arb, ::BigFloat)","category":"page"},{"location":"arb/#Base.contains-Tuple{arb, Integer}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::Integer)\n\nReturns true if the ball x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/#Base.contains-Tuple{arb, ZZRingElem}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::ZZRingElem)\n\nReturns true if the ball x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/#Base.contains-Tuple{arb, QQFieldElem}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::QQFieldElem)\n\nReturns true if the ball x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/#Base.contains-Union{Tuple{T}, Tuple{arb, Rational{T}}} where T<:Integer","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::Rational{T}) where {T <: Integer}\n\nReturns true if the ball x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/#Base.contains-Tuple{arb, BigFloat}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::BigFloat)\n\nReturns true if the ball x contains the given floating point value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The following functions are also provided for determining if a ball intersects a certain part of the real number line.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_zero(::arb)","category":"page"},{"location":"arb/#Nemo.contains_zero-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_zero","text":"contains_zero(x::arb)\n\nReturns true if the ball x contains zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_negative(::arb)","category":"page"},{"location":"arb/#Nemo.contains_negative-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_negative","text":"contains_negative(x::arb)\n\nReturns true if the ball x contains any negative value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_positive(::arb)","category":"page"},{"location":"arb/#Nemo.contains_positive-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_positive","text":"contains_positive(x::arb)\n\nReturns true if the ball x contains any positive value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_nonnegative(::arb)","category":"page"},{"location":"arb/#Nemo.contains_nonnegative-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_nonnegative","text":"contains_nonnegative(x::arb)\n\nReturns true if the ball x contains any nonnegative value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_nonpositive(::arb)","category":"page"},{"location":"arb/#Nemo.contains_nonpositive-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_nonpositive","text":"contains_nonpositive(x::arb)\n\nReturns true if the ball x contains any nonpositive value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"1 +/- 0.001\")\ny = RR(\"3\")\n\noverlaps(x, y)\ncontains(x, y)\ncontains(y, 3)\ncontains(x, ZZ(1)//2)\ncontains_zero(x)\ncontains_positive(y)","category":"page"},{"location":"arb/#Comparison","page":"Fixed precision real balls","title":"Comparison","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Nemo provides a full range of comparison operations for Arb balls. Note that a ball is considered less than another ball if every value in the first ball is less than every value in the second ball, etc.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"In addition to the standard comparison operators, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"isequal(::arb, ::arb)","category":"page"},{"location":"arb/#Base.isequal-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Base.isequal","text":"isequal(x::arb, y::arb)\n\nReturn true if the balls x and y are precisely equal, i.e. have the same midpoints and radii.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"We also provide a full range of ad hoc comparison operators. These are implemented directly in Julia, but we document them as though isless and == were provided.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Function\n==(x::arb, y::Integer)\n==(x::Integer, y::arb)\n==(x::arb, y::ZZRingElem)\n==(x::ZZRingElem, y::arb)\n==(x::arb, y::Float64)\n==(x::Float64, y::arb)\nisless(x::arb, y::Integer)\nisless(x::Integer, y::arb)\nisless(x::arb, y::ZZRingElem)\nisless(x::ZZRingElem, y::arb)\nisless(x::arb, y::Float64)\nisless(x::Float64, y::arb)\nisless(x::arb, y::BigFloat)\nisless(x::BigFloat, y::arb)\nisless(x::arb, y::QQFieldElem)\nisless(x::QQFieldElem, y::arb)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"1 +/- 0.001\")\ny = RR(\"3\")\nz = RR(\"4\")\n\nisequal(x, deepcopy(x))\nx == 3\nZZ(3) < z\nx != 1.23","category":"page"},{"location":"arb/#Absolute-value","page":"Fixed precision real balls","title":"Absolute value","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"-1 +/- 0.001\")\n\na = abs(x)","category":"page"},{"location":"arb/#Shifting","page":"Fixed precision real balls","title":"Shifting","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"-3 +/- 0.001\")\n\na = ldexp(x, 23)\nb = ldexp(x, -ZZ(15))","category":"page"},{"location":"arb/#Miscellaneous-operations","page":"Fixed precision real balls","title":"Miscellaneous operations","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"add_error!(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.add_error!-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.add_error!","text":"add_error!(x::arb, y::arb)\n\nAdds the absolute values of the midpoint and radius of y to the radius of x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"trim(::arb)","category":"page"},{"location":"arb/#Nemo.trim-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.trim","text":"trim(x::arb)\n\nReturn an arb interval containing x but which may be more economical, by rounding off insignificant bits from the midpoint.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"unique_integer(::arb)","category":"page"},{"location":"arb/#Nemo.unique_integer-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.unique_integer","text":"unique_integer(x::arb)\n\nReturn a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the interval x contains a unique integer. If this is the case, the second return value is set to this unique integer.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"setunion(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.setunion-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.setunion","text":"setunion(x::arb, y::arb)\n\nReturn an arb containing the union of the intervals represented by x and y.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"-3 +/- 0.001\")\ny = RR(\"2 +/- 0.5\")\n\na = trim(x)\nb, c = unique_integer(x)\nd = setunion(x, y)","category":"page"},{"location":"arb/#Constants","page":"Fixed precision real balls","title":"Constants","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_pi(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_pi-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_pi","text":"const_pi(r::ArbField)\n\nReturn pi = 314159ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_e(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_e-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_e","text":"const_e(r::ArbField)\n\nReturn e = 271828ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_log2(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_log2-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_log2","text":"const_log2(r::ArbField)\n\nReturn log(2) = 069314ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_log10(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_log10-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_log10","text":"const_log10(r::ArbField)\n\nReturn log(10) = 2302585ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_euler(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_euler-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_euler","text":"const_euler(r::ArbField)\n\nReturn Euler's constant gamma = 0577215ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_catalan(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_catalan-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_catalan","text":"const_catalan(r::ArbField)\n\nReturn Catalan's constant C = 0915965ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_khinchin(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_khinchin-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_khinchin","text":"const_khinchin(r::ArbField)\n\nReturn Khinchin's constant K = 2685452ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_glaisher(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_glaisher-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_glaisher","text":"const_glaisher(r::ArbField)\n\nReturn Glaisher's constant A = 1282427ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(200)\n\na = const_pi(RR)\nb = const_e(RR)\nc = const_euler(RR)\nd = const_glaisher(RR)","category":"page"},{"location":"arb/#Mathematical-and-special-functions","page":"Fixed precision real balls","title":"Mathematical and special functions","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rsqrt(::arb)","category":"page"},{"location":"arb/#Nemo.rsqrt-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.rsqrt","text":"rsqrt(x::arb)\n\nReturn the reciprocal of the square root of x, i.e. 1sqrtx.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"sqrt1pm1(::arb)","category":"page"},{"location":"arb/#Nemo.sqrt1pm1-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.sqrt1pm1","text":"sqrt1pm1(x::arb)\n\nReturn sqrt1+x-1, evaluated accurately for small x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"sqrtpos(::arb)","category":"page"},{"location":"arb/#Nemo.sqrtpos-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.sqrtpos","text":"sqrtpos(x::arb)\n\nReturn the sqrt root of x, assuming that x represents a nonnegative number. Thus any negative number in the input interval is discarded.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma(::arb)","category":"page"},{"location":"arb/#Nemo.gamma-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.gamma","text":"gamma(x::arb)\n\nReturn the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"lgamma(::arb)","category":"page"},{"location":"arb/#Nemo.lgamma-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.lgamma","text":"lgamma(x::arb)\n\nReturn the logarithm of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rgamma(::arb)","category":"page"},{"location":"arb/#Nemo.rgamma-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.rgamma","text":"rgamma(x::arb)\n\nReturn the reciprocal of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"digamma(::arb)","category":"page"},{"location":"arb/#Nemo.digamma-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.digamma","text":"digamma(x::arb)\n\nReturn the logarithmic derivative of the gamma function evaluated at x, i.e. psi(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.gamma-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.gamma","text":"gamma(s::arb, x::arb)\n\nReturn the upper incomplete gamma function Gamma(sx).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma_regularized(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.gamma_regularized-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.gamma_regularized","text":"gamma_regularized(s::arb, x::arb)\n\nReturn the regularized upper incomplete gamma function Gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma_lower(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.gamma_lower-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.gamma_lower","text":"gamma_lower(s::arb, x::arb)\n\nReturn the lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma_lower_regularized(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.gamma_lower_regularized-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.gamma_lower_regularized","text":"gamma_lower_regularized(s::arb, x::arb)\n\nReturn the regularized lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"zeta(::arb)","category":"page"},{"location":"arb/#Nemo.zeta-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.zeta","text":"zeta(x::arb)\n\nReturn the Riemann zeta function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"atan2(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.atan2-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.atan2","text":"atan2(y::arb, x::arb)\n\nReturn operatornameatan2(yx) = arg(x+yi). Same as atan(y, x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"agm(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.agm-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.agm","text":"agm(x::arb, y::arb)\n\nReturn the arithmetic-geometric mean of x and y\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"zeta(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.zeta-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.zeta","text":"zeta(s::arb, a::arb)\n\nReturn the Hurwitz zeta function zeta(sa).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"root(::arb, ::Int)","category":"page"},{"location":"arb/#AbstractAlgebra.root-Tuple{arb, Int64}","page":"Fixed precision real balls","title":"AbstractAlgebra.root","text":"root(x::arb, n::Int)\n\nReturn the n-th root of x. We require x geq 0.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"factorial(::arb)","category":"page"},{"location":"arb/#Base.factorial-Tuple{arb}","page":"Fixed precision real balls","title":"Base.factorial","text":"factorial(x::arb)\n\nReturn the factorial of x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"factorial(::Int, ::ArbField)","category":"page"},{"location":"arb/#Base.factorial-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Base.factorial","text":"factorial(n::Int, r::ArbField)\n\nReturn the factorial of n in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"binomial(::arb, ::UInt)","category":"page"},{"location":"arb/#Base.binomial-Tuple{arb, UInt64}","page":"Fixed precision real balls","title":"Base.binomial","text":"binomial(x::arb, n::UInt)\n\nReturn the binomial coefficient x choose n.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"binomial(::UInt, ::UInt, ::ArbField)","category":"page"},{"location":"arb/#Base.binomial-Tuple{UInt64, UInt64, ArbField}","page":"Fixed precision real balls","title":"Base.binomial","text":"binomial(n::UInt, k::UInt, r::ArbField)\n\nReturn the binomial coefficient n choose k in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"fibonacci(::ZZRingElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.fibonacci-Tuple{ZZRingElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.fibonacci","text":"fibonacci(n::ZZRingElem, r::ArbField)\n\nReturn the n-th Fibonacci number in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"fibonacci(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.fibonacci-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.fibonacci","text":"fibonacci(n::Int, r::ArbField)\n\nReturn the n-th Fibonacci number in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma(::ZZRingElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.gamma-Tuple{ZZRingElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.gamma","text":"gamma(x::ZZRingElem, r::ArbField)\n\nReturn the Gamma function evaluated at x in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma(::QQFieldElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.gamma-Tuple{QQFieldElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.gamma","text":"gamma(x::QQFieldElem, r::ArbField)\n\nReturn the Gamma function evaluated at x in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"zeta(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.zeta-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.zeta","text":"zeta(n::Int, r::ArbField)\n\nReturn the Riemann zeta function zeta(n) as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"bernoulli(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.bernoulli-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.bernoulli","text":"bernoulli(n::Int, r::ArbField)\n\nReturn the n-th Bernoulli number as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rising_factorial(::arb, ::Int)","category":"page"},{"location":"arb/#Nemo.rising_factorial-Tuple{arb, Int64}","page":"Fixed precision real balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::arb, n::Int)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an Arb.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rising_factorial(::QQFieldElem, ::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.rising_factorial-Tuple{QQFieldElem, Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::QQFieldElem, n::Int, r::ArbField)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rising_factorial2(::arb, ::Int)","category":"page"},{"location":"arb/#Nemo.rising_factorial2-Tuple{arb, Int64}","page":"Fixed precision real balls","title":"Nemo.rising_factorial2","text":"rising_factorial2(x::arb, n::Int)\n\nReturn a tuple containing the rising factorial x(x + 1)ldots (x + n - 1) and its derivative.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"polylog(::Union{arb,Int}, ::arb)","category":"page"},{"location":"arb/#Nemo.polylog-Tuple{Union{Int64, arb}, arb}","page":"Fixed precision real balls","title":"Nemo.polylog","text":"polylog(s::Union{arb,Int}, a::arb)\n\nReturn the polylogarithm Li_s(a).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"chebyshev_t(::Int, ::arb)","category":"page"},{"location":"arb/#AbstractAlgebra.chebyshev_t-Tuple{Int64, arb}","page":"Fixed precision real balls","title":"AbstractAlgebra.chebyshev_t","text":"chebyshev_t(n::Int, x::arb)\n\nReturn the value of the Chebyshev polynomial T_n(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"chebyshev_u(::Int, ::arb)","category":"page"},{"location":"arb/#AbstractAlgebra.chebyshev_u-Tuple{Int64, arb}","page":"Fixed precision real balls","title":"AbstractAlgebra.chebyshev_u","text":"chebyshev_u(n::Int, x::arb)\n\nReturn the value of the Chebyshev polynomial U_n(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"chebyshev_t2(::Int, ::arb)","category":"page"},{"location":"arb/#Nemo.chebyshev_t2-Tuple{Int64, arb}","page":"Fixed precision real balls","title":"Nemo.chebyshev_t2","text":"chebyshev_t2(n::Int, x::arb)\n\nReturn the tuple (T_n(x) T_n-1(x)).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"chebyshev_u2(::Int, ::arb)","category":"page"},{"location":"arb/#Nemo.chebyshev_u2-Tuple{Int64, arb}","page":"Fixed precision real balls","title":"Nemo.chebyshev_u2","text":"chebyshev_u2(n::Int, x::arb)\n\nReturn the tuple (U_n(x) U_n-1(x))\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"bell(::ZZRingElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.bell-Tuple{ZZRingElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.bell","text":"bell(n::ZZRingElem, r::ArbField)\n\nReturn the Bell number B_n as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"bell(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.bell-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.bell","text":"bell(n::Int, r::ArbField)\n\nReturn the Bell number B_n as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"numpart(::ZZRingElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.numpart-Tuple{ZZRingElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.numpart","text":"numpart(n::ZZRingElem, r::ArbField)\n\nReturn the number of partitions p(n) as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"numpart(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.numpart-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.numpart","text":"numpart(n::Int, r::ArbField)\n\nReturn the number of partitions p(n) as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"airy_ai(::arb)","category":"page"},{"location":"arb/#Nemo.airy_ai-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.airy_ai","text":"airy_ai(x::arb)\n\nReturn the Airy function operatornameAi(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"airy_ai_prime(::arb)","category":"page"},{"location":"arb/#Nemo.airy_ai_prime-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.airy_ai_prime","text":"airy_ai_prime(x::arb)\n\nReturn the derivative of the Airy function operatornameAi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"airy_bi(::arb)","category":"page"},{"location":"arb/#Nemo.airy_bi-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.airy_bi","text":"airy_bi(x::arb)\n\nReturn the Airy function operatornameBi(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"airy_bi_prime(::arb)","category":"page"},{"location":"arb/#Nemo.airy_bi_prime-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.airy_bi_prime","text":"airy_bi_prime(x::arb)\n\nReturn the derivative of the Airy function operatornameBi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\na = floor(exp(RR(1)))\nb = sinpi(QQ(5,6), RR)\nc = gamma(QQ(1,3), ArbField(256))\nd = bernoulli(1000, ArbField(53))\nf = polylog(3, RR(-10))","category":"page"},{"location":"arb/#Linear-dependence","page":"Fixed precision real balls","title":"Linear dependence","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"lindep(::Vector{arb}, n::Int)","category":"page"},{"location":"arb/#Nemo.lindep-Tuple{Vector{arb}, Int64}","page":"Fixed precision real balls","title":"Nemo.lindep","text":"lindep(A::Vector{arb}, bits::Int)\n\nFind a small linear combination of the entries of the array A that is small (using LLL). The entries are first scaled by the given number of bits before truncating to integers for use in LLL. This function can be used to find linear dependence between a list of real numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.\n\nExamples\n\njulia> RR = ArbField(64)\nReal Field with 64 bits of precision and error bounds\n\njulia> a = RR(-0.33198902958450931620250069492231652319)\n[-0.33198902958450932088 +/- 4.15e-22]\n\njulia> V = [RR(1), a, a^2, a^3, a^4, a^5]\n6-element Vector{arb}:\n 1.0000000000000000000\n [-0.33198902958450932088 +/- 4.15e-22]\n [0.11021671576446420510 +/- 7.87e-21]\n [-0.03659074051063616184 +/- 4.17e-21]\n [0.012147724433904692427 +/- 4.99e-22]\n [-0.004032911246472051677 +/- 6.25e-22]\n\njulia> W = lindep(V, 20)\n6-element Vector{ZZRingElem}:\n 1\n 3\n 0\n 0\n 0\n 1\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(128)\n\na = RR(-0.33198902958450931620250069492231652319)\n\nV = [RR(1), a, a^2, a^3, a^4, a^5]\nW = lindep(V, 20)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"simplest_rational_inside(::arb)","category":"page"},{"location":"arb/#Nemo.simplest_rational_inside-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.simplest_rational_inside","text":" simplest_rational_inside(x::arb)\n\nReturn the simplest fraction inside the ball x. A canonical fraction a_1b_1 is defined to be simpler than a_2b_2 iff b_1 b_2 or b_1 = b_2 and a_1 a_2.\n\nExamples\n\njulia> RR = ArbField(64)\nReal Field with 64 bits of precision and error bounds\n\njulia> simplest_rational_inside(const_pi(RR))\n8717442233//2774848045\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nsimplest_rational_inside(const_pi(RR))","category":"page"},{"location":"arb/#Random-generation","page":"Fixed precision real balls","title":"Random generation","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rand(::ArbField)","category":"page"},{"location":"arb/#Base.rand-Tuple{ArbField}","page":"Fixed precision real balls","title":"Base.rand","text":"rand(r::ArbField; randtype::Symbol=:urandom)\n\nReturn a random element in given Arb field.\n\nThe randtype default is :urandom which return an arb contained in 01.\n\nThe rest of the methods return non-uniformly distributed values in order to exercise corner cases. The option :randtest will return a finite number, and :randtest_exact the same but with a zero radius. The option :randtest_precise return an arb with a radius around 2^-mathrmprec the magnitude of the midpoint, while :randtest_wide return a radius that might be big relative to its midpoint. The :randtest_special-option might return a midpoint and radius whose values are NaN or inf.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(100)\n\na = rand(RR)\nb = rand(RR; randtype = :null_exact)\nc = rand(RR; randtype = :exact)\nd = rand(RR; randtype = :special)","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"polynomial/#Univariate-polynomials","page":"Univariate polynomials","title":"Univariate polynomials","text":"","category":"section"},{"location":"polynomial/#Introduction","page":"Univariate polynomials","title":"Introduction","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Nemo allow the creation of dense, univariate polynomials over any computable ring R. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of polynomials over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"The following table shows each of the polynomial types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of polynomial (the type information is mainly of concern to developers).","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.Poly{T} Generic.PolyRing{T}\nmathbbZ Flint ZZPolyRingElem ZZPolyRing\nmathbbZnmathbbZ (small n) Flint zzModPolyRingElem zzModPolyRing\nmathbbZnmathbbZ (large n) Flint ZZModPolyRingElem ZZModPolyRing\nmathbbQ Flint QQPolyRingElem QQPolyRing\nmathbbZpmathbbZ (small prime p) Flint fpPolyRingElem fpPolyRing\nmathbbZpmathbbZ (large prime p) Flint FpPolyRingElem FpPolyRing\nmathbbF_p^n (small p) Flint fqPolyRepPolyRingElem fqPolyRepPolyRing\nmathbbF_p^n (large p) Flint FqPolyRepPolyRingElem FqPolyRepPolyRing\nmathbbR (arbitrary precision) Arb RealPoly RealPolyRing\nmathbbC (arbitrary precision) Arb ComplexPoly ComplexPolyRing\nmathbbR (fixed precision) Arb arb_poly ArbPolyRing\nmathbbC (fixed precision) Arb acb_poly AcbPolyRing","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"The string representation of the variable and the base ring R of a generic polynomial is stored in its parent object. ","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"All polynomial element types belong to the abstract type PolyRingElem and all of the polynomial ring types belong to the abstract type PolyRing. This enables one to write generic functions that can accept any Nemo univariate polynomial type.","category":"page"},{"location":"polynomial/#Polynomial-functionality","page":"Univariate polynomials","title":"Polynomial functionality","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"All univariate polynomial types in Nemo provide the AbstractAlgebra univariate polynomial functionality:","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/polynomial","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Generic polynomials are also available.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"We describe here only functions that are in addition to that guaranteed by AbstractAlgebra.jl, for specific coefficient rings.","category":"page"},{"location":"polynomial/#Remove-and-valuation","page":"Univariate polynomials","title":"Remove and valuation","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"evaluate2(::RealPoly, ::RealFieldElem)","category":"page"},{"location":"polynomial/#Nemo.evaluate2-Tuple{RealPoly, RealFieldElem}","page":"Univariate polynomials","title":"Nemo.evaluate2","text":"evaluate2(x::RealPoly, y::RingElement)\n\nReturn a tuple p q consisting of the polynomial x evaluated at y and its derivative evaluated at y.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"evaluate2(::ComplexPoly, ::ComplexFieldElem)","category":"page"},{"location":"polynomial/#Nemo.evaluate2-Tuple{ComplexPoly, ComplexFieldElem}","page":"Univariate polynomials","title":"Nemo.evaluate2","text":"evaluate2(x::ComplexPoly, y::RingElement; prec::Int = precision(Balls))\n\nReturn a tuple p q consisting of the polynomial x evaluated at y and its derivative evaluated at y.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"RR = RealField(64)\nT, z = polynomial_ring(RR, \"z\")\n \nh = z^2 + 2z + 1\n\ns, t = evaluate2(h, RR(\"2.0 +/- 0.1\"))","category":"page"},{"location":"polynomial/#Signature","page":"Univariate polynomials","title":"Signature","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"signature(::ZZPolyRingElem)\nsignature(::QQPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.signature-Tuple{ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.signature","text":"signature(f::ZZPolyRingElem)\n\nReturn the signature of f, i.e. a tuple (r s) such that r is the number of real roots of f and s is half the number of complex roots.\n\nExamples\n\njulia> R, x = polynomial_ring(ZZ, \"x\");\n\njulia> signature(x^3 + 3x + 1)\n(1, 1)\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.signature-Tuple{QQPolyRingElem}","page":"Univariate polynomials","title":"Nemo.signature","text":"signature(f::QQPolyRingElem)\n\nReturn the signature of f, i.e. a tuple (r s) such that r is the number of real roots of f and s is half the number of complex roots.\n\nExamples\n\njulia> R, x = polynomial_ring(QQ, \"x\");\n\njulia> signature(x^3 + 3x + 1)\n(1, 1)\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Root-finding","page":"Univariate polynomials","title":"Root finding","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"roots(::ComplexPoly)","category":"page"},{"location":"polynomial/#AbstractAlgebra.Generic.roots-Tuple{ComplexPoly}","page":"Univariate polynomials","title":"AbstractAlgebra.Generic.roots","text":"roots(x::ComplexPoly; target=0, isolate_real=false, initial_prec=0, max_prec=0, max_iter=0)\n\nAttempts to isolate the complex roots of the complex polynomial x by iteratively refining balls in which they lie.\n\nThis is done by increasing the working precision, starting at initial_prec. The maximal number of iterations can be set using max_iter and the maximal precision can be set using max_prec.\n\nIf isolate_real is set and x is strictly real, then the real roots will be isolated from the non-real roots. Every root will have either zero, positive or negative real part.\n\nIt is assumed that x is squarefree.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"CC = ComplexField(64)\nC, y = polynomial_ring(CC, \"y\")\n\nm = y^2 + 2y + 3\nn = m + CC(\"0 +/- 0.0001\", \"0 +/- 0.0001\")\n\nr = roots(n)\n\np = y^7 - 1\n\nr = roots(n, isolate_real = true)","category":"page"},{"location":"polynomial/#Construction-from-roots","page":"Univariate polynomials","title":"Construction from roots","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"from_roots(::ArbPolyRing, ::Vector{arb})\nfrom_roots(::AcbPolyRing, ::Vector{acb})","category":"page"},{"location":"polynomial/#Nemo.from_roots-Tuple{ArbPolyRing, Vector{arb}}","page":"Univariate polynomials","title":"Nemo.from_roots","text":"from_roots(R::ArbPolyRing, b::Vector{arb})\n\nConstruct a polynomial in the given polynomial ring from a list of its roots.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.from_roots-Tuple{AcbPolyRing, Vector{acb}}","page":"Univariate polynomials","title":"Nemo.from_roots","text":"from_roots(R::AcbPolyRing, b::Vector{acb})\n\nConstruct a polynomial in the given polynomial ring from a list of its roots.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"RR = RealField(64)\nR, x = polynomial_ring(RR, \"x\")\n\nxs = arb[inv(RR(i)) for i=1:5]\nf = from_roots(R, xs)","category":"page"},{"location":"polynomial/#Bounding-absolute-values-of-roots","page":"Univariate polynomials","title":"Bounding absolute values of roots","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"roots_upper_bound(::RealPoly)\nroots_upper_bound(::ComplexPoly)","category":"page"},{"location":"polynomial/#Nemo.roots_upper_bound-Tuple{RealPoly}","page":"Univariate polynomials","title":"Nemo.roots_upper_bound","text":"roots_upper_bound(x::RealPoly) -> arb\n\nReturns an upper bound for the absolute value of all complex roots of x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.roots_upper_bound-Tuple{ComplexPoly}","page":"Univariate polynomials","title":"Nemo.roots_upper_bound","text":"roots_upper_bound(x::ComplexPoly) -> arb\n\nReturns an upper bound for the absolute value of all complex roots of x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Lifting","page":"Univariate polynomials","title":"Lifting","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"When working over a residue ring it is useful to be able to lift to the base ring of the residue ring, e.g. from mathbbZnmathbbZ to mathbbZ.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"lift(::ZZPolyRing, ::zzModPolyRingElem)\nlift(::ZZPolyRing, ::fpPolyRingElem)\nlift(::ZZPolyRing, ::ZZModPolyRingElem)\nlift(::ZZPolyRing, ::FpPolyRingElem)","category":"page"},{"location":"polynomial/#AbstractAlgebra.lift-Tuple{ZZPolyRing, zzModPolyRingElem}","page":"Univariate polynomials","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, y::zzModPolyRingElem)\n\nLift from a polynomial over mathbbZnmathbbZ to a polynomial over mathbbZ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#AbstractAlgebra.lift-Tuple{ZZPolyRing, fpPolyRingElem}","page":"Univariate polynomials","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, y::fpPolyRingElem)\n\nLift from a polynomial over mathbbZnmathbbZ to a polynomial over mathbbZ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#AbstractAlgebra.lift-Tuple{ZZPolyRing, ZZModPolyRingElem}","page":"Univariate polynomials","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, y::ZZModPolyRingElem)\n\nLift from a polynomial over mathbbZnmathbbZ to a polynomial over mathbbZ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#AbstractAlgebra.lift-Tuple{ZZPolyRing, FpPolyRingElem}","page":"Univariate polynomials","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, y::FpPolyRingElem)\n\nLift from a polynomial over mathbbZnmathbbZ to a polynomial over mathbbZ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"R = residue_ring(ZZ, 123456789012345678949)\nS, x = polynomial_ring(R, \"x\")\nT, y = polynomial_ring(ZZ, \"y\")\n\nf = x^2 + 2x + 1\n\na = lift(T, f)","category":"page"},{"location":"polynomial/#Overlapping-and-containment","page":"Univariate polynomials","title":"Overlapping and containment","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Occasionally it is useful to be able to tell when inexact polynomials overlap or contain other exact or inexact polynomials. The following functions are provided for this purpose.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"overlaps(::RealPoly, ::RealPoly)\noverlaps(::ComplexPoly, ::ComplexPoly)","category":"page"},{"location":"polynomial/#Nemo.overlaps-Tuple{RealPoly, RealPoly}","page":"Univariate polynomials","title":"Nemo.overlaps","text":"overlaps(x::RealPoly, y::RealPoly)\n\nReturn true if the coefficient balls of x overlap the coefficient balls of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.overlaps-Tuple{ComplexPoly, ComplexPoly}","page":"Univariate polynomials","title":"Nemo.overlaps","text":"overlaps(x::ComplexPoly, y::ComplexPoly)\n\nReturn true if the coefficient boxes of x overlap the coefficient boxes of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"contains(::RealPoly, ::RealPoly)\ncontains(::ComplexPoly, ::ComplexPoly)","category":"page"},{"location":"polynomial/#Base.contains-Tuple{RealPoly, RealPoly}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::RealPoly, y::RealPoly)\n\nReturn true if the coefficient balls of x contain the corresponding coefficient balls of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Base.contains-Tuple{ComplexPoly, ComplexPoly}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::ComplexPoly, y::ComplexPoly)\n\nReturn true if the coefficient boxes of x contain the corresponding coefficient boxes of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"contains(::RealPoly, ::ZZPolyRingElem)\ncontains(::RealPoly, ::QQPolyRingElem)\ncontains(::ComplexPoly, ::ZZPolyRingElem)\ncontains(::ComplexPoly, ::QQPolyRingElem)","category":"page"},{"location":"polynomial/#Base.contains-Tuple{RealPoly, ZZPolyRingElem}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::RealPoly, y::ZZPolyRingElem)\n\nReturn true if the coefficient balls of x contain the corresponding exact coefficients of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Base.contains-Tuple{RealPoly, QQPolyRingElem}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::RealPoly, y::QQPolyRingElem)\n\nReturn true if the coefficient balls of x contain the corresponding exact coefficients of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Base.contains-Tuple{ComplexPoly, ZZPolyRingElem}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::ComplexPoly, y::ZZPolyRingElem)\n\nReturn true if the coefficient boxes of x contain the corresponding exact coefficients of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Base.contains-Tuple{ComplexPoly, QQPolyRingElem}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::ComplexPoly, y::QQPolyRingElem)\n\nReturn true if the coefficient boxes of x contain the corresponding exact coefficients of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"It is sometimes also useful to be able to determine if there is a unique integer contained in the coefficient of an inexact constant polynomial.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"unique_integer(::RealPoly)\nunique_integer(::ComplexPoly)","category":"page"},{"location":"polynomial/#Nemo.unique_integer-Tuple{RealPoly}","page":"Univariate polynomials","title":"Nemo.unique_integer","text":"unique_integer(x::RealPoly)\n\nReturn a tuple (t, z) where t is true if there is a unique integer contained in each of the coefficients of x, otherwise sets t to false. In the former case, z is set to the integer polynomial.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.unique_integer-Tuple{ComplexPoly}","page":"Univariate polynomials","title":"Nemo.unique_integer","text":"unique_integer(x::ComplexPoly)\n\nReturn a tuple (t, z) where t is true if there is a unique integer contained in the (constant) polynomial x, along with that integer z in case it is, otherwise sets t to false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"RR = RealField(64)\nCC = ComplexField(64)\nR, x = polynomial_ring(RR, \"x\")\nC, y = polynomial_ring(CC, \"y\")\nZx, zx = polynomial_ring(ZZ, \"x\")\nQx, qx = polynomial_ring(QQ, \"x\")\n\nf = x^2 + 2x + 1\nh = f + RR(\"0 +/- 0.0001\")\nk = f + RR(\"0 +/- 0.0001\") * x^4\nm = y^2 + 2y + 1\nn = m + CC(\"0 +/- 0.0001\", \"0 +/- 0.0001\")\n\ncontains(h, f)\noverlaps(f, k)\ncontains(n, m)\nt, z = unique_integer(k)\nisreal(n)","category":"page"},{"location":"polynomial/#Factorisation","page":"Univariate polynomials","title":"Factorisation","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Certain polynomials can be factored (ZZPolyRingElem',zzModPolyRingElem,fpPolyRingElem,ZZModPolyRingElem,FpPolyRingElem,FqPolyRepPolyRingElem,fqPolyRepPolyRingElem`) and the interface follows the specification in AbstractAlgebra.jl. The following additional functions are available.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"factor_distinct_deg(::zzModPolyRingElem)\nfactor_distinct_deg(::fpPolyRingElem)\nfactor_distinct_deg(::ZZModPolyRingElem)\nfactor_distinct_deg(::FpPolyRingElem)\nfactor_distinct_deg(::FqPolyRepPolyRingElem)\nfactor_distinct_deg(::fqPolyRepPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{zzModPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::zzModPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{fpPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::fpPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{ZZModPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::ZZModPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{FpPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::ZZModPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{FqPolyRepPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::FqPolyRepPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{fqPolyRepPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::fqPolyRepPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"R = residue_ring(ZZ, 23)\nS, x = polynomial_ring(R, \"x\")\n\nf = x^2 + 2x + 1\ng = x^3 + 3x + 1\n\nR = factor(f*g)\nS = factor_squarefree(f*g)\nT = factor_distinct_deg((x + 1)*g*(x^5+x^3+x+1))","category":"page"},{"location":"polynomial/#Special-functions","page":"Univariate polynomials","title":"Special functions","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"cyclotomic(::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.cyclotomic-Tuple{Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.cyclotomic","text":"cyclotomic(n::Int, x::ZZPolyRingElem)\n\nReturn the nth cyclotomic polynomial, defined as Phi_n(x) = prod_omega (x-omega) where omega runs over all the nth primitive roots of unity.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"swinnerton_dyer(::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.swinnerton_dyer-Tuple{Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.swinnerton_dyer","text":"swinnerton_dyer(n::Int, x::ZZPolyRingElem)\n\nReturn the Swinnerton-Dyer polynomial S_n, defined as the integer polynomial S_n = prod (x pm sqrt2 pm sqrt3 pm sqrt5 pm ldots pm sqrtp_n) where p_n denotes the n-th prime number and all combinations of signs are taken. This polynomial has degree 2^n and is irreducible over the integers (it is the minimal polynomial of sqrt2 + ldots + sqrtp_n).\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"cos_minpoly(::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.cos_minpoly-Tuple{Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.cos_minpoly","text":"cos_minpoly(n::Int, x::ZZPolyRingElem)\n\nReturn the minimal polynomial of 2 cos(2 pi n). For suitable choice of n, this gives the minimal polynomial of 2 cos(a pi) or 2 sin(a pi) for any rational a.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"theta_qexp(::Int, ::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.theta_qexp-Tuple{Int64, Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.theta_qexp","text":"theta_qexp(e::Int, n::Int, x::ZZPolyRingElem)\n\nReturn the q-expansion to length n of the Jacobi theta function raised to the power r, i.e. vartheta(q)^r where vartheta(q) = 1 + sum_k=1^infty q^k^2.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"eta_qexp(::Int, ::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.eta_qexp-Tuple{Int64, Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.eta_qexp","text":"eta_qexp(e::Int, n::Int, x::ZZPolyRingElem)\n\nReturn the q-expansion to length n of the Dedekind eta function (without the leading factor q^124) raised to the power r, i.e. (q^-124 eta(q))^r = prod_k=1^infty (1 - q^k)^r. In particular, r = -1 gives the generating function of the partition function p(k), and r = 24 gives, after multiplication by q, the modular discriminant Delta(q) which generates the Ramanujan tau function tau(k).\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"R, x = polynomial_ring(ZZ, \"x\")\nS, y = polynomial_ring(R, \"y\")\n\nh = cyclotomic(120, x)\nj = swinnerton_dyer(5, x)\nk = cos_minpoly(30, x)\nl = theta_qexp(3, 30, x)\nm = eta_qexp(24, 30, x)\no = cyclotomic(10, 1 + x + x^2)","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"real/#Arbitrary-precision-real-balls","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Arbitrary precision real ball arithmetic is supplied by Arb which provides a ball representation which tracks error bounds rigorously. Real numbers are represented in mid-rad interval form m pm r = m-r m+r.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The types of real balls in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Library Field Element type Parent type\nArb mathbbR (balls) RealFieldElem RealField","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The real field types belong to the Field abstract type and the types of elements in this field, i.e. balls in this case, belong to the FieldElem abstract type.","category":"page"},{"location":"real/#Real-ball-functionality","page":"Arbitrary precision real balls","title":"Real ball functionality","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Real balls in Nemo provide all the field functionality described in AbstractAlgebra:","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Below, we document the additional functionality provided for real balls.","category":"page"},{"location":"real/#precision_management","page":"Arbitrary precision real balls","title":"Precision management","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Precision for ball arithmetic and creation of elements can be controlled using the functions:","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"precision(::Type{Balls})\nset_precision!(::Type{Balls}, n::Int)\nset_precision!(f::Any, ::Type{Balls}, n::Int)","category":"page"},{"location":"real/#Base.precision-Tuple{Type{Balls}}","page":"Arbitrary precision real balls","title":"Base.precision","text":"precision(::Type{Balls})\n\nReturn the precision for ball arithmetic.\n\nExamples\n\njulia> set_precision!(Balls, 200); precision(Balls)\n200\n\n\n\n\n\n","category":"method"},{"location":"real/#AbstractAlgebra.set_precision!-Tuple{Type{Balls}, Int64}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.set_precision!","text":"set_precision!(::Type{Balls}, n::Int)\n\nSet the precision for all ball arithmetic to be n.\n\nExamples\n\njulia> const_pi(RealField())\n[3.141592653589793239 +/- 5.96e-19]\n\njulia> set_precision!(Balls, 200); const_pi(RealField())\n[3.14159265358979323846264338327950288419716939937510582097494 +/- 5.73e-60]\n\n\n\n\n\n","category":"method"},{"location":"real/#AbstractAlgebra.set_precision!-Tuple{Any, Type{Balls}, Int64}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.set_precision!","text":"set_precision!(f, ::Type{Balls}, n::Int)\n\nChange ball arithmetic precision to n for the duration of f..\n\nExamples\n\njulia> set_precision!(Balls, 4) do\n const_pi(RealField())\n end\n[3e+0 +/- 0.376]\n\njulia> set_precision!(Balls, 200) do\n const_pi(RealField())\n end\n[3.1415926535897932385 +/- 3.74e-20]\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"info: Info\nThis functions are not thread-safe.","category":"page"},{"location":"real/#Constructors","page":"Arbitrary precision real balls","title":"Constructors","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"In order to construct real balls in Nemo, one must first construct the Arb real field itself. This is accomplished with the following constructor.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"RealField()","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Here is an example of creating the real field and using the resulting parent object to coerce values into the resulting field.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> a = RR(\"0.25\")\n0.25000000000000000000\n\njulia> b = RR(\"0.1 +/- 0.001\")\n[0.1 +/- 1.01e-3]\n\njulia> c = RR(0.5)\n0.50000000000000000000\n\njulia> d = RR(12)\n12.000000000000000000","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Note that whilst one can coerce double precision floating point values into an Arb real field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb field.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.","category":"page"},{"location":"real/#Real-ball-constructors","page":"Arbitrary precision real balls","title":"Real ball constructors","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Using coercion into the real field, new elements can be created.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> c = RR(1)\n1.0000000000000000000\n\njulia> d = RR(1//2)\n0.50000000000000000000","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Note that for the construction, also the precision can be supplied:","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"RR = RealField()\n\nc = RR(1, precision = 100)\nd = RR(1//2, precision = 4)","category":"page"},{"location":"real/#Conversions","page":"Arbitrary precision real balls","title":"Conversions","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> convert(Float64, RR(1//3))\n0.3333333333333333","category":"page"},{"location":"real/#Basic-manipulation","page":"Arbitrary precision real balls","title":"Basic manipulation","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_nonzero(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_nonzero-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_nonzero","text":"is_nonzero(x::RealFieldElem)\n\nReturn true if x is certainly not equal to zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"isfinite(::RealFieldElem)","category":"page"},{"location":"real/#Base.isfinite-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.isfinite","text":"isfinite(x::RealFieldElem)\n\nReturn true if x is finite, i.e. having finite midpoint and radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_exact(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_exact-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_exact","text":"is_exact(x::RealFieldElem)\n\nReturn true if x is exact, i.e. has zero radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"isinteger(::RealFieldElem)","category":"page"},{"location":"real/#Base.isinteger-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.isinteger","text":"isinteger(x::RealFieldElem)\n\nReturn true if x is an exact integer, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_positive(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_positive-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_positive","text":"is_positive(x::RealFieldElem)\n\nReturn true if x is certainly positive, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_nonnegative(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_nonnegative-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_nonnegative","text":"is_nonnegative(x::RealFieldElem)\n\nReturn true if x is certainly nonnegative, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_negative(::RealFieldElem)","category":"page"},{"location":"real/#AbstractAlgebra.is_negative-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.is_negative","text":"is_negative(x::RealFieldElem)\n\nReturn true if x is certainly negative, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_nonpositive(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_nonpositive-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_nonpositive","text":"is_nonpositive(x::RealFieldElem)\n\nReturn true if x is certainly nonpositive, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"midpoint(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.midpoint-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.midpoint","text":"midpoint(x::RealFieldElem)\n\nReturn the midpoint of the ball x as an Arb ball.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"radius(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.radius-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.radius","text":"radius(x::RealFieldElem)\n\nReturn the radius of the ball x as an Arb ball.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"accuracy_bits(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.accuracy_bits-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.accuracy_bits","text":"accuracy_bits(x::RealFieldElem)\n\nReturn the relative accuracy of x measured in bits, capped between typemax(Int) and -typemax(Int).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> a = RR(\"1.2 +/- 0.001\")\n[1.20 +/- 1.01e-3]\n\njulia> b = RR(3)\n3.0000000000000000000\n\njulia> is_positive(a)\ntrue\n\njulia> isfinite(b)\ntrue\n\njulia> isinteger(b)\ntrue\n\njulia> is_negative(a)\nfalse\n\njulia> c = radius(a)\n[0.0010000000038417056203 +/- 1.12e-23]\n\njulia> d = midpoint(b)\n3.0000000000000000000\n\njulia> f = accuracy_bits(a)\n9","category":"page"},{"location":"real/#Printing","page":"Arbitrary precision real balls","title":"Printing","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Printing real balls can at first sight be confusing. Lets look at the following example:","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"RR = RealField()\n\na = RR(1)\nb = RR(2)\nc = RR(12)\n\nx = ball(a, b)\ny = ball(c, b)\n\nmid = midpoint(x)\nrad = radius(x)\n\nprint(x, \"\\n\", y, \"\\n\", mid, \"\\n\", rad)","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"which generates","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"[+/- 3.01]\n[1e+1 +/- 4.01]\n1.0000000000000000000\n[2.0000000037252902985 +/- 3.81e-20]","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The first reason that c is not printed as [1 +/- 2] is that the midpoint does not have a greater exponent than the radius in its scientific notation. For similar reasons y is not printed as [12 +/- 2].","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The second reason is that we get an additional error term after our addition. As we see, radius(c) is not equal to 2, which when printed rounds it up to a reasonable decimal place. This is because real balls keep track of rounding errors of basic arithmetic.","category":"page"},{"location":"real/#Containment","page":"Arbitrary precision real balls","title":"Containment","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"It is often necessary to determine whether a given exact value or ball is contained in a given real ball or whether two balls overlap. The following functions are provided for this purpose.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"overlaps(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.overlaps-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.overlaps","text":"overlaps(x::RealFieldElem, y::RealFieldElem)\n\nReturns true if any part of the ball x overlaps any part of the ball y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Base.contains-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::RealFieldElem)\n\nReturns true if the ball x contains the ball y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains(::RealFieldElem, ::Integer)\ncontains(::RealFieldElem, ::ZZRingElem)\ncontains(::RealFieldElem, ::QQFieldElem)\ncontains{T <: Integer}(::RealFieldElem, ::Rational{T})\ncontains(::RealFieldElem, ::BigFloat)","category":"page"},{"location":"real/#Base.contains-Tuple{RealFieldElem, Integer}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::Integer)\n\nReturns true if the ball x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/#Base.contains-Tuple{RealFieldElem, ZZRingElem}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::ZZRingElem)\n\nReturns true if the ball x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/#Base.contains-Tuple{RealFieldElem, QQFieldElem}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::QQFieldElem)\n\nReturns true if the ball x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/#Base.contains-Union{Tuple{T}, Tuple{RealFieldElem, Rational{T}}} where T<:Integer","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::Rational{T}) where {T <: Integer}\n\nReturns true if the ball x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/#Base.contains-Tuple{RealFieldElem, BigFloat}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::BigFloat)\n\nReturns true if the ball x contains the given floating point value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The following functions are also provided for determining if a ball intersects a certain part of the real number line.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_zero(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_zero-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_zero","text":"contains_zero(x::RealFieldElem)\n\nReturns true if the ball x contains zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_negative(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_negative-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_negative","text":"contains_negative(x::RealFieldElem)\n\nReturns true if the ball x contains any negative value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_positive(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_positive-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_positive","text":"contains_positive(x::RealFieldElem)\n\nReturns true if the ball x contains any positive value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_nonnegative(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_nonnegative-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_nonnegative","text":"contains_nonnegative(x::RealFieldElem)\n\nReturns true if the ball x contains any nonnegative value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_nonpositive(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_nonpositive-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_nonpositive","text":"contains_nonpositive(x::RealFieldElem)\n\nReturns true if the ball x contains any nonpositive value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"1 +/- 0.001\")\n[1.00 +/- 1.01e-3]\n\njulia> y = RR(\"3\")\n3.0000000000000000000\n\njulia> overlaps(x, y)\nfalse\n\njulia> contains(x, y)\nfalse\n\njulia> contains(y, 3)\ntrue\n\njulia> contains(x, ZZ(1)//2)\nfalse\n\njulia> contains_zero(x)\nfalse\n\njulia> contains_positive(y)\ntrue","category":"page"},{"location":"real/#Comparison","page":"Arbitrary precision real balls","title":"Comparison","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Nemo provides a full range of comparison operations for Arb balls. Note that a ball is considered less than another ball if every value in the first ball is less than every value in the second ball, etc.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"In addition to the standard comparison operators, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"isequal(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Base.isequal-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.isequal","text":"isequal(x::RealFieldElem, y::RealFieldElem)\n\nReturn true if the balls x and y are precisely equal, i.e. have the same midpoints and radii.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"We also provide a full range of ad hoc comparison operators. These are implemented directly in Julia, but we document them as though isless and == were provided.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Function\n==(x::RealFieldElem, y::Integer)\n==(x::Integer, y::RealFieldElem)\n==(x::RealFieldElem, y::ZZRingElem)\n==(x::ZZRingElem, y::RealFieldElem)\n==(x::RealFieldElem, y::Float64)\n==(x::Float64, y::RealFieldElem)\nisless(x::RealFieldElem, y::Integer)\nisless(x::Integer, y::RealFieldElem)\nisless(x::RealFieldElem, y::ZZRingElem)\nisless(x::ZZRingElem, y::RealFieldElem)\nisless(x::RealFieldElem, y::Float64)\nisless(x::Float64, y::RealFieldElem)\nisless(x::RealFieldElem, y::BigFloat)\nisless(x::BigFloat, y::RealFieldElem)\nisless(x::RealFieldElem, y::QQFieldElem)\nisless(x::QQFieldElem, y::RealFieldElem)","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"1 +/- 0.001\")\n[1.00 +/- 1.01e-3]\n\njulia> y = RR(\"3\")\n3.0000000000000000000\n\njulia> z = RR(\"4\")\n4.0000000000000000000\n\njulia> isequal(x, deepcopy(x))\ntrue\n\njulia> x == 3\nfalse\n\njulia> ZZ(3) < z\ntrue\n\njulia> x != 1.23\ntrue","category":"page"},{"location":"real/#Absolute-value","page":"Arbitrary precision real balls","title":"Absolute value","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"-1 +/- 0.001\")\n[-1.00 +/- 1.01e-3]\n\njulia> a = abs(x)\n[1.00 +/- 1.01e-3]","category":"page"},{"location":"real/#Shifting","page":"Arbitrary precision real balls","title":"Shifting","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"-3 +/- 0.001\")\n[-3.00 +/- 1.01e-3]\n\njulia> a = ldexp(x, 23)\n[-2.52e+7 +/- 4.26e+4]\n\njulia> b = ldexp(x, -ZZ(15))\n[-9.16e-5 +/- 7.78e-8]","category":"page"},{"location":"real/#Miscellaneous-operations","page":"Arbitrary precision real balls","title":"Miscellaneous operations","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"add_error!(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.add_error!-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.add_error!","text":"add_error!(x::RealFieldElem, y::RealFieldElem)\n\nAdds the absolute values of the midpoint and radius of y to the radius of x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"trim(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.trim-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.trim","text":"trim(x::RealFieldElem)\n\nReturn an arb interval containing x but which may be more economical, by rounding off insignificant bits from the midpoint.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"unique_integer(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.unique_integer-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.unique_integer","text":"unique_integer(x::RealFieldElem)\n\nReturn a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the interval x contains a unique integer. If this is the case, the second return value is set to this unique integer.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"setunion(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.setunion-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.setunion","text":"setunion(x::RealFieldElem, y::RealFieldElem)\n\nReturn an arb containing the union of the intervals represented by x and y.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"-3 +/- 0.001\")\n[-3.00 +/- 1.01e-3]\n\njulia> y = RR(\"2 +/- 0.5\")\n[2e+0 +/- 0.501]\n\njulia> a = trim(x)\n[-3.00 +/- 1.01e-3]\n\njulia> b, c = unique_integer(x)\n(true, -3)\n\njulia> d = setunion(x, y)\n[+/- 3.01]","category":"page"},{"location":"real/#Constants","page":"Arbitrary precision real balls","title":"Constants","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_pi(::RealField)","category":"page"},{"location":"real/#Nemo.const_pi-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_pi","text":"const_pi(r::RealField)\n\nReturn pi = 314159ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_e(::RealField)","category":"page"},{"location":"real/#Nemo.const_e-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_e","text":"const_e(r::RealField)\n\nReturn e = 271828ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_log2(::RealField)","category":"page"},{"location":"real/#Nemo.const_log2-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_log2","text":"const_log2(r::RealField)\n\nReturn log(2) = 069314ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_log10(::RealField)","category":"page"},{"location":"real/#Nemo.const_log10-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_log10","text":"const_log10(r::RealField)\n\nReturn log(10) = 2302585ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_euler(::RealField)","category":"page"},{"location":"real/#Nemo.const_euler-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_euler","text":"const_euler(r::RealField)\n\nReturn Euler's constant gamma = 0577215ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_catalan(::RealField)","category":"page"},{"location":"real/#Nemo.const_catalan-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_catalan","text":"const_catalan(r::RealField)\n\nReturn Catalan's constant C = 0915965ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_khinchin(::RealField)","category":"page"},{"location":"real/#Nemo.const_khinchin-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_khinchin","text":"const_khinchin(r::RealField)\n\nReturn Khinchin's constant K = 2685452ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_glaisher(::RealField)","category":"page"},{"location":"real/#Nemo.const_glaisher-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_glaisher","text":"const_glaisher(r::RealField)\n\nReturn Glaisher's constant A = 1282427ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> a = const_pi(RR)\n[3.141592653589793239 +/- 5.96e-19]\n\njulia> b = const_e(RR)\n[2.718281828459045235 +/- 4.29e-19]\n\njulia> c = const_euler(RR)\n[0.5772156649015328606 +/- 4.35e-20]\n\njulia> d = const_glaisher(RR)\n[1.282427129100622637 +/- 3.01e-19]","category":"page"},{"location":"real/#Mathematical-and-special-functions","page":"Arbitrary precision real balls","title":"Mathematical and special functions","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rsqrt(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.rsqrt-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.rsqrt","text":"rsqrt(x::RealFieldElem)\n\nReturn the reciprocal of the square root of x, i.e. 1sqrtx.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"sqrt1pm1(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.sqrt1pm1-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.sqrt1pm1","text":"sqrt1pm1(x::RealFieldElem)\n\nReturn sqrt1+x-1, evaluated accurately for small x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"sqrtpos(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.sqrtpos-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.sqrtpos","text":"sqrtpos(x::RealFieldElem)\n\nReturn the sqrt root of x, assuming that x represents a nonnegative number. Thus any negative number in the input interval is discarded.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma","text":"gamma(x::RealFieldElem)\n\nReturn the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"lgamma(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.lgamma-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.lgamma","text":"lgamma(x::RealFieldElem)\n\nReturn the logarithm of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rgamma(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.rgamma-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.rgamma","text":"rgamma(x::RealFieldElem)\n\nReturn the reciprocal of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"digamma(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.digamma-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.digamma","text":"digamma(x::RealFieldElem)\n\nReturn the logarithmic derivative of the gamma function evaluated at x, i.e. psi(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma","text":"gamma(s::RealFieldElem, x::RealFieldElem)\n\nReturn the upper incomplete gamma function Gamma(sx).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma_regularized(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma_regularized-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma_regularized","text":"gamma_regularized(s::RealFieldElem, x::RealFieldElem)\n\nReturn the regularized upper incomplete gamma function Gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma_lower(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma_lower-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma_lower","text":"gamma_lower(s::RealFieldElem, x::RealFieldElem)\n\nReturn the lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma_lower_regularized(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma_lower_regularized-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma_lower_regularized","text":"gamma_lower_regularized(s::RealFieldElem, x::RealFieldElem)\n\nReturn the regularized lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"zeta(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.zeta-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.zeta","text":"zeta(x::RealFieldElem)\n\nReturn the Riemann zeta function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"atan2(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.atan2-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.atan2","text":"atan2(y::RealFieldElem, x::RealFieldElem)\n\nReturn operatornameatan2(yx) = arg(x+yi). Same as atan(y, x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"agm(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.agm-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.agm","text":"agm(x::RealFieldElem, y::RealFieldElem)\n\nReturn the arithmetic-geometric mean of x and y\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"zeta(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.zeta-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.zeta","text":"zeta(s::RealFieldElem, a::RealFieldElem)\n\nReturn the Hurwitz zeta function zeta(sa).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"root(::RealFieldElem, ::Int)","category":"page"},{"location":"real/#AbstractAlgebra.root-Tuple{RealFieldElem, Int64}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.root","text":"root(x::RealFieldElem, n::Int)\n\nReturn the n-th root of x. We require x geq 0.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"factorial(::RealFieldElem)","category":"page"},{"location":"real/#Base.factorial-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.factorial","text":"factorial(x::RealFieldElem)\n\nReturn the factorial of x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"factorial(::Int, ::RealField)","category":"page"},{"location":"real/#Base.factorial-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Base.factorial","text":"factorial(n::Int, r::RealField)\n\nReturn the factorial of n in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"binomial(::RealFieldElem, ::UInt)","category":"page"},{"location":"real/#Base.binomial-Tuple{RealFieldElem, UInt64}","page":"Arbitrary precision real balls","title":"Base.binomial","text":"binomial(x::RealFieldElem, n::UInt)\n\nReturn the binomial coefficient x choose n.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"binomial(::UInt, ::UInt, ::RealField)","category":"page"},{"location":"real/#Base.binomial-Tuple{UInt64, UInt64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Base.binomial","text":"binomial(n::UInt, k::UInt, r::RealField)\n\nReturn the binomial coefficient n choose k in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"fibonacci(::ZZRingElem, ::RealField)","category":"page"},{"location":"real/#Nemo.fibonacci-Tuple{ZZRingElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.fibonacci","text":"fibonacci(n::ZZRingElem, r::RealField)\n\nReturn the n-th Fibonacci number in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"fibonacci(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.fibonacci-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.fibonacci","text":"fibonacci(n::Int, r::RealField)\n\nReturn the n-th Fibonacci number in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma(::ZZRingElem, ::RealField)","category":"page"},{"location":"real/#Nemo.gamma-Tuple{ZZRingElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.gamma","text":"gamma(x::ZZRingElem, r::RealField)\n\nReturn the Gamma function evaluated at x in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma(::QQFieldElem, ::RealField)","category":"page"},{"location":"real/#Nemo.gamma-Tuple{QQFieldElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.gamma","text":"gamma(x::QQFieldElem, r::RealField)\n\nReturn the Gamma function evaluated at x in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"zeta(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.zeta-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.zeta","text":"zeta(n::Int, r::RealField)\n\nReturn the Riemann zeta function zeta(n) as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"bernoulli(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.bernoulli-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.bernoulli","text":"bernoulli(n::Int, r::RealField)\n\nReturn the n-th Bernoulli number as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rising_factorial(::RealFieldElem, ::Int)","category":"page"},{"location":"real/#Nemo.rising_factorial-Tuple{RealFieldElem, Int64}","page":"Arbitrary precision real balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::RealFieldElem, n::Int)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an Arb.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rising_factorial(::QQFieldElem, ::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.rising_factorial-Tuple{QQFieldElem, Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::QQFieldElem, n::Int, r::RealField)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rising_factorial2(::RealFieldElem, ::Int)","category":"page"},{"location":"real/#Nemo.rising_factorial2-Tuple{RealFieldElem, Int64}","page":"Arbitrary precision real balls","title":"Nemo.rising_factorial2","text":"rising_factorial2(x::RealFieldElem, n::Int)\n\nReturn a tuple containing the rising factorial x(x + 1)ldots (x + n - 1) and its derivative.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"polylog(::Union{RealFieldElem,Int}, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.polylog-Tuple{Union{Int64, RealFieldElem}, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.polylog","text":"polylog(s::Union{RealFieldElem,Int}, a::RealFieldElem)\n\nReturn the polylogarithm Li_s(a).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"chebyshev_t(::Int, ::RealFieldElem)","category":"page"},{"location":"real/#AbstractAlgebra.chebyshev_t-Tuple{Int64, RealFieldElem}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.chebyshev_t","text":"chebyshev_t(n::Int, x::RealFieldElem)\n\nReturn the value of the Chebyshev polynomial T_n(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"chebyshev_u(::Int, ::RealFieldElem)","category":"page"},{"location":"real/#AbstractAlgebra.chebyshev_u-Tuple{Int64, RealFieldElem}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.chebyshev_u","text":"chebyshev_u(n::Int, x::RealFieldElem)\n\nReturn the value of the Chebyshev polynomial U_n(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"chebyshev_t2(::Int, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.chebyshev_t2-Tuple{Int64, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.chebyshev_t2","text":"chebyshev_t2(n::Int, x::RealFieldElem)\n\nReturn the tuple (T_n(x) T_n-1(x)).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"chebyshev_u2(::Int, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.chebyshev_u2-Tuple{Int64, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.chebyshev_u2","text":"chebyshev_u2(n::Int, x::RealFieldElem)\n\nReturn the tuple (U_n(x) U_n-1(x))\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"bell(::ZZRingElem, ::RealField)","category":"page"},{"location":"real/#Nemo.bell-Tuple{ZZRingElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.bell","text":"bell(n::ZZRingElem, r::RealField)\n\nReturn the Bell number B_n as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"bell(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.bell-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.bell","text":"bell(n::Int, r::RealField)\n\nReturn the Bell number B_n as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"numpart(::ZZRingElem, ::RealField)","category":"page"},{"location":"real/#Nemo.numpart-Tuple{ZZRingElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.numpart","text":"numpart(n::ZZRingElem, r::RealField)\n\nReturn the number of partitions p(n) as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"numpart(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.numpart-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.numpart","text":"numpart(n::Int, r::RealField)\n\nReturn the number of partitions p(n) as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"airy_ai(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.airy_ai-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.airy_ai","text":"airy_ai(x::RealFieldElem)\n\nReturn the Airy function operatornameAi(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"airy_ai_prime(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.airy_ai_prime-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.airy_ai_prime","text":"airy_ai_prime(x::RealFieldElem)\n\nReturn the derivative of the Airy function operatornameAi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"airy_bi(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.airy_bi-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.airy_bi","text":"airy_bi(x::RealFieldElem)\n\nReturn the Airy function operatornameBi(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"airy_bi_prime(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.airy_bi_prime-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.airy_bi_prime","text":"airy_bi_prime(x::RealFieldElem)\n\nReturn the derivative of the Airy function operatornameBi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> a = floor(exp(RR(1)))\n2.0000000000000000000\n\njulia> b = sinpi(QQ(5,6), RR)\n0.50000000000000000000\n\njulia> c = gamma(QQ(1,3), RR)\n[2.678938534707747634 +/- 7.13e-19]\n\njulia> d = bernoulli(1000, RR)\n[-5.318704469415522036e+1769 +/- 6.61e+1750]\n\njulia> f = polylog(3, RR(-10))\n[-5.92106480375697 +/- 6.68e-15]","category":"page"},{"location":"real/#Linear-dependence","page":"Arbitrary precision real balls","title":"Linear dependence","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"lindep(::Vector{RealFieldElem}, n::Int)","category":"page"},{"location":"real/#Nemo.lindep-Tuple{Vector{RealFieldElem}, Int64}","page":"Arbitrary precision real balls","title":"Nemo.lindep","text":"lindep(A::Vector{RealFieldElem}, bits::Int)\n\nFind a small linear combination of the entries of the array A that is small (using LLL). The entries are first scaled by the given number of bits before truncating to integers for use in LLL. This function can be used to find linear dependence between a list of real numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.\n\nExamples\n\njulia> RR = RealField()\nReal field\n\njulia> a = RR(-0.33198902958450931620250069492231652319)\n[-0.33198902958450932088 +/- 4.15e-22]\n\njulia> V = [RR(1), a, a^2, a^3, a^4, a^5]\n6-element Vector{RealFieldElem}:\n 1.0000000000000000000\n [-0.33198902958450932088 +/- 4.15e-22]\n [0.11021671576446420510 +/- 7.87e-21]\n [-0.03659074051063616184 +/- 4.17e-21]\n [0.012147724433904692427 +/- 4.99e-22]\n [-0.004032911246472051677 +/- 6.25e-22]\n\njulia> W = lindep(V, 20)\n6-element Vector{ZZRingElem}:\n 1\n 3\n 0\n 0\n 0\n 1\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"simplest_rational_inside(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.simplest_rational_inside-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.simplest_rational_inside","text":" simplest_rational_inside(x::RealFieldElem)\n\nReturn the simplest fraction inside the ball x. A canonical fraction a_1b_1 is defined to be simpler than a_2b_2 iff b_1 b_2 or b_1 = b_2 and a_1 a_2.\n\nExamples\n\njulia> RR = RealField()\nReal field\n\njulia> simplest_rational_inside(const_pi(RR))\n8717442233//2774848045\n\n\n\n\n\n","category":"method"},{"location":"real/#Random-generation","page":"Arbitrary precision real balls","title":"Random generation","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rand(::RealField)","category":"page"},{"location":"real/#Base.rand-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Base.rand","text":"rand([rng=GLOBAL_RNG,] G::SymmetricGroup)\n\nReturn a random permutation from G.\n\n\n\n\n\nrand(r::RealField; randtype::Symbol=:urandom)\n\nReturn a random element in given Arb field.\n\nThe randtype default is :urandom which return an arb contained in 01.\n\nThe rest of the methods return non-uniformly distributed values in order to exercise corner cases. The option :randtest will return a finite number, and :randtest_exact the same but with a zero radius. The option :randtest_precise return an arb with a radius around 2^-mathrmprec the magnitude of the midpoint, while :randtest_wide return a radius that might be big relative to its midpoint. The :randtest_special-option might return a midpoint and radius whose values are NaN or inf.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"RR = RealField()\n\na = rand(RR)\nb = rand(RR; randtype = :null_exact)\nc = rand(RR; randtype = :exact)\nd = rand(RR; randtype = :special)","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/interfaces/#Interfaces","page":"Interfaces","title":"Interfaces","text":"","category":"section"},{"location":"developer/interfaces/#Functionality-for-Generic-and-Abstract-Types","page":"Interfaces","title":"Functionality for Generic and Abstract Types","text":"","category":"section"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"As previously mentioned, Nemo provides various generic types, e.g. Poly{T} for generic univariate polynomials and Mat{T} for generic matrices over a base ring. These and other polynomial and matrix types belong in turn to abstract types or unions thereof, e.g. PolyRingElem{T} is an abstract type representing all univariate polynomial types and MatrixElem{T} is a union of all Nemo matrix types.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"When implementing generic functionality, one should usually implement it for the abstract types and unions thereof, since the new functionality will then work for all types of the specified kind, instead of just the generic types.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"In order for this to work in practice, such implementations can only use functions in the relevant official interface. These are the functions required to be implemented by all types of that kind. For example, matrix implementations make heavy use of addeq! and mul! to accumulate entries, but they cannot make use of functions such as subeq! as it is not part of the official interface.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"In addition to implementations for abstract types and their unions, one may also like to provide specialised implementations for the generic types e.g. Poly{T} and Mat{T} as one would for other specialised types. The generic types are based on Julia arrays internally, and so it makes perfect sense to implement lower level functionality for these types specifically, as this may lead to performance gains. Such specialised implementations can make use of any functions provided for the generic types, whether in the interface or not.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"For convenience we list the most important abstract types and their unions for which one should usually prefer to write generic implementations.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"PolyRingElem{T} : all univariate polynomial types\nMPolyRingElem{T} : all multivariate polynomial types (see note below)\nMatrixElem{T} : union of all matrix types including matrix algebras\nMatElem{T} : all matrix types not including matrix algebras\nAbsPowerSeriesRingElem{T} : all abstract series types\nRelPowerSeriesRingElem{T} : all relative series types\nLaurentSeriesElem{T} : union of all Laurent series over rings and fields\nPuiseuxSeriesElem{T} : union of all Puiseux series over rings and fields\nFPModule{T} : all finitely presented modules over a Euclidean domain\nFPModuleElem{T} : all elems of fin. presented modules over a Euc. domain\nFracElem{T} : all fractions\nResElem{T} : all elements of a residue ring\nResFieldElem{T} : all elements of a residue field\nMap{D, C} : all maps (see Maps developer docs for a description)","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"N.B: inside the Generic submodule of AbstractAlgebra some abstract types Blah are only accessible by writing AbstractAlgebra.Blah. The unions are directly accessible. There may be generic types and abstract types with the same name, so this is more than just a convention.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Note that multivariate polynomials tend to require very specialised implementations depending heavily on implementation details of the specific multivariate type. Therefore it is rare to write implementations for the abstract type MPolyRingElem{T}. Instead, implementations tend to be done for each concrete multivariate type separately.","category":"page"},{"location":"developer/interfaces/#Generic-interfaces","page":"Interfaces","title":"Generic interfaces","text":"","category":"section"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"As mentioned above, the generic implementations in Nemo depend on carefully written interfaces for each of the abstract types provided by the system.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"These interfaces are spelled out in the AbstractAlgebra documentation. Note that a generic implementation may depend on functions in both the required and optional interfaces as the optional functions are all implemented with generic fallbacks in terms of the required functions.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"For convenience we provide here a list of interfaces that can be relied on in generic implementations, along with a description.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Ring : all commutative rings in the system\nField : all fields in the system\nNCRing : all rings in the system (not necessarily commutative)\nEuclidean Ring : Euclidean rings (see notes below)\nUnivariate Polynomial Ring : all dense univariate polynomials\nMultivariate Polynomial Ring : all sparse distributed multivariate polys.\nSeries Ring : all series, relative and absolute\nResidue Ring : all quotients of gcd domains with gcdx by a principal ideal\nFraction Field : all fractions over a gcd domain with gcdx\nModule : all finitely presented modules over a Euclidean domain\nMatrix : all matrices over a commutative ring\nMap : all (set) maps in the system","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Although we allow Z/nZ in our definition of Euclidean ring, much of the functionality in Nemo can be expected to misbehave (impossible inverses, etc.) when working with Euclidean rings that are not domains. In some cases the algorithms just don't exist, and in other cases we simply haven't implemented the required functionality to support all Euclidean rings for which computations can be done.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Whether a ring is a Euclidean domain or not cannot be encoded in the type. Thus there is no abstract type for Euclidean domains or their elements. Instead, generic functions rely on the existence of certain functions such as gcdx to implement functionality for Euclidean domains.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"There is also currently no way to define a Euclidean function for a given ring (which is known to be Euclidean) and have the system recognise the ring as such. This kind of Euclidean interface may be provided in a future version of Nemo.","category":"page"},{"location":"developer/interfaces/#Julia-interfaces-we-support","page":"Interfaces","title":"Julia interfaces we support","text":"","category":"section"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Many Julia interfaces rely on being able to create zero and one elements given the type only. As we use the parent/element model (see developer notes on this topic) we cannot support all Julia interfaces fully.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"We do however partially implement some Julia interfaces.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Iteration : iterators are currently provided for multivariate polynomials to iterate over the coefficients, terms and monomials. Nemo matrices can also be iterated over. Iteration proceeds down each column in turn. One can also iterate over all permutations and partitions. Finally, all finite field types can be iterated over.\nViews : because C libraries cannot be expected to implement the full range of Julia view types, views of matrices in Nemo can only be constructed for submatrices consisting of contiguous blocks in the original matrix.\nmap and similar : we implement the map and similar interfaces with the caveat that we generally use parent objects where Julia would use types. See the specific documentation for the module of interest to see details.\nzero and one : these are implemented for parent types, which is not what Julia typically expects. Exceptions include the Flint ZZRingElem and QQFieldElem types, as their parents are not parameterised, which makes it possible to implement these functions for the types as well as the parents.\nrand : we have a Nemo specific rand interface, which passes the tail of a given rand invocation to the rand function for the base ring, e.g. to create random matrix elements or polynomial coefficients and so on. In addition to this custom rand interface, we also support much of the Julia rand interface, with the usual caveat that we use parent objects instead of types where necessary.\nserialisation : unfortunately this is currently NOT implemented by Nemo, but we would certainly like to see that done in the future. It's not automatic because of the C objects that underly many of our constructions.\nNumber : Nemo number types do NOT belong to Julia's Number hierarchy, as we must make all our ring element types belong to our RingElem abstract type. To make some Julia Number types cooperate with Nemo, we define the unions RingElement and FieldElement which include some Julia types, such as BigInt and Rational{BigInt}, etc. Note that fixed precision integer types cannot be expected to be well-behaved when they overflow. We recommend using Nemo integer types if one wants good performance for small machine word sized integers, but no overflow when the integer becomes large (Nemo integers are based on Flint's multiprecision ZZRingElem type).\nhash : we implement hash functions for all major element types in Nemo.\ngetindex/setindex!/typed_hvcat : we implement these to access elements of Nemo matrices, however see the note below on row major representation. In addition, we allow creation of matrices using the notation R[a b; c d] etc. This is done by overloading typed_hvcat for the parent object R instead of a type as Julia would normally expect. This produces a Nemo matrix rather than a Julia one. Note that when passed a type, Julia's typed_hvcat can only construct Julia matrices for Nemo types such as ZZRingElem and QQFieldElem where elements can be constructed from types alone.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Many other Julia interfaces are either not yet implemented or only very partially implemented.","category":"page"},{"location":"developer/interfaces/#Column-major-vs-row-major-matrices","page":"Interfaces","title":"Column major vs row major matrices","text":"","category":"section"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Whereas Julia uses column major representation for its matrices, Nemo follows the convention of the C libraries it wraps and uses row major representation. Although Julia 2-D arrays are used internally in Nemo's generic matrix type, the interface from the perspective of the user is still the Nemo row major convention, not the Julia column major convention.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"In row major representation, some row operations may be able to be performed more cheaply than similar column operations. In column major representation the converse is true. This may mean that some Julia matrix implementations may perform more slowly if naively ported to Nemo matrices, unless suitably modified.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"residue/#Residue-rings","page":"Residue rings","title":"Residue rings","text":"","category":"section"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"Nemo allows the creation of residue rings of the form R(a) for an element a of a ring R.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"We don't require (a) to be a prime or maximal ideal. Instead, we allow the creation of the residue ring R(a) for any nonzero a and simply raise an exception if an impossible inverse is encountered during computations involving elements of R(a). Of course, a GCD function must be available for the base ring R.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"There is a generic implementation of residue rings of this form in AbstractAlgebra.jl, which accepts any ring R as base ring.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"The associated types of parent object and elements for each kind of residue rings in Nemo are given in the following table.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.ResidueRingElem{T} Generic.ResidueRing{T}\nmathbbZ (Int modulus) Flint zzModRingElem zzModRing\nmathbbZ (ZZ modulus) Flint ZZModRingElem ZZModRing","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"The modulus a of a residue ring is stored in its parent object.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"All residue element types belong to the abstract type ResElem and all the residue ring parent object types belong to the abstract type ResidueRing. This enables one to write generic functions that accept any Nemo residue type.","category":"page"},{"location":"residue/#Residue-functionality","page":"Residue rings","title":"Residue functionality","text":"","category":"section"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"All the residue rings in Nemo provide the functionality described in AbstractAlgebra for residue rings:","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/residue","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"In addition, generic residue rings are available.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"We describe Nemo specific residue ring functionality below.","category":"page"},{"location":"residue/#GCD","page":"Residue rings","title":"GCD","text":"","category":"section"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"gcdx(::zzModRingElem, ::zzModRingElem)\ngcdx(::ZZModRingElem, ::ZZModRingElem)","category":"page"},{"location":"residue/#Base.gcdx-Tuple{zzModRingElem, zzModRingElem}","page":"Residue rings","title":"Base.gcdx","text":"gcdx(a::zzModRingElem, b::zzModRingElem)\n\nCompute the extended gcd with the Euclidean structure inherited from mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"residue/#Base.gcdx-Tuple{ZZModRingElem, ZZModRingElem}","page":"Residue rings","title":"Base.gcdx","text":"gcdx(a::ZZModRingElem, b::ZZModRingElem)\n\nCompute the extended gcd with the Euclidean structure inherited from mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"Examples","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"julia> R = residue_ring(ZZ, 123456789012345678949)\nIntegers modulo 123456789012345678949\n\njulia> g, s, t = gcdx(R(123), R(456))\n(1, 123456789012345678928, 41152263004115226322)","category":"page"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"factor/#Factorisation","page":"Factorisation","title":"Factorisation","text":"","category":"section"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"Nemo provides a unified interface to handle factorisations using the Fact objects. These can only be constructed using the factor function for the respective ring elements. This is best illustrated by an example.","category":"page"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"julia> fac = factor(ZZ(-6000361807272228723606))\n-1 * 2 * 229^3 * 43669^3 * 3\n\njulia> unit(fac)\n-1\n\njulia> -6000361807272228723606 == unit(fac) * prod([ p^e for (p, e) in fac])\ntrue\n\njulia> for (p, e) in fac; println(\"$p $e\"); end\n2 1\n229 3\n43669 3\n3 1\n\njulia> 229 in fac\ntrue\n\njulia> fac[229]\n3","category":"page"},{"location":"factor/#Basic-functionality","page":"Factorisation","title":"Basic functionality","text":"","category":"section"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"Objects of type Fac are iterable, that is, if a is an object of type Fac, then for (p, e) in a will iterate through all pairs (p, e), where p is a factor and e the corresponding exponent.","category":"page"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"in(::ZZRingElem, ::Fac{ZZRingElem})\ngetindex(::Fac{ZZRingElem}, ::ZZRingElem)\nlength(::Fac{ZZRingElem})\nunit(::Fac{ZZRingElem})","category":"page"},{"location":"factor/#Base.in-Tuple{ZZRingElem, Fac{ZZRingElem}}","page":"Factorisation","title":"Base.in","text":"in(a, b::Fac)\n\nTest whether a is a factor of b.\n\n\n\n\n\n","category":"method"},{"location":"factor/#Base.getindex-Tuple{Fac{ZZRingElem}, ZZRingElem}","page":"Factorisation","title":"Base.getindex","text":"getindex(a::Fac, b) -> Int\n\nIf b is a factor of a, the corresponding exponent is returned. Otherwise an error is thrown.\n\n\n\n\n\n","category":"method"},{"location":"factor/#Base.length-Tuple{Fac{ZZRingElem}}","page":"Factorisation","title":"Base.length","text":"length(a::Fac) -> Int\n\nReturn the number of factors of a, not including the unit.\n\n\n\n\n\n","category":"method"},{"location":"factor/#AbstractAlgebra.Generic.unit-Tuple{Fac{ZZRingElem}}","page":"Factorisation","title":"AbstractAlgebra.Generic.unit","text":"unit(a::Fac{T}) -> T\n\nReturn the unit of the factorization.\n\n\n\n\n\n","category":"method"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/future/#Future-plans","page":"Future plans","title":"Future plans","text":"","category":"section"},{"location":"developer/future/#Ring-and-CommRing","page":"Future plans","title":"Ring and CommRing","text":"","category":"section"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"Currently all commutative ring types belong to Ring and their elements to RingElem (and RingElement) and we have separate types for noncommutative rings and elements thereof, i.e. NCRing and NCRingElem etc.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"However, it would be more logical to use Ring for not necessarily commutative rings and CommRing, CRing or CommutativeRing (the name has not been decided on yet) for commutative rings.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"This is a big change and should happen with plenty of warning for the community. It would be convenient if a script could be made available to automate this.","category":"page"},{"location":"developer/future/#Mono-repository","page":"Future plans","title":"Mono repository","text":"","category":"section"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"There is currently a proposal to place all Oscar related repositories, or some subset of them in a single repository called OscarMono.jl. The details are not finalised and it is not known what impact this will have on Nemo. However, Nemo developers should be aware that this may happen at some point in the fairly near future.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"Users of Nemo should be unaffected, as Nemo will continue to exist as a separate package in the OscarMono.jl repository, even if it does become part of this repository. Julia supports multiple packages in the same repository nowadays.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"The possibility will always exist to separate the repositories again if the experiment is unsuccessful or serves its purpose and is no longer needed.","category":"page"},{"location":"developer/future/#Moving-implementations-from-Hecke","page":"Future plans","title":"Moving implementations from Hecke","text":"","category":"section"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"In the Hecke.jl project there are a vast number of implementations that were intended for AbstractAlgebra.jl and Nemo.jl. They exist in the src/Misc directory of that project.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"These implementations will eventually all be moved over to the correct repositories. Code, documentation and performance improvements will be added.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"A number of things must be taken into account when making such moves:","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"Substantial chunks of code should be moved at a time. The code can be initially placed in a src/Misc directory in AbstractAlgebra or Nemo until it can finally be integrated fully into the correct place in those projects.\nSome of the code calls full parent object constructors in generic code. Such calls should be removed where possible.\nSome functions such as exp and the like require Base to be prepended, as we do not import these functions from Base into Generic.\nSome of the code calls back into convenience functions found only in Hecke. These have to be rewritten in terms of AbstractAlgebra/Nemo functions.\nSome of the code relies on ZZRingElem being available, but would otherwise be suitable for AbstractAlgebra. This code can hopefully be rewritten to be agnostic about the integer type.\nTodos, questions and so on should be moved to tickets.\nSometimes exception types differ between Hecke and Nemo, meaning that tests will fail due to the wrong type of exception being raised. Either the tests will have to be adjusted, or the Nemo exception types changed.\nRingElem is often used where RingElement is intended, etc. Also types are often unconstrained where Nemo would constrain them to RingElement.\nSome Hecke functions try to support generic types and specific concrete Nemo types in the same implementation. These will unfortunately have to either be split between AbstractAlgebra and Nemo or a completely generic implementation for abstract types will have to be made.\nSome Hecke implementations assume sub! and friends are available in generic code. These will have to be rewritten, usually by adding a single unary minus outside of a loop and switching to add! and friends inside the loops.\nTest code, docstrings and documentation will have to be added where they do not already exist.\nExports of the new functionality will have to be added.\nSome functions should be accompanied by similar functions that don't yet exist. For example if there is a blah_rows there probably should be a blah_cols function as well, etc.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"exact/#Exact-real-and-complex-numbers","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Exact real and complex numbers are provided by Calcium. Internally, a number z is represented as an element of an extension field of the rational numbers. That is,","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"z in mathbbQ(a_1ldotsa_n)","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"where a_1 ldots a_n are symbolically defined algebraic or transcendental real or complex numbers such as pi, sqrt2 or e^sqrt2 pi i. The user does not normally need to worry about the details of the internal representation; Calcium constructs extension numbers and fields automatically as needed to perform operations.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The user must create a CalciumField instance which represents the mathematical domain mathbbC. This parent object holds a cache of extension numbers and fields used to represent individual elements. It also stores various options for evaluation (documented further below).","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Library Element type Parent type\nCalcium ca CalciumField","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Please note the following:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"It is in the nature of exact complex arithmetic that some operations must be implemented using incomplete heuristics. For example, testing whether an element is zero will not always succeed. When Calcium is unable to perform a task, Nemo will throw an exception. This ensures that Calcium fields behave exactly and never silently return wrong results.\nCalcium elements can optionally hold special non-numerical values:\nUnsigned infinity hat infty\nSigned infinities (pm infty, pm i infty, and more generally e^i theta cdot infty)\nUndefined\nUnknown\nBy default, such special values are disallowed so that a CalciumField represents the mathematical field mathbbC, and any operation that would result in a special value (for example, 1 0 = hat infty) will throw an exception. To allow special values, pass extended=true to the CalciumField constructor.\nCalciumField instances only support single-threaded use. You must create a separate parent object for each thread to do parallel computation.\nWhen performing an operation involving two ca operands with different parent objects, Nemo will arbitrarily coerce the operands (and hence the result) to one of the parents.","category":"page"},{"location":"exact/#Calcium-field-options","page":"Exact real and complex numbers","title":"Calcium field options","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The CalciumField parent stores various options that affect simplification power, performance, or appearance. The user can override any of the default values using C = CalciumField(options=dict) where dict is a dictionary with Symbol => Int pairs. To retrieve the option values as a dictionary (including any default values not set by the user), call options(C).","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The following options are supported:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Option Explanation\n:verbose Enable debug output\n:print_flags Flags controlling print style\n:mpoly_ord Monomial order for polynomials\n:prec_limit Precision limit for numerical evaluation\n:qqbar_deg_limit Degree limit for algebraic numbers\n:low_prec Initial precision for numerical evaluation\n:smooth_limit Factor size limit for smooth integer factorization\n:lll_prec Precision for integer relation detection\n:pow_limit Maximum exponent for in-field powering\n:use_gb Enable Gröbner basis computation\n:gb_length_limit Maximum ideal basis length during Gröbner basis computation\n:gb_poly_length_limit Maximum polynomial length during Gröbner basis computation\n:gb_poly_bits_limit Maximum bit size during Gröbner basis computation\n:gb_vieta_limit Maximum degree to use Vieta's formulas\n:trig_form Default form of trigonometric functions","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"An important function of these options is to control how hard Calcium will try to find an answer before it gives up. For example:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Setting :prec_limit => 65536 will allow Calcium to use up to 65536 bits of precision (instead of the default 4096) to prove inequalities.\nSetting :qqbar_deg_limit => typemax(Int) (instead of the default 120) will force most calculations involving algebraic numbers to run to completion, no matter how long this will take.\nSetting :use_gb => 0 (instead of the default 1) disables use of Gröbner bases. In general, this will negatively impact Calcium's ability to simplify field elements and prove equalities, but it can speed up calculations where Gröbner bases are unnecessary.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"For a detailed explanation, refer to the following section in the Calcium documentation: https://fredrikj.net/calcium/ca.html#context-options","category":"page"},{"location":"exact/#Basic-examples","page":"Exact real and complex numbers","title":"Basic examples","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> C = CalciumField()\nExact Complex Field\n\njulia> exp(C(pi) * C(1im)) + 1\n0\n\njulia> log(C(-1))\n3.14159*I {a*b where a = 3.14159 [Pi], b = I [b^2+1=0]}\n\njulia> log(C(-1)) ^ 2\n-9.86960 {-a^2 where a = 3.14159 [Pi], b = I [b^2+1=0]}\n\njulia> log(C(10)^23) // log(C(100))\n11.5000 {23/2}\n\njulia> 4*atan(C(1)//5) - atan(C(1)//239) == C(pi)//4\ntrue\n\njulia> Cx, x = polynomial_ring(C, \"x\")\n(Univariate Polynomial Ring in x over Exact Complex Field, x)\n\njulia> (a, b) = (sqrt(C(2)), sqrt(C(3)))\n(1.41421 {a where a = 1.41421 [a^2-2=0]}, 1.73205 {a where a = 1.73205 [a^2-3=0]})\n\njulia> (x-a-b)*(x-a+b)*(x+a-b)*(x+a+b)\nx^4 + (-10)*x^2 + 1","category":"page"},{"location":"exact/#Conversions-and-numerical-evaluation","page":"Exact real and complex numbers","title":"Conversions and numerical evaluation","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Calcium numbers can created from integers (ZZ), rationals (QQ) and algebraic numbers (QQbar), and through the application of arithmetic operations and transcendental functions.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Calcium numbers can be converted to integers, rational and algebraic fields provided that the values are integer, rational or algebraic. An exception is thrown if the value does not belong to the target domain, if Calcium is unable to prove that the value belongs to the target domain, or if Calcium is unable to compute the explicit value because of evaluation limits.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> QQ(C(1))\n1\n\njulia> QQBar(sqrt(C(2)) // 2)\nRoot 0.707107 of 2x^2 - 1\n\njulia> QQ(C(pi))\nERROR: unable to convert to a rational number\n\njulia> QQ(C(10) ^ C(10^9))\nERROR: unable to convert to a rational number","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"To compute arbitrary-precision numerical enclosures, convert to ArbField or AcbField:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> CC = AcbField(64);\n\njulia> CC(exp(C(1im)))\n[0.54030230586813971740 +/- 9.37e-22] + [0.84147098480789650665 +/- 2.51e-21]*im","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The constructor","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"(R::AcbField)(a::ca; parts::Bool=false)","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"returns an enclosure of the complex number a. It attempts to obtain a relative accuracy of prec bits where prec is the precision of the target field, but it is not guaranteed that this goal is achieved.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"If parts is set to true, it attempts to achieve the target accuracy for both real and imaginary parts. This can be significantly more expensive if one part is smaller than the other, or if the number is nontrivially purely real or purely imaginary (in which case an exact proof attempt is made).","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> x = sin(C(1), form=:exponential)\n0.841471 + 0e-24*I {(-a^2*b+b)/(2*a) where a = 0.540302 + 0.841471*I [Exp(1.00000*I {b})], b = I [b^2+1=0]}\n\njulia> AcbField(64)(x)\n[0.84147098480789650665 +/- 2.51e-21] + [+/- 4.77e-29]*im\n\njulia> AcbField(64)(x, parts=true)\n[0.84147098480789650665 +/- 2.51e-21]","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The constructor","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"(R::ArbField)(a::ca; check::Bool=true)","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"returns a real enclosure. If check is set to true (default), the number a is verified to be real, and an exception is thrown if this cannot be determined. With check set to false, this function returns an enclosure of the real part of a without checking that the imaginary part is zero. This can be significantly faster.","category":"page"},{"location":"exact/#Comparisons-and-properties","page":"Exact real and complex numbers","title":"Comparisons and properties","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Except where otherwise noted, predicate functions such as iszero, ==, < and isreal act on the mathematical values of Calcium field elements. For example, although evaluating x = sqrt2 sqrt3 and y = sqrt6 results in different internal representations (x in mathbbQ(sqrt3 sqrt2) and y in mathbbQ(sqrt6)), the numbers compare as equal:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> x = sqrt(C(2)) * sqrt(C(3))\n2.44949 {a*b where a = 1.73205 [a^2-3=0], b = 1.41421 [b^2-2=0]}\n\njulia> y = sqrt(C(6))\n2.44949 {a where a = 2.44949 [a^2-6=0]}\n\njulia> x == y\ntrue\n\njulia> iszero(x - y)\ntrue\n\njulia> isinteger(x - y)\ntrue","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Predicate functions return true if the property is provably true and false if the property if provably false. If Calcium is unable to prove the truth value, an exception is thrown. For example, with default settings, Calcium is currently able to prove that e^e^-1000 ne 1, but it fails to prove e^e^-3000 ne 1:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> x = exp(exp(C(-1000)))\n1.00000 {a where a = 1.00000 [Exp(5.07596e-435 {b})], b = 5.07596e-435 [Exp(-1000)]}\n\njulia> x == 1\nfalse\n\njulia> x = exp(exp(C(-3000)))\n1.00000 {a where a = 1.00000 [Exp(1.30784e-1303 {b})], b = 1.30784e-1303 [Exp(-3000)]}\n\njulia> x == 1\nERROR: Unable to perform operation (failed deciding truth of a predicate): isequal\n...","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"In this case, we can get an answer by allowing a higher working precision:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> C2 = CalciumField(options=Dict(:prec_limit => 10^5));\n\njulia> exp(exp(C2(-3000))) == 1\nfalse","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Real numbers can be ordered and sorted the usual way. We illustrate finding square roots that are well-approximated by integers:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> sort([sqrt(C(n)) for n=0:10], by=x -> abs(x - floor(x + C(1)//2)))\n11-element Vector{ca}:\n 0\n 1\n 2\n 3\n 3.16228 {a where a = 3.16228 [a^2-10=0]}\n 2.82843 {2*a where a = 1.41421 [a^2-2=0]}\n 2.23607 {a where a = 2.23607 [a^2-5=0]}\n 1.73205 {a where a = 1.73205 [a^2-3=0]}\n 2.64575 {a where a = 2.64575 [a^2-7=0]}\n 1.41421 {a where a = 1.41421 [a^2-2=0]}\n 2.44949 {a where a = 2.44949 [a^2-6=0]}","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"As currently implemented, order comparisons involving nonreal numbers yield false (in both directions) rather than throwing an exception:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> C(1im) < C(1im)\nfalse\n\njulia> C(1im) > C(1im)\nfalse","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"This behavior may be changed or may become configurable in the future.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Interface","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"iszero(a::ca)\nisone(a::ca)\nis_algebraic(a::ca)\nis_rational(a::ca)\nisinteger(a::ca)\nisreal(a::ca)\nis_imaginary(a::ca)","category":"page"},{"location":"exact/#Base.iszero-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.iszero","text":"iszero(a::ca)\n\nReturn whether a is the number 0.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.isone-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.isone","text":"isone(a::ca)\n\nReturn whether a is the number 1.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_algebraic-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_algebraic","text":"is_algebraic(a::ca)\n\nReturn whether a is an algebraic number.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_rational-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_rational","text":"is_rational(a::ca)\n\nReturn whether a is a rational number.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.isinteger-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.isinteger","text":"isinteger(a::ca)\n\nReturn whether a is an integer.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.isreal-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.isreal","text":"isreal(a::ca)\n\nReturn whether a is a real number. This returns false if a is a pure real infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_imaginary-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_imaginary","text":"is_imaginary(a::ca)\n\nReturn whether a is an imaginary number. This returns false if a is a pure imaginary infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Infinities-and-special-values","page":"Exact real and complex numbers","title":"Infinities and special values","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"By default, CalciumField does not permit creating values that are not numbers, and any non-number value (unsigned infinity, signed infinity, Undefined) will result in an exception. This also applies to the special value Unknown, used in situations where Calcium is unable to prove that a value is a number. To enable special values, use extended=true.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> C = CalciumField()\nExact Complex Field\n\njulia> 1 // C(0)\nERROR: DomainError with UnsignedInfinity:\nNon-number result\n...\n\njulia> Cext = CalciumField(extended=true)\nExact Complex Field (Extended)\n\njulia> 1 // Cext(0)\nUnsignedInfinity","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Note that special values do not satisfy the properties of a mathematical ring or field. You will likely get meaningless results if you put infinities in matrices or polynomials.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"unsigned_infinity(C::CalciumField)\ninfinity(C::CalciumField)\ninfinity(a::ca)\nundefined(C::CalciumField)\nunknown(C::CalciumField)\nis_number(a::ca)\nis_undefined(a::ca)\nisinf(a::ca)\nis_uinf(a::ca)\nis_signed_inf(a::ca)\nis_unknown(a::ca)","category":"page"},{"location":"exact/#Nemo.unsigned_infinity-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.unsigned_infinity","text":"unsigned_infinity(C::CalciumField)\n\nReturn unsigned infinity (hat infty) as an element of C. This throws an exception if C does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.infinity-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.infinity","text":"infinity(C::CalciumField)\n\nReturn positive infinity (+infty) as an element of C. This throws an exception if C does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.infinity-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.infinity","text":"infinity(a::ca)\n\nReturn the signed infinity (a cdot infty). This throws an exception if the parent of a does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.undefined-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.undefined","text":"undefined(C::CalciumField)\n\nReturn the special value Undefined as an element of C. This throws an exception if C does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.unknown-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.unknown","text":"unknown(C::CalciumField)\n\nReturn the special meta-value Unknown as an element of C. This throws an exception if C does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_number-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_number","text":"is_number(a::ca)\n\nReturn whether a is a number, i.e. not an infinity or undefined.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_undefined-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_undefined","text":"is_undefined(a::ca)\n\nReturn whether a is the special value Undefined.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.isinf-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.isinf","text":"isinf(a::ca)\n\nReturn whether a is any infinity (signed or unsigned).\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_uinf-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_uinf","text":"is_uinf(a::ca)\n\nReturn whether a is unsigned infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_signed_inf-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_signed_inf","text":"is_signed_inf(a::ca)\n\nReturn whether a is any signed infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_unknown-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_unknown","text":"is_unknown(a::ca)\n\nReturn whether a is the special value Unknown. This is a representation property and not a mathematical predicate.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Complex-parts","page":"Exact real and complex numbers","title":"Complex parts","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Functions for computing components of real and complex numbers will perform automatic symbolic simplifications in special cases. In general, such operations will introduce new extension numbers.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> real(C(2+3im))\n2\n\njulia> sign(C(2im))\n1.00000*I {a where a = I [a^2+1=0]}\n\njulia> sign(C(2+3im))\n0.554700 + 0.832050*I {a where a = 0.554700 + 0.832050*I [13*a^4+10*a^2+13=0]}\n\njulia> angle(C(2+2im))\n0.785398 {(a)/4 where a = 3.14159 [Pi]}\n\njulia> angle(C(2+3im))\n0.982794 {a where a = 0.982794 [Arg(2.00000 + 3.00000*I {3*b+2})], b = I [b^2+1=0]}\n\njulia> angle(C(2+3im)) == atan(C(3)//2)\ntrue\n\njulia> floor(C(pi) ^ 100)\n5.18785e+49 {51878483143196131920862615246303013562686760680405}\n\njulia> ZZ(floor(C(pi) ^ 100))\n51878483143196131920862615246303013562686760680405","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Interface","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"real(a::ca)\nimag(a::ca)\nangle(a::ca)\ncsgn(a::ca)\nsign(a::ca)\nabs(a::ca)\nconj(a::ca; form::Symbol=:default)\nfloor(a::ca)\nceil(a::ca)","category":"page"},{"location":"exact/#Base.real-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.real","text":"real(a::ca)\n\nReturn the real part of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.imag-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.imag","text":"imag(a::ca)\n\nReturn the imaginary part of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.angle-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.angle","text":"angle(a::ca)\n\nReturn the complex argument of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.csgn-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.csgn","text":"csgn(a::ca)\n\nReturn the extension of the real sign function taking the value 1 strictly in the right half plane, -1 strictly in the left half plane, and the sign of the imaginary part when on the imaginary axis. Equivalently, operatornamecsgn(x) = x sqrtx^2 except that the value is 0 at zero.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.sign-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.sign","text":"sign(a::ca)\n\nReturn the complex sign of a, defined as zero if a is zero and as a a for any other complex number. This function also extracts the sign when a is a signed infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.abs-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.abs","text":"abs(a::ca)\n\nReturn the absolute value of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.conj-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.conj","text":"conj(a::ca; form::Symbol=:default)\n\nReturn the complex conjugate of a. The optional form argument allows specifying the representation. In :shallow form, overlinea is introduced as a new extension number if it no straightforward simplifications are possible. In :deep form, complex conjugation is performed recursively.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.floor-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.floor","text":"floor(a::ca)\n\nReturn the floor function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.ceil-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.ceil","text":"ceil(a::ca)\n\nReturn the ceiling function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Elementary-and-special-functions","page":"Exact real and complex numbers","title":"Elementary and special functions","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Elementary and special functions generally create new extension numbers. In special cases, simplifications occur automatically.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> exp(C(1))\n2.71828 {a where a = 2.71828 [Exp(1)]}\n\njulia> exp(C(0))\n1\n\njulia> atan(C(1))\n0.785398 {(a)/4 where a = 3.14159 [Pi]}\n\njulia> cos(C(1))^2 + sin(C(1))^2\n1\n\njulia> log(1 // exp(sqrt(C(2))+1)) == -sqrt(C(2)) - 1\ntrue\n\njulia> gamma(C(2+3im))\n-0.0823953 + 0.0917743*I {a where a = -0.0823953 + 0.0917743*I [Gamma(2.00000 + 3.00000*I {3*b+2})], b = I [b^2+1=0]}\n\njulia> gamma(C(5) // 2)\n1.32934 {(3*a)/4 where a = 1.77245 [Sqrt(3.14159 {b})], b = 3.14159 [Pi]}\n\njulia> erf(C(1))\n0.842701 {a where a = 0.842701 [Erf(1)]}\n\njulia> erf(C(1)) + erfc(C(1))\n1","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Some functions allow representing the result in different forms:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> s1 = sin(C(1))\n0.841471 - 0e-24*I {(-a^2*b+b)/(2*a) where a = 0.540302 + 0.841471*I [Exp(1.00000*I {b})], b = I [b^2+1=0]}\n\njulia> s2 = sin(C(1), form=:direct)\n0.841471 {a where a = 0.841471 [Sin(1)]}\n\njulia> s3 = sin(C(1), form=:exponential)\n0.841471 - 0e-24*I {(-a^2*b+b)/(2*a) where a = 0.540302 + 0.841471*I [Exp(1.00000*I {b})], b = I [b^2+1=0]}\n\njulia> s4 = sin(C(1), form=:tangent)\n0.841471 {(2*a)/(a^2+1) where a = 0.546302 [Tan(0.500000 {1/2})]}\n\njulia> s1 == s2 == s3 == s4\ntrue\n\njulia> isreal(s1) && isreal(s2) && isreal(s3) && isreal(s4)\ntrue","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The exponential form is currently used by default since it tends to be the most useful for symbolic simplification. The :direct and :tangent forms are likely to be better for numerical evaluation. The default behavior of trigonometric functions can be changed using the :trig_form option of CalciumField.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Proving equalities involving transcendental function values is a difficult problem in general. Calcium will sometimes fail even in elementary cases. Here is an example of two constant trigonometric identities where the first succeeds and the second fails:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> a = sqrt(C(2)) + 1;\n\njulia> cos(a) + cos(2*a) + cos(3*a) == sin(7*a//2)//(2*sin(a//2)) - C(1)//2\ntrue\n\njulia> sin(3*a) == 4 * sin(a) * sin(C(pi)//3 - a) * sin(C(pi)//3 + a)\nERROR: Unable to perform operation (failed deciding truth of a predicate): isequal","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"A possible workaround is to fall back on a numerical comparison:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> abs(cos(a) + cos(2*a) + cos(3*a) - (sin(7*a//2)//(2*sin(a//2)) - C(1)//2)) <= C(10)^-100\ntrue","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Of course, this is not a rigorous proof that the numbers are equal, and CalciumField is overkill here; it would be far more efficient to use ArbField directly to check that the numbers are approximately equal.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Interface","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"const_pi(C::CalciumField)\nconst_euler(C::CalciumField)\nonei(C::CalciumField)\nsqrt(a::ca)\nexp(a::ca)\nlog(a::ca)\npow(a::ca, b::Int; form::Symbol=:default)\nsin(a::ca; form::Symbol=:default)\ncos(a::ca; form::Symbol=:default)\ntan(a::ca; form::Symbol=:default)\natan(a::ca; form::Symbol=:default)\nasin(a::ca; form::Symbol=:default)\nacos(a::ca; form::Symbol=:default)\ngamma(a::ca)\nerf(a::ca)\nerfi(a::ca)\nerfc(a::ca)","category":"page"},{"location":"exact/#Nemo.const_pi-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.const_pi","text":"const_pi(C::CalciumField)\n\nReturn the constant pi as an element of C.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.const_euler-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.const_euler","text":"const_euler(C::CalciumField)\n\nReturn Euler's constant gamma as an element of C.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.onei-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.onei","text":"onei(C::CalciumField)\n\nReturn the imaginary unit i as an element of C.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.sqrt-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.sqrt","text":"Base.sqrt(a::ca; check::Bool=true)\n\nReturn the principal square root of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.exp-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.exp","text":"exp(a::ca)\n\nReturn the exponential function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.log-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.log","text":"log(a::ca)\n\nReturn the natural logarithm of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.pow-Tuple{ca, Int64}","page":"Exact real and complex numbers","title":"Nemo.pow","text":"pow(a::ca, b::Int; form::Symbol=:default)\n\nReturn a raised to the integer power b. The optional form argument allows specifying the representation. In :default form, this is equivalent to a ^ b, which may create a new extension number a^b if the exponent b is too large (as determined by the parent option :pow_limit or :prec_limit depending on the case). In :arithmetic form, the exponentiation is performed arithmetically in the field of a, regardless of the size of the exponent b.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.sin-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.sin","text":"sin(a::ca; form::Symbol=:default)\n\nReturn the sine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :tangent form, the value is represented using tangents. In :direct form, the value is represented directly using a sine or cosine.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.cos-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.cos","text":"cos(a::ca; form::Symbol=:default)\n\nReturn the cosine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :tangent form, the value is represented using tangents. In :direct form, the value is represented directly using a sine or cosine.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.tan-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.tan","text":"tan(a::ca; form::Symbol=:default)\n\nReturn the tangent of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :direct or :tangent form, the value is represented directly using tangents. In :sine_cosine form, the value is represented using sines or cosines.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.atan-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.atan","text":"atan(a::ca; form::Symbol=:default)\n\nReturn the inverse tangent of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct or :arctangent form, the value is represented directly using arctangents.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.asin-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.asin","text":"asin(a::ca; form::Symbol=:default)\n\nReturn the inverse sine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct form, the value is represented directly using an inverse sine or cosine.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.acos-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.acos","text":"acos(a::ca; form::Symbol=:default)\n\nReturn the inverse cosine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct form, the value is represented directly using an inverse sine or cosine.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.gamma-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.gamma","text":"gamma(a::ca)\n\nReturn the gamma function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.erf-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.erf","text":"erf(a::ca)\n\nReturn the error function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.erfi-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.erfi","text":"erfi(a::ca)\n\nReturn the imaginary error function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.erfc-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.erfc","text":"erfc(a::ca)\n\nReturn the complementary error function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Rewriting-and-simplification","page":"Exact real and complex numbers","title":"Rewriting and simplification","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"complex_normal_form(a::ca; deep::Bool=true)","category":"page"},{"location":"exact/#Nemo.complex_normal_form-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.complex_normal_form","text":"complex_normal_form(a::ca, deep::Bool=true)\n\nReturns the input rewritten using standardizing transformations over the complex numbers:\n\nElementary functions are rewritten in terms of exponentials, roots and logarithms.\nComplex parts are rewritten using logarithms, square roots, and (deep) complex conjugates.\nAlgebraic numbers are rewritten in terms of cyclotomic fields where applicable.\n\nIf deep is set, the rewriting is applied recursively to the tower of extension numbers; otherwise, the rewriting is only applied to the top-level extension numbers.\n\nThe result is not a normal form in the strong sense (the same number can have many possible representations even after applying this transformation), but this transformation can nevertheless be a useful heuristic for simplification.\n\n\n\n\n\n","category":"method"},{"location":"rational/","page":"Rationals","title":"Rationals","text":"CurrentModule = Nemo","category":"page"},{"location":"rational/#Rationals","page":"Rationals","title":"Rationals","text":"","category":"section"},{"location":"rational/","page":"Rationals","title":"Rationals","text":"Nemo provides much functionality for the rational numbers. See the section on Fraction Fields where all the basic functionality is documented, along with the extra functionality only available for the rational numbers themselves.","category":"page"},{"location":"constructors/#Constructing-mathematical-objects-in-Nemo","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"","category":"section"},{"location":"constructors/#Constructing-objects-in-Julia","page":"Constructing mathematical objects in Nemo","title":"Constructing objects in Julia","text":"","category":"section"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"In Julia, one constructs objects of a given type by calling a type constructor. This is simply a function with the same name as the type itself. For example, to construct a BigInt object in Julia, we simply call the BigInt constructor:","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"n = BigInt(\"1234567898765434567898765434567876543456787654567890\")","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Julia also uses constructors to convert between types. For example, to convert an Int to a BigInt:","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"m = BigInt(123)","category":"page"},{"location":"constructors/#How-we-construct-objects-in-Nemo","page":"Constructing mathematical objects in Nemo","title":"How we construct objects in Nemo","text":"","category":"section"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Julia types don't contain enough information to properly model groups, rings and fields, especially if they are parameterised by values. For example, the ring of integers modulo n for a multiprecision modulus n cannot be modeled using types alone.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Instead of using types to construct objects in Nemo, we use special objects that we refer to as parent objects. They behave a lot like Julia types.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Consider the following simple example, to create a Flint multiprecision integer:","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"n = ZZ(\"12345678765456787654567890987654567898765678909876567890\")","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Here ZZ is not a Julia type, but a callable object. However, for most purposes one can think of such a parent object ZZ as though it were a type.","category":"page"},{"location":"constructors/#Constructing-parent-objects","page":"Constructing mathematical objects in Nemo","title":"Constructing parent objects","text":"","category":"section"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"For more complicated groups, rings, fields, etc., one first needs to construct the parent object before one can use it to construct element objects.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Nemo provides a set of functions for constructing such parent objects. For example, to create a parent object for polynomials over the integers, we use the polynomial_ring parent object constructor.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"R, x = polynomial_ring(ZZ, \"x\")\nf = x^3 + 3x + 1\ng = R(12)","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"In this example, R is the parent object and we use it to convert the Int value 12 to an element of the polynomial ring mathbbZx.","category":"page"},{"location":"constructors/#List-of-parent-object-constructors","page":"Constructing mathematical objects in Nemo","title":"List of parent object constructors","text":"","category":"section"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"For convenience, we provide a list of all the parent object constructors in Nemo and explain what domains they represent.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Mathematics Nemo constructor\nR = mathbbZ R = ZZ\nR = mathbbQ R = QQ\nR = mathbbF_p^n R, a = FiniteField(p, n, \"a\")\nR = mathbbZnmathbbZ R = residue_ring(ZZ, n)\nS = Rx S, x = polynomial_ring(R, \"x\")\nS = Rx y S, (x, y) = polynomial_ring(R, [\"x\", \"y\"])\nS = Rx (to precision n) S, x = power_series_ring(R, n, \"x\")\nS = R((x)) (to precision n) S, x = laurent_series_ring(R, n, \"x\")\nS = mathrmFrac_R S = fraction_field(R)\nS = R(f) S = residue_ring(R, f)\nS = mathrmMat_mtimes n(R) S = matrix_space(R, m, n)\nS = mathbbQx(f) S, a = number_field(f, \"a\")\nS = mathbbQ_p (to precision N) S = PadicField(p, n)\nS = mathbbR (to precision n) S = RealField(n)\nS = mathbbC (to precision n) S = ComplexField(n)","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"matrix/#Matrices","page":"Matrices","title":"Matrices","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Nemo allow the creation of dense matrices over any computable ring R. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of matrices over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"The following table shows each of the matrix types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of matrix (the type information is mainly of concern to developers).","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.Mat{T} Generic.MatSpace{T}\nmathbbZ Flint ZZMatrix ZZMatrixSpace\nmathbbZnmathbbZ (small n) Flint zzModMatrix zzModMatrixSpace\nmathbbZnmathbbZ (large n) Flint ZZModMatrix ZZModMatrixSpace\nmathbbQ Flint QQMatrix QQMatrixSpace\nmathbbZpmathbbZ (small p) Flint fpMatrix fpMatrixSpace\nmathbbF_p^n (small p) Flint fqPolyRepMatrix fqPolyRepMatrixSpace\nmathbbF_p^n (large p) Flint FqPolyRepMatrix `FqPolyRepMatrixSpace\nmathbbR (arbitrary precision) Arb RealMat RealMatSpace\nmathbbC (arbitrary precision) Arb ComplexMat ComplexMatSpace\nmathbbR (fixed precision) Arb arb_mat ArbMatSpace\nmathbbC (fixed precision) Arb acb_mat AcbMatSpace","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"The dimensions and base ring R of a generic matrix are stored in its parent object.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"All matrix element types belong to the abstract type MatElem and all of the matrix space types belong to the abstract type MatSpace. This enables one to write generic functions that can accept any Nemo matrix type.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Note that the preferred way to create matrices is not to use the type constructors but to use the matrix function, see also the Matrix element constructors section of the AbstractAlgebra manual.","category":"page"},{"location":"matrix/#Matrix-functionality","page":"Matrices","title":"Matrix functionality","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"All matrix spaces in Nemo provide the matrix functionality of AbstractAlgebra:","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/matrix","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Some of this functionality is provided in Nemo by C libraries, such as Flint, for various specific rings.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"In the following, we list the functionality which is provided in addition to the generic matrix functionality, for specific rings in Nemo.","category":"page"},{"location":"matrix/#Comparison-operators","page":"Matrices","title":"Comparison operators","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"overlaps(::RealMat, ::RealMat)","category":"page"},{"location":"matrix/#Nemo.overlaps-Tuple{RealMat, RealMat}","page":"Matrices","title":"Nemo.overlaps","text":"overlaps(x::RealMat, y::RealMat)\n\nReturns true if all entries of x overlap with the corresponding entry of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"overlaps(::ComplexMat, ::ComplexMat)","category":"page"},{"location":"matrix/#Nemo.overlaps-Tuple{ComplexMat, ComplexMat}","page":"Matrices","title":"Nemo.overlaps","text":"overlaps(x::ComplexMat, y::ComplexMat)\n\nReturns true if all entries of x overlap with the corresponding entry of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"contains(::RealMat, ::RealMat)","category":"page"},{"location":"matrix/#Base.contains-Tuple{RealMat, RealMat}","page":"Matrices","title":"Base.contains","text":"contains(x::RealMat, y::RealMat)\n\nReturns true if all entries of x contain the corresponding entry of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"contains(::ComplexMat, ::ComplexMat)","category":"page"},{"location":"matrix/#Base.contains-Tuple{ComplexMat, ComplexMat}","page":"Matrices","title":"Base.contains","text":"contains(x::ComplexMat, y::ComplexMat)\n\nReturns true if all entries of x contain the corresponding entry of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"In addition we have the following ad hoc comparison operators.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"C = RR[1 2; 3 4]\nD = RR[\"1 +/- 0.1\" \"2 +/- 0.1\"; \"3 +/- 0.1\" \"4 +/- 0.1\"]\noverlaps(C, D)\ncontains(D, C)","category":"page"},{"location":"matrix/#Scaling","page":"Matrices","title":"Scaling","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"<<(::ZZMatrix, ::Int)","category":"page"},{"location":"matrix/#Base.:<<-Tuple{ZZMatrix, Int64}","page":"Matrices","title":"Base.:<<","text":"<<(x::ZZMatrix, y::Int)\n\nReturn 2^yx.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":">>(::ZZMatrix, ::Int)","category":"page"},{"location":"matrix/#Base.:>>-Tuple{ZZMatrix, Int64}","page":"Matrices","title":"Base.:>>","text":">>(x::ZZMatrix, y::Int)\n\nReturn x2^y where rounding is towards zero.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 9 6 3])\n\nB = A<<5\nC = B>>2","category":"page"},{"location":"matrix/#Determinant","page":"Matrices","title":"Determinant","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"det_divisor(::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.det_divisor-Tuple{ZZMatrix}","page":"Matrices","title":"Nemo.det_divisor","text":"det_divisor(x::ZZMatrix)\n\nReturn some positive divisor of the determinant of x, if the determinant is nonzero, otherwise return zero.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"det_given_divisor(::ZZMatrix, ::Integer, ::Bool)\ndet_given_divisor(::ZZMatrix, ::ZZRingElem, ::Bool)","category":"page"},{"location":"matrix/#Nemo.det_given_divisor-Tuple{ZZMatrix, Integer, Bool}","page":"Matrices","title":"Nemo.det_given_divisor","text":"det_given_divisor(x::ZZMatrix, d::Integer, proved=true)\n\nReturn the determinant of x given a positive divisor of its determinant. If proved == true (the default), the output is guaranteed to be correct, otherwise a heuristic algorithm is used.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.det_given_divisor-Tuple{ZZMatrix, ZZRingElem, Bool}","page":"Matrices","title":"Nemo.det_given_divisor","text":"det_given_divisor(x::ZZMatrix, d::ZZRingElem, proved=true)\n\nReturn the determinant of x given a positive divisor of its determinant. If proved == true (the default), the output is guaranteed to be correct, otherwise a heuristic algorithm is used.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 9 6 3])\n\nc = det_divisor(A)\nd = det_given_divisor(A, c)","category":"page"},{"location":"matrix/#Linear-solving","page":"Matrices","title":"Linear solving","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"cansolve(::ZZMatrix, ::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.cansolve-Tuple{ZZMatrix, ZZMatrix}","page":"Matrices","title":"Nemo.cansolve","text":"cansolve(a::ZZMatrix, b::ZZMatrix) -> Bool, ZZMatrix\n\nReturn true and a matrix x such that ax = b, or false and some matrix in case x does not exist.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"solve_dixon(::ZZMatrix, ::ZZMatrix)\nsolve_dixon(::QQMatrix, ::QQMatrix)","category":"page"},{"location":"matrix/#Nemo.solve_dixon-Tuple{ZZMatrix, ZZMatrix}","page":"Matrices","title":"Nemo.solve_dixon","text":"solve_dixon(a::ZZMatrix, b::ZZMatrix)\n\nReturn a tuple (x m) consisting of a column vector x such that ax = b pmodm. The element b must be a column vector with the same number > of rows as a and a must be a square matrix. If these conditions are not met or (x d) does not exist, an exception is raised.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.solve_dixon-Tuple{QQMatrix, QQMatrix}","page":"Matrices","title":"Nemo.solve_dixon","text":"solve_dixon(a::QQMatrix, b::QQMatrix)\n\nSolve ax = b by clearing denominators and using Dixon's algorithm. This is usually faster for large systems.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\nT = matrix_space(ZZ, 3, 1)\n\nA = S([ZZ(2) 3 5; 1 4 7; 9 2 2])\nB = T([ZZ(4), 5, 7])\n\nX, m = solve_dixon(A, B)","category":"page"},{"location":"matrix/#Pseudo-inverse","page":"Matrices","title":"Pseudo inverse","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"pseudo_inv(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.pseudo_inv-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.pseudo_inv","text":"pseudo_inv(x::ZZMatrix)\n\nReturn a tuple (z d) consisting of a matrix z and denominator d such that zd is the inverse of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([1 0 1; 2 3 1; 5 6 7])\n\nB, d = pseudo_inv(A)","category":"page"},{"location":"matrix/#Nullspace","page":"Matrices","title":"Nullspace","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"nullspace_right_rational(x::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.nullspace_right_rational-Tuple{ZZMatrix}","page":"Matrices","title":"Nemo.nullspace_right_rational","text":"nullspace_right_rational(x::ZZMatrix)\n\nReturn a tuple (r U) consisting of a matrix U such that the first r columns form the right rational nullspace of x, i.e. a set of vectors over mathbbZ giving a mathbbQ-basis for the nullspace of x considered as a matrix over mathbbQ.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Modular-reduction","page":"Matrices","title":"Modular reduction","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"reduce_mod(::ZZMatrix, ::Integer)\nreduce_mod(::ZZMatrix, ::ZZRingElem)","category":"page"},{"location":"matrix/#Nemo.reduce_mod-Tuple{ZZMatrix, Integer}","page":"Matrices","title":"Nemo.reduce_mod","text":"reduce_mod(x::ZZMatrix, y::Integer)\n\nReduce the entries of x modulo y and return the result.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.reduce_mod-Tuple{ZZMatrix, ZZRingElem}","page":"Matrices","title":"Nemo.reduce_mod","text":"reduce_mod(x::ZZMatrix, y::ZZRingElem)\n\nReduce the entries of x modulo y and return the result.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 9 2 2])\n\nreduce_mod(A, ZZ(5))\nreduce_mod(A, 2)","category":"page"},{"location":"matrix/#Lifting","page":"Matrices","title":"Lifting","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lift(::zzModMatrix)\nlift(::fpMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.lift-Tuple{zzModMatrix}","page":"Matrices","title":"AbstractAlgebra.lift","text":"lift(a::T) where {T <: Zmodn_mat}\n\nReturn a lift of the matrix a to a matrix over mathbbZ, i.e. where the entries of the returned matrix are those of a lifted to mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#AbstractAlgebra.lift-Tuple{fpMatrix}","page":"Matrices","title":"AbstractAlgebra.lift","text":"lift(a::fpMatrix)\n\nReturn a lift of the matrix a to a matrix over mathbbZ, i.e. where the entries of the returned matrix are those of a lifted to mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"R = residue_ring(ZZ, 7)\nS = matrix_space(R, 3, 3)\n\na = S([4 5 6; 7 3 2; 1 4 5])\n\n b = lift(a)","category":"page"},{"location":"matrix/#Special-matrices","page":"Matrices","title":"Special matrices","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hadamard(::ZZMatrixSpace)","category":"page"},{"location":"matrix/#Nemo.hadamard-Tuple{ZZMatrixSpace}","page":"Matrices","title":"Nemo.hadamard","text":"hadamard(R::ZZMatrixSpace)\n\nReturn the Hadamard matrix for the given matrix space. The number of rows and columns must be equal.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"is_hadamard(::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.is_hadamard-Tuple{ZZMatrix}","page":"Matrices","title":"Nemo.is_hadamard","text":"is_hadamard(x::ZZMatrix)\n\nReturn true if the given matrix is Hadamard, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hilbert(::QQMatrixSpace)","category":"page"},{"location":"matrix/#Nemo.hilbert-Tuple{QQMatrixSpace}","page":"Matrices","title":"Nemo.hilbert","text":"hilbert(R::QQMatrixSpace)\n\nReturn the Hilbert matrix in the given matrix space. This is the matrix with entries H_ij = 1(i + j - 1).\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"R = matrix_space(ZZ, 3, 3)\nS = matrix_space(QQ, 3, 3)\n\nA = hadamard(R)\nis_hadamard(A)\nB = hilbert(R)","category":"page"},{"location":"matrix/#Hermite-Normal-Form","page":"Matrices","title":"Hermite Normal Form","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hnf(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.hnf-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.hnf","text":"hnf(x::ZZMatrix)\n\nReturn the Hermite Normal Form of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hnf_with_transform(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.hnf_with_transform-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.hnf_with_transform","text":"hnf_with_transform(x::ZZMatrix)\n\nCompute a tuple (H T) where H is the Hermite normal form of x and T is a transformation matrix so that H = Tx.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hnf_modular(::ZZMatrix, ::ZZRingElem)","category":"page"},{"location":"matrix/#Nemo.hnf_modular-Tuple{ZZMatrix, ZZRingElem}","page":"Matrices","title":"Nemo.hnf_modular","text":"hnf_modular(x::ZZMatrix, d::ZZRingElem)\n\nCompute the Hermite normal form of x given that d is a multiple of the determinant of the nonzero rows of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hnf_modular_eldiv(::ZZMatrix, ::ZZRingElem)","category":"page"},{"location":"matrix/#Nemo.hnf_modular_eldiv-Tuple{ZZMatrix, ZZRingElem}","page":"Matrices","title":"Nemo.hnf_modular_eldiv","text":"hnf_modular_eldiv(x::ZZMatrix, d::ZZRingElem)\n\nCompute the Hermite normal form of x given that d is a multiple of the largest elementary divisor of x. The matrix x must have full rank.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"is_hnf(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.is_hnf-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.is_hnf","text":"is_hnf(x::ZZMatrix)\n\nReturn true if the given matrix is in Hermite Normal Form, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 19 3 7])\n\nB = hnf(A)\nH, T = hnf_with_transform(A)\nM = hnf_modular(A, ZZ(27))\nN = hnf_modular_eldiv(A, ZZ(27))\nis_hnf(M)","category":"page"},{"location":"matrix/#Lattice-basis-reduction","page":"Matrices","title":"Lattice basis reduction","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Nemo provides LLL lattice basis reduction. Optionally one can specify the setup using a context object created by the following function.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_ctx(delta::Float64, eta::Float64, rep=:zbasis, gram=:approx)","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Return a LLL context object specifying LLL parameters delta and eta and specifying the representation as either :zbasis or :gram and the Gram type as either :approx or :exact.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll","text":"lll(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nReturn the LLL reduction of the matrix x. By default the matrix x is a mathbbZ-basis and the Gram matrix is maintained throughout in approximate form. The LLL is performed with reduction parameters delta = 099 and eta = 051. All of these defaults can be overridden by specifying an optional context object.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_with_transform(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_with_transform-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll_with_transform","text":"lll_with_transform(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nCompute a tuple (L T) where L is the LLL reduction of a and T is a transformation matrix so that L = Ta. All the default parameters can be overridden by supplying an optional context object.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_gram(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_gram-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll_gram","text":"lll_gram(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))\n\nGiven the Gram matrix x of a matrix, compute the Gram matrix of its LLL reduction.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_gram_with_transform(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_gram_with_transform-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll_gram_with_transform","text":"lll_gram_with_transform(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))\n\nGiven the Gram matrix x of a matrix M, compute a tuple (L T) where L is the gram matrix of the LLL reduction of the matrix and T is a transformation matrix so that L = TM.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_with_removal(::ZZMatrix, ::ZZRingElem, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_with_removal-Tuple{ZZMatrix, ZZRingElem, lll_ctx}","page":"Matrices","title":"Nemo.lll_with_removal","text":"lll_with_removal(x::ZZMatrix, b::ZZRingElem, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nCompute the LLL reduction of x and throw away rows whose norm exceeds the given bound b. Return a tuple (r L) where the first r rows of L are the rows remaining after removal.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_with_removal_transform(::ZZMatrix, ::ZZRingElem, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_with_removal_transform-Tuple{ZZMatrix, ZZRingElem, lll_ctx}","page":"Matrices","title":"Nemo.lll_with_removal_transform","text":"lll_with_removal_transform(x::ZZMatrix, b::ZZRingElem, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nCompute a tuple (r L T) where the first r rows of L are those remaining from the LLL reduction after removal of vectors with norm exceeding the bound b and T is a transformation matrix so that L = Tx.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll!(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll!-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll!","text":"lll!(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nPerform the LLL reduction of the matrix x inplace. By default the matrix x is a > mathbbZ-basis and the Gram matrix is maintained throughout in approximate form. The LLL is performed with reduction parameters delta = 099 and eta = 051. All of these defaults can be overridden by specifying an optional context object.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_gram!(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_gram!-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll_gram!","text":"lll_gram!(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))\n\nGiven the Gram matrix x of a matrix, compute the Gram matrix of its LLL reduction inplace.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 19 3 7])\n\nL = lll(A, lll_ctx(0.95, 0.55, :zbasis, :approx)\nL, T = lll_with_transform(A)\n\nG == lll_gram(gram(A))\nG, T = lll_gram_with_transform(gram(A))\n\nr, L = lll_with_removal(A, ZZ(100))\nr, L, T = lll_with_removal_transform(A, ZZ(100))","category":"page"},{"location":"matrix/#Smith-Normal-Form","page":"Matrices","title":"Smith Normal Form","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"snf(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.snf-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.snf","text":"snf(x::ZZMatrix)\n\nCompute the Smith normal form of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"snf_diagonal(::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.snf_diagonal-Tuple{ZZMatrix}","page":"Matrices","title":"Nemo.snf_diagonal","text":"snf_diagonal(x::ZZMatrix)\n\nGiven a diagonal matrix x compute the Smith normal form of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"is_snf(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.is_snf-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.is_snf","text":"is_snf(x::ZZMatrix)\n\nReturn true if x is in Smith normal form, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 19 3 7])\n\nB = snf(A)\nis_snf(B) == true\n\nB = S([ZZ(2) 0 0; 0 4 0; 0 0 7])\n\nC = snf_diagonal(B)","category":"page"},{"location":"matrix/#Strong-Echelon-Form","page":"Matrices","title":"Strong Echelon Form","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"strong_echelon_form(::zzModMatrix)\nstrong_echelon_form(::fpMatrix)","category":"page"},{"location":"matrix/#Nemo.strong_echelon_form-Tuple{zzModMatrix}","page":"Matrices","title":"Nemo.strong_echelon_form","text":"strong_echelon_form(a::zzModMatrix)\n\nReturn the strong echeleon form of a. The matrix a must have at least as many rows as columns.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.strong_echelon_form-Tuple{fpMatrix}","page":"Matrices","title":"Nemo.strong_echelon_form","text":"strong_echelon_form(a::fpMatrix)\n\nReturn the strong echeleon form of a. The matrix a must have at least as many rows as columns.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"R = residue_ring(ZZ, 12)\nS = matrix_space(R, 3, 3)\n\nA = S([4 1 0; 0 0 5; 0 0 0 ])\n\nB = strong_echelon_form(A)","category":"page"},{"location":"matrix/#Howell-Form","page":"Matrices","title":"Howell Form","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"howell_form(::zzModMatrix)\nhowell_form(::fpMatrix)","category":"page"},{"location":"matrix/#Nemo.howell_form-Tuple{zzModMatrix}","page":"Matrices","title":"Nemo.howell_form","text":"howell_form(a::zzModMatrix)\n\nReturn the Howell normal form of a. The matrix a must have at least as many rows as columns.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.howell_form-Tuple{fpMatrix}","page":"Matrices","title":"Nemo.howell_form","text":"howell_form(a::fpMatrix)\n\nReturn the Howell normal form of a. The matrix a must have at least as many rows as columns.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"R = residue_ring(ZZ, 12)\nS = matrix_space(R, 3, 3)\n\nA = S([4 1 0; 0 0 5; 0 0 0 ])\n\nB = howell_form(A)","category":"page"},{"location":"matrix/#Gram-Schmidt-Orthogonalisation","page":"Matrices","title":"Gram-Schmidt Orthogonalisation","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"gram_schmidt_orthogonalisation(::QQMatrix)","category":"page"},{"location":"matrix/#Nemo.gram_schmidt_orthogonalisation-Tuple{QQMatrix}","page":"Matrices","title":"Nemo.gram_schmidt_orthogonalisation","text":"gram_schmidt_orthogonalisation(x::QQMatrix)\n\nTakes the columns of x as the generators of a subset of mathbbQ^m and returns a matrix whose columns are an orthogonal generating set for the same subspace.\n\nExamples\n\njulia> S = matrix_space(QQ, 3, 3);\n\njulia> A = S([4 7 3; 2 9 1; 0 5 3])\n[4 7 3]\n[2 9 1]\n[0 5 3]\n\njulia> B = gram_schmidt_orthogonalisation(A)\n[4 -11//5 95//123]\n[2 22//5 -190//123]\n[0 5 209//123]\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Exponential","page":"Matrices","title":"Exponential","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = RR[2 0 0; 0 3 0; 0 0 1]\n\nB = exp(A)","category":"page"},{"location":"matrix/#Norm","page":"Matrices","title":"Norm","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"bound_inf_norm(::RealMat)","category":"page"},{"location":"matrix/#Nemo.bound_inf_norm-Tuple{RealMat}","page":"Matrices","title":"Nemo.bound_inf_norm","text":"bound_inf_norm(x::RealMat)\n\nReturns a nonnegative element z of type arb, such that z is an upper bound for the infinity norm for every matrix in x\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"bound_inf_norm(::ComplexMat)","category":"page"},{"location":"matrix/#Nemo.bound_inf_norm-Tuple{ComplexMat}","page":"Matrices","title":"Nemo.bound_inf_norm","text":"bound_inf_norm(x::ComplexMat)\n\nReturns a nonnegative element z of type acb, such that z is an upper bound for the infinity norm for every matrix in x\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = RR[1 2 3; 4 5 6; 7 8 9]\n\nd = bound_inf_norm(A)","category":"page"},{"location":"matrix/#Shifting","page":"Matrices","title":"Shifting","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = RR[1 2 3; 4 5 6; 7 8 9]\n\nB = ldexp(A, 4)\n\noverlaps(16*A, B)","category":"page"},{"location":"matrix/#Predicates","page":"Matrices","title":"Predicates","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = CC[1 2 3; 4 5 6; 7 8 9]\n\nisreal(A)\n\nisreal(onei(CC)*A)","category":"page"},{"location":"matrix/#Conversion-to-Julia-matrices","page":"Matrices","title":"Conversion to Julia matrices","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Julia matrices use a different data structure than Nemo matrices. Conversion to Julia matrices is usually only required for interfacing with other packages. It isn't necessary to convert Nemo matrices to Julia matrices in order to manipulate them.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"This conversion can be performed with standard Julia syntax, such as the following, where A is an ZZMatrix:","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Matrix{Int}(A)\nMatrix{BigInt}(A)","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"In case the matrix cannot be converted without loss, an InexactError is thrown: in this case, cast to a matrix of BigInts rather than Ints.","category":"page"},{"location":"matrix/#Eigenvalues-and-Eigenvectors-(experimental)","page":"Matrices","title":"Eigenvalues and Eigenvectors (experimental)","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"eigvals(::ComplexMat)\neigvals_simple(a::ComplexMat)","category":"page"},{"location":"matrix/#LinearAlgebra.eigvals-Tuple{ComplexMat}","page":"Matrices","title":"LinearAlgebra.eigvals","text":"eigvals(A::ComplexMat)\n\nReturns the eigenvalues of A as a vector of tuples (ComplexFieldElem, Int). Each tuple (z, k) corresponds to a cluster of k eigenvalues of A.\n\nThis function is experimental.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.eigvals_simple-Tuple{ComplexMat}","page":"Matrices","title":"Nemo.eigvals_simple","text":"eigvals_simple(A::ComplexMat, algorithm::Symbol = :default)\n\nReturns the eigenvalues of A as a vector of acb. It is assumed that A has only simple eigenvalues.\n\nThe algorithm used can be changed by setting the algorithm keyword to :vdhoeven_mourrain or :rump.\n\nThis function is experimental.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = CC[1 2 3; 0 4 5; 0 0 6]\neigvals_simple(A)\nA = CC[2 2 3; 0 2 5; 0 0 2])\neigvals(A)","category":"page"},{"location":"about/#About-Nemo","page":"About Nemo","title":"About Nemo","text":"","category":"section"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Nemo is a library for fast basic arithmetic in various commonly used rings, for the Julia programming language. Our aim is to provide a highly performant package covering","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Commutative Algebra\nNumber Theory\nGroup Theory","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Nemo consists of wrappers of specialised C/C++ libraries:","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Flint http://flintlib.org/\nArb https://arblib.org/\nAntic https://github.com/wbhart/antic/\nCalcium https://fredrikj.net/calcium/","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Nemo also uses AbstractAlgebra.jl to provide generic constructions over the basic rings provided by the above packages.","category":"page"},{"location":"about/#Why-Julia?","page":"About Nemo","title":"Why Julia?","text":"","category":"section"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Julia is a sophisticated, modern programming language which is designed to be both performant and flexible. It was written by mathematicians, for mathematicians.","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"The benefits of Julia include","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Familiar imperative syntax\nJIT compilation (provides near native performance, even for highly generic code)\nREPL console (cuts down on development time)\nParametric types (allows for fast generic constructions over other data types)\nPowerful metaprogramming facilities\nOperator overloading\nMultiple dispatch (dispatch on every argument of a function)\nEfficient native C interface (little or no wrapper overhead)\nExperimental C++ interface\nDynamic type inference\nBuilt-in bignums\nAble to be embedded in C programs\nHigh performance collection types (dictionaries, iterators, arrays, etc.)\nJupyter support (for web based notebooks)","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"The main benefits for Nemo are the parametric type system and JIT compilation. The former allows us to model many mathematical types, e.g. generic polynomial rings over an arbitrary base ring. The latter speeds up the runtime performance, even of highly generic mathematical procedures.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"acb/#Fixed-precisioncomplex-balls","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Arbitrary precision complex ball arithmetic is supplied by Arb which provides a ball representation which tracks error bounds rigorously. Complex numbers are represented in rectangular form a+bi where ab are arb balls.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The Arb complex field is constructed using the AcbField constructor. This constructs the parent object for the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The types of complex boxes in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Library Field Element type Parent type\nArb mathbbC (boxes) acb AcbField","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"All the complex field types belong to the Field abstract type and the types of elements in this field, i.e. complex boxes in this case, belong to the FieldElem abstract type.","category":"page"},{"location":"acb/#Complex-ball-functionality","page":"Fixed precisioncomplex balls","title":"Complex ball functionality","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The complex balls in Nemo provide all the field functionality defined by AbstractAlgebra:.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Below, we document the additional functionality provided for complex balls.","category":"page"},{"location":"acb/#Complex-field-constructors","page":"Fixed precisioncomplex balls","title":"Complex field constructors","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"In order to construct complex boxes in Nemo, one must first construct the Arb complex field itself. This is accomplished with the following constructor.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"AcbField(prec::Int)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Return the Arb complex field with precision in bits prec used for operations on interval midpoints. The precision used for interval radii is a fixed implementation-defined constant (30 bits).","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Here is an example of creating an Arb complex field and using the resulting parent object to coerce values into the resulting field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> a = CC(\"0.25\")\n0.25000000000000000000\n\njulia> b = CC(\"0.1\")\n[0.100000000000000000 +/- 1.22e-20]\n\njulia> c = CC(0.5)\n0.50000000000000000000\n\njulia> d = CC(12)\n12.000000000000000000","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.","category":"page"},{"location":"acb/#Constructors","page":"Fixed precisioncomplex balls","title":"Constructors","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"onei(::AcbField)","category":"page"},{"location":"acb/#Nemo.onei-Tuple{AcbField}","page":"Fixed precisioncomplex balls","title":"Nemo.onei","text":"onei(r::AcbField)\n\nReturn exact one times i in the given Arb complex field.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> c = onei(CC)\n1.0000000000000000000*im","category":"page"},{"location":"acb/#Basic-functionality","page":"Fixed precisioncomplex balls","title":"Basic functionality","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The following basic functionality is provided by the default Arb complex field implementation in Nemo, to support construction of generic rings over complex fields. Any custom complex field implementation in Nemo should provide analogues of these functions along with the usual arithmetic operations.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"parent_type(::Type{acb})","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Gives the type of the parent object of an Arb complex field element.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"elem_type(R::AcbField)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Given the parent object for an Arb complex field, return the type of elements of the field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"mul!(c::acb, a::acb, b::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Multiply a by b and set the existing Arb complex field element c to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"addeq!(c::acb, a::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"In-place addition adds a to c and sets c to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"deepcopy(a::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Return a copy of the Arb complex field element a, recursively copying the internal data. Arb complex field elements are mutable in Nemo so a shallow copy is not sufficient.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Given the parent object R for an Arb complex field, the following coercion functions are provided to coerce various elements into the Arb complex field. Developers provide these by overloading the call operator for the complex field parent objects.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R()","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce zero into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(n::Integer)\nR(f::ZZRingElem)\nR(q::QQFieldElem)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce an integer or rational value into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(f::Float64)\nR(f::BigFloat)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce the given floating point number into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(f::AbstractString)\nR(f::AbstractString, g::AbstractString)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce the decimal number, given as a string, into the Arb complex field. In each case f is the real part and g is the imaginary part.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(f::arb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce the given Arb real ball into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(f::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Take an Arb complex field element that is already in an Arb field and simply return it. A copy of the original is not made.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Here are some examples of coercing elements into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> RR = ArbField(64)\nReal Field with 64 bits of precision and error bounds\n\njulia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> a = CC(3)\n3.0000000000000000000\n\njulia> b = CC(QQ(2,3))\n[0.6666666666666666666 +/- 8.48e-20]\n\njulia> c = CC(\"3 +/- 0.0001\")\n[3.000 +/- 1.01e-4]\n\njulia> d = CC(\"-1.24e+12345\")\n[-1.240000000000000000e+12345 +/- 1.16e+12326]\n\njulia> f = CC(\"nan +/- inf\")\nnan\n\njulia> g = CC(RR(3))\n3.0000000000000000000","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::AcbField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::acb) to return the parent object of a complex field element.","category":"page"},{"location":"acb/#Basic-manipulation","page":"Fixed precisioncomplex balls","title":"Basic manipulation","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"isfinite(::acb)","category":"page"},{"location":"acb/#Base.isfinite-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Base.isfinite","text":"isfinite(x::acb)\n\nReturn true if x is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"is_exact(::acb)","category":"page"},{"location":"acb/#Nemo.is_exact-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.is_exact","text":"is_exact(x::acb)\n\nReturn true if x is exact, i.e. has its real and imaginary parts have zero radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"isinteger(::acb)","category":"page"},{"location":"acb/#Base.isinteger-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Base.isinteger","text":"isinteger(x::acb)\n\nReturn true if x is an exact integer, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"accuracy_bits(::acb)","category":"page"},{"location":"acb/#Nemo.accuracy_bits-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.accuracy_bits","text":"accuracy_bits(x::acb)\n\nReturn the relative accuracy of x measured in bits, capped between typemax(Int) and -typemax(Int).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> a = CC(\"1.2 +/- 0.001\")\n[1.20 +/- 1.01e-3]\n\njulia> b = CC(3)\n3.0000000000000000000\n\njulia> isreal(a)\ntrue\n\njulia> isfinite(b)\ntrue\n\njulia> isinteger(b)\ntrue\n\njulia> c = real(a)\n[1.20 +/- 1.01e-3]\n\njulia> d = imag(b)\n0\n\njulia> f = accuracy_bits(a)\n9\n","category":"page"},{"location":"acb/#Containment","page":"Fixed precisioncomplex balls","title":"Containment","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"overlaps(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.overlaps-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.overlaps","text":"overlaps(x::acb, y::acb)\n\nReturns true if any part of the box x overlaps any part of the box y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"contains(::acb, ::acb)","category":"page"},{"location":"acb/#Base.contains-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Base.contains","text":"contains(x::acb, y::acb)\n\nReturns true if the box x contains the box y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"contains(::acb, ::Integer)\ncontains(::acb, ::ZZRingElem)\ncontains(::acb, ::QQFieldElem)","category":"page"},{"location":"acb/#Base.contains-Tuple{acb, Integer}","page":"Fixed precisioncomplex balls","title":"Base.contains","text":"contains(x::acb, y::Integer)\n\nReturns true if the box x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/#Base.contains-Tuple{acb, ZZRingElem}","page":"Fixed precisioncomplex balls","title":"Base.contains","text":"contains(x::acb, y::ZZRingElem)\n\nReturns true if the box x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/#Base.contains-Tuple{acb, QQFieldElem}","page":"Fixed precisioncomplex balls","title":"Base.contains","text":"contains(x::acb, y::QQFieldElem)\n\nReturns true if the box x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The following functions are also provided for determining if a box intersects a certain part of the complex number plane.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"contains_zero(::acb)","category":"page"},{"location":"acb/#Nemo.contains_zero-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.contains_zero","text":"contains_zero(x::acb)\n\nReturns true if the box x contains zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"1 +/- 0.001\")\n[1.00 +/- 1.01e-3]\n\njulia> y = CC(\"3\")\n3.0000000000000000000\n\njulia> overlaps(x, y)\nfalse\n\njulia> contains(x, y)\nfalse\n\njulia> contains(y, 3)\ntrue\n\njulia> contains(x, ZZ(1)//2)\nfalse\n\njulia> contains_zero(x)\nfalse","category":"page"},{"location":"acb/#Comparison","page":"Fixed precisioncomplex balls","title":"Comparison","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Nemo provides a full range of comparison operations for Arb complex boxes. ","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"isequal(::acb, ::acb)","category":"page"},{"location":"acb/#Base.isequal-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Base.isequal","text":"isequal(x::acb, y::acb)\n\nReturn true if the boxes x and y are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Function\n==(x::acb, y::Integer)\n==(x::Integer, y::acb)\n==(x::acb, y::ZZRingElem)\n==(x::ZZRingElem, y::acb)\n==(x::arb, y::ZZRingElem)\n==(x::ZZRingElem, y::arb)\n==(x::acb, y::Float64)\n==(x::Float64, y::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"1 +/- 0.001\")\n[1.00 +/- 1.01e-3]\n\njulia> y = CC(\"3\")\n3.0000000000000000000\n\njulia> z = CC(\"4\")\n4.0000000000000000000\n\njulia> isequal(x, deepcopy(x))\ntrue\n\njulia> x == 3\nfalse\n\njulia> ZZ(3) == z\nfalse\n\njulia> x != 1.23\ntrue","category":"page"},{"location":"acb/#Absolute-value","page":"Fixed precisioncomplex balls","title":"Absolute value","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"-1 +/- 0.001\")\n[-1.00 +/- 1.01e-3]\n\njulia> a = abs(x)\n[1.00 +/- 1.01e-3]","category":"page"},{"location":"acb/#Shifting","page":"Fixed precisioncomplex balls","title":"Shifting","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"-3 +/- 0.001\")\n[-3.00 +/- 1.01e-3]\n\njulia> a = ldexp(x, 23)\n[-2.52e+7 +/- 4.26e+4]\n\njulia> b = ldexp(x, -ZZ(15))\n[-9.16e-5 +/- 7.78e-8]","category":"page"},{"location":"acb/#Miscellaneous-operations","page":"Fixed precisioncomplex balls","title":"Miscellaneous operations","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"trim(::acb)","category":"page"},{"location":"acb/#Nemo.trim-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.trim","text":"trim(x::acb)\n\nReturn an acb box containing x but which may be more economical, by rounding off insignificant bits from midpoints.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"unique_integer(::acb)","category":"page"},{"location":"acb/#Nemo.unique_integer-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.unique_integer","text":"unique_integer(x::acb)\n\nReturn a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box x contains a unique integer. If this is the case, the second return value is set to this unique integer.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"-3 +/- 0.001\", \"0.1\")\n[-3.00 +/- 1.01e-3] + [0.100000000000000000 +/- 1.22e-20]*im\n\njulia> a = trim(x)\n[-3.00 +/- 1.01e-3] + [0.100000000000000000 +/- 1.22e-20]*im\n\njulia> b, c = unique_integer(x)\n(false, 0)\n\njulia> d = conj(x)\n[-3.00 +/- 1.01e-3] + [-0.100000000000000000 +/- 1.22e-20]*im\n\njulia> f = angle(x)\n[3.1083 +/- 3.95e-5]","category":"page"},{"location":"acb/#Constants","page":"Fixed precisioncomplex balls","title":"Constants","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"const_pi(::AcbField)","category":"page"},{"location":"acb/#Nemo.const_pi-Tuple{AcbField}","page":"Fixed precisioncomplex balls","title":"Nemo.const_pi","text":"const_pi(r::AcbField)\n\nReturn pi = 314159ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(200)\nComplex Field with 200 bits of precision and error bounds\n\njulia> a = const_pi(CC)\n[3.14159265358979323846264338327950288419716939937510582097494 +/- 5.73e-60]","category":"page"},{"location":"acb/#Mathematical-and-special-functions","page":"Fixed precisioncomplex balls","title":"Mathematical and special functions","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"rsqrt(::acb)","category":"page"},{"location":"acb/#Nemo.rsqrt-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.rsqrt","text":"rsqrt(x::acb)\n\nReturn the reciprocal of the square root of x, i.e. 1sqrtx.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"cispi(::acb)","category":"page"},{"location":"acb/#Base.cispi-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Base.cispi","text":"cispi(x::acb)\n\nReturn the exponential of pi i x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"root_of_unity(::AcbField, k::Int)","category":"page"},{"location":"acb/#Nemo.root_of_unity-Tuple{AcbField, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.root_of_unity","text":"root_of_unity(C::AcbField, k::Int)\n\nReturn exp(2pi ik).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"log_sinpi(::acb)","category":"page"},{"location":"acb/#Nemo.log_sinpi-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.log_sinpi","text":"log_sinpi(x::acb)\n\nReturn logsin(pi x), constructed without branch cuts off the real line.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma(::acb)","category":"page"},{"location":"acb/#Nemo.gamma-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma","text":"gamma(x::acb)\n\nReturn the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"lgamma(::acb)","category":"page"},{"location":"acb/#Nemo.lgamma-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.lgamma","text":"lgamma(x::acb)\n\nReturn the logarithm of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"rgamma(::acb)","category":"page"},{"location":"acb/#Nemo.rgamma-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.rgamma","text":"rgamma(x::acb)\n\nReturn the reciprocal of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"digamma(::acb)","category":"page"},{"location":"acb/#Nemo.digamma-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.digamma","text":"digamma(x::acb)\n\nReturn the logarithmic derivative of the gamma function evaluated at x, i.e. psi(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"zeta(::acb)","category":"page"},{"location":"acb/#Nemo.zeta-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.zeta","text":"zeta(x::acb)\n\nReturn the Riemann zeta function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"barnes_g(::acb)","category":"page"},{"location":"acb/#Nemo.barnes_g-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.barnes_g","text":"barnes_g(x::acb)\n\nReturn the Barnes G-function, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"log_barnes_g(::acb)","category":"page"},{"location":"acb/#Nemo.log_barnes_g-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.log_barnes_g","text":"log_barnes_g(x::acb)\n\nReturn the logarithm of the Barnes G-function, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"erf(::acb)","category":"page"},{"location":"acb/#Nemo.erf-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.erf","text":"erf(x::acb)\n\nReturn the error function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"erfi(::acb)","category":"page"},{"location":"acb/#Nemo.erfi-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.erfi","text":"erfi(x::acb)\n\nReturn the imaginary error function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"exp_integral_ei(::acb)","category":"page"},{"location":"acb/#Nemo.exp_integral_ei-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.exp_integral_ei","text":"exp_integral_ei(x::acb)\n\nReturn the exponential integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"sin_integral(::acb)","category":"page"},{"location":"acb/#Nemo.sin_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.sin_integral","text":"sin_integral(x::acb)\n\nReturn the sine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"cos_integral(::acb)","category":"page"},{"location":"acb/#Nemo.cos_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.cos_integral","text":"cos_integral(x::acb)\n\nReturn the exponential cosine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"sinh_integral(::acb)","category":"page"},{"location":"acb/#Nemo.sinh_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.sinh_integral","text":"sinh_integral(x::acb)\n\nReturn the hyperbolic sine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"cosh_integral(::acb)","category":"page"},{"location":"acb/#Nemo.cosh_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.cosh_integral","text":"cosh_integral(x::acb)\n\nReturn the hyperbolic cosine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"dedekind_eta(::acb)","category":"page"},{"location":"acb/#Nemo.dedekind_eta-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.dedekind_eta","text":"dedekind_eta(x::acb)\n\nReturn the Dedekind eta function eta(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_weber_f(::acb)","category":"page"},{"location":"acb/#Nemo.modular_weber_f-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_weber_f","text":"modular_weber_f(x::acb)\n\nReturn the modular Weber function mathfrakf(tau) = fraceta^2(tau)eta(tau2)eta(2tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_weber_f1(::acb)","category":"page"},{"location":"acb/#Nemo.modular_weber_f1-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_weber_f1","text":"modular_weber_f1(x::acb)\n\nReturn the modular Weber function mathfrakf_1(tau) = fraceta(tau2)eta(tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_weber_f2(::acb)","category":"page"},{"location":"acb/#Nemo.modular_weber_f2-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_weber_f2","text":"modular_weber_f2(x::acb)\n\nReturn the modular Weber function mathfrakf_2(tau) = fracsqrt2eta(2tau)eta(tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"j_invariant(::acb)","category":"page"},{"location":"acb/#Nemo.j_invariant-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.j_invariant","text":"j_invariant(x::acb)\n\nReturn the j-invariant j(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_lambda(::acb)","category":"page"},{"location":"acb/#Nemo.modular_lambda-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_lambda","text":"modular_lambda(x::acb)\n\nReturn the modular lambda function lambda(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_delta(::acb)","category":"page"},{"location":"acb/#Nemo.modular_delta-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_delta","text":"modular_delta(x::acb)\n\nReturn the modular delta function Delta(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"eisenstein_g(::Int, ::acb)","category":"page"},{"location":"acb/#Nemo.eisenstein_g-Tuple{Int64, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.eisenstein_g","text":"eisenstein_g(k::Int, x::acb)\n\nReturn the non-normalized Eisenstein series G_k(tau) of mathrmSL_2(mathbbZ). Also defined for tau = i infty.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"elliptic_k(::acb)","category":"page"},{"location":"acb/#Nemo.elliptic_k-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.elliptic_k","text":"elliptic_k(x::acb)\n\nReturn the complete elliptic integral K(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"elliptic_e(::acb)","category":"page"},{"location":"acb/#Nemo.elliptic_e-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.elliptic_e","text":"elliptic_e(x::acb)\n\nReturn the complete elliptic integral E(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"agm(::acb)\nagm(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.agm-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.agm","text":"agm(x::acb)\n\nReturn the arithmetic-geometric mean of 1 and x.\n\n\n\n\n\n","category":"method"},{"location":"acb/#Nemo.agm-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.agm","text":"agm(x::acb, y::acb)\n\nReturn the arithmetic-geometric mean of x and y.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"polygamma(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.polygamma-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.polygamma","text":"polygamma(s::acb, a::acb)\n\nReturn the generalised polygamma function psi(sz).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"zeta(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.zeta-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.zeta","text":"zeta(s::acb, a::acb)\n\nReturn the Hurwitz zeta function zeta(sa).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"rising_factorial(::acb, ::Int)","category":"page"},{"location":"acb/#Nemo.rising_factorial-Tuple{acb, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::acb, n::Int)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an Acb.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"rising_factorial2(::acb, ::Int)","category":"page"},{"location":"acb/#Nemo.rising_factorial2-Tuple{acb, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.rising_factorial2","text":"rising_factorial2(x::acb, n::Int)\n\nReturn a tuple containing the rising factorial x(x + 1)ldots (x + n - 1) and its derivative.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"polylog(::Union{acb,Int}, ::acb)","category":"page"},{"location":"acb/#Nemo.polylog-Tuple{Union{Int64, acb}, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.polylog","text":"polylog(s::Union{acb,Int}, a::acb)\n\nReturn the polylogarithm Li_s(a).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"log_integral(::acb)","category":"page"},{"location":"acb/#Nemo.log_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.log_integral","text":"log_integral(x::acb)\n\nReturn the logarithmic integral, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"log_integral_offset(::acb)","category":"page"},{"location":"acb/#Nemo.log_integral_offset-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.log_integral_offset","text":"log_integral_offset(x::acb)\n\nReturn the offset logarithmic integral, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"exp_integral_e(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.exp_integral_e-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.exp_integral_e","text":"exp_integral_e(s::acb, x::acb)\n\nReturn the generalised exponential integral E_s(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.gamma-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma","text":"gamma(s::acb, x::acb)\n\nReturn the upper incomplete gamma function Gamma(sx).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma_regularized(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.gamma_regularized-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma_regularized","text":"gamma_regularized(s::acb, x::acb)\n\nReturn the regularized upper incomplete gamma function Gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma_lower(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.gamma_lower-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma_lower","text":"gamma_lower(s::acb, x::acb)\n\nReturn the lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma_lower_regularized(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.gamma_lower_regularized-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma_lower_regularized","text":"gamma_lower_regularized(s::acb, x::acb)\n\nReturn the regularized lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"airy_ai(::acb)","category":"page"},{"location":"acb/#Nemo.airy_ai-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.airy_ai","text":"airy_ai(x::acb)\n\nReturn the Airy function operatornameAi(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"airy_ai_prime(::acb)","category":"page"},{"location":"acb/#Nemo.airy_ai_prime-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.airy_ai_prime","text":"airy_ai_prime(x::acb)\n\nReturn the derivative of the Airy function operatornameAi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"airy_bi(::acb)","category":"page"},{"location":"acb/#Nemo.airy_bi-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.airy_bi","text":"airy_bi(x::acb)\n\nReturn the Airy function operatornameBi(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"airy_bi_prime(::acb)","category":"page"},{"location":"acb/#Nemo.airy_bi_prime-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.airy_bi_prime","text":"airy_bi_prime(x::acb)\n\nReturn the derivative of the Airy function operatornameBi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"bessel_j(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.bessel_j-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.bessel_j","text":"bessel_j(nu::acb, x::acb)\n\nReturn the Bessel function J_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"bessel_y(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.bessel_y-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.bessel_y","text":"bessel_y(nu::acb, x::acb)\n\nReturn the Bessel function Y_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"bessel_i(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.bessel_i-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.bessel_i","text":"bessel_i(nu::acb, x::acb)\n\nReturn the Bessel function I_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"bessel_k(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.bessel_k-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.bessel_k","text":"bessel_k(nu::acb, x::acb)\n\nReturn the Bessel function K_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"hypergeometric_1f1(::acb, ::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.hypergeometric_1f1-Tuple{acb, acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.hypergeometric_1f1","text":"hypergeometric_1f1(a::acb, b::acb, x::acb)\n\nReturn the confluent hypergeometric function _1F_1(abx).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"hypergeometric_1f1_regularized(::acb, ::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.hypergeometric_1f1_regularized-Tuple{acb, acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.hypergeometric_1f1_regularized","text":"hypergeometric_1f1_regularized(a::acb, b::acb, x::acb)\n\nReturn the regularized confluent hypergeometric function _1F_1(abx) Gamma(b).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"hypergeometric_u(::acb, ::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.hypergeometric_u-Tuple{acb, acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.hypergeometric_u","text":"hypergeometric_u(a::acb, b::acb, x::acb)\n\nReturn the confluent hypergeometric function U(abx).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"hypergeometric_2f1(::acb, ::acb, ::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.hypergeometric_2f1-NTuple{4, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.hypergeometric_2f1","text":"hypergeometric_2f1(a::acb, b::acb, c::acb, x::acb; flags=0)\n\nReturn the Gauss hypergeometric function _2F_1(abcx).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"jacobi_theta(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.jacobi_theta-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.jacobi_theta","text":"jacobi_theta(z::acb, tau::acb)\n\nReturn a tuple of four elements containing the Jacobi theta function values theta_1 theta_2 theta_3 theta_4 evaluated at z tau.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"weierstrass_p(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.weierstrass_p-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.weierstrass_p","text":"weierstrass_p(z::acb, tau::acb)\n\nReturn the Weierstrass elliptic function wp(ztau).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> s = CC(1, 2)\n1.0000000000000000000 + 2.0000000000000000000*im\n\njulia> z = CC(\"1.23\", \"3.45\")\n[1.230000000000000000 +/- 2.00e-19] + [3.450000000000000000 +/- 3.91e-19]*im\n\njulia> a = sin(z)^2 + cos(z)^2\n[1.000000000000000 +/- 4.92e-16] + [+/- 4.12e-16]*im\n\njulia> b = zeta(z)\n[0.685803329024164062 +/- 6.30e-19] + [-0.038574782404586856 +/- 7.54e-19]*im\n\njulia> c = bessel_j(s, z)\n[0.63189634741402481 +/- 4.85e-18] + [0.00970090757446076 +/- 4.66e-18]*im\n\njulia> d = hypergeometric_1f1(s, s+1, z)\n[-1.3355297330012291 +/- 5.83e-17] + [-0.1715020340928697 +/- 4.97e-17]*im","category":"page"},{"location":"acb/#Linear-dependence","page":"Fixed precisioncomplex balls","title":"Linear dependence","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"lindep(::Vector{acb}, n::Int)","category":"page"},{"location":"acb/#Nemo.lindep-Tuple{Vector{acb}, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.lindep","text":"lindep(A::Vector{acb}, bits::Int)\n\nFind a small linear combination of the entries of the array A that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"lindep(A::Matrix{acb}, bits::Int)","category":"page"},{"location":"acb/#Nemo.lindep-Tuple{Matrix{acb}, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.lindep","text":"lindep(A::Matrix{acb}, bits::Int)\n\nFind a (common) small linear combination of the entries in each row of the array A, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"CC = AcbField(128)\n\n# These are two of the roots of x^5 + 3x + 1\na = CC(1.0050669478588622428791051888364775253, - 0.93725915669289182697903585868761513585)\nb = CC(-0.33198902958450931620250069492231652319)\n\n# We recover the polynomial from one root....\nV1 = [CC(1), a, a^2, a^3, a^4, a^5];\nW = lindep(V1, 20)\n\n# ...or from two\nV2 = [CC(1), b, b^2, b^3, b^4, b^5];\nVs = [V1 V2]\nX = lindep(Vs, 20)","category":"page"},{"location":"misc/#Miscellaneous","page":"Miscellaneous","title":"Miscellaneous","text":"","category":"section"},{"location":"misc/#Global-variables-and-precompilation","page":"Miscellaneous","title":"Global variables and precompilation","text":"","category":"section"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"Due to limitations of the precompilation of modules in julia, global variables referring to certain Nemo types require special attention when used inside modules. As a simple example, the following code for a module called A will not work as expected:","category":"page"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"module A\n\nusing Nemo\nQx, x = QQ[\"x\"]\nf(n) = x^n\nend","category":"page"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"When running julia and loading the module via using/import A, calling f will lead to segmentation faults. The preferred workaround is to put the definitions of the global variables into the __init__() function of the module as follows:","category":"page"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"module A\n\nusing Nemo\n\nfunction __init__()\n global (Qx, x) = QQ[\"x\"]\nend\n\nf(n) = x^n\nend","category":"page"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"Alternatively, one can disable precompilation by adding __precompile__(false) inside A. Note that this might have other unwanted side effects.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"qadic/#Qadics","page":"Qadics","title":"Qadics","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Q-adic fields, that is, unramified extensions of p-adic fields, are provided in Nemo by Flint. This allows construction of q-adic fields for any prime power q.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Q-adic fields are constructed using the FlintQadicField function. However, for convenience we define","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"QadicField = FlintQadicField","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"so that q-adic fields can be constructed using QadicField rather than FlintQadicField. Note that this is the name of the constructor, but not of qadic field type.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"The types of q-adic fields in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Library Field Element type Parent type\nFlint mathbbQ_q qadic QadicField","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"All the q-adic field types belong to the Field abstract type and the q-adic field element types belong to the FieldElem abstract type.","category":"page"},{"location":"qadic/#P-adic-functionality","page":"Qadics","title":"P-adic functionality","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Q-adic fields in Nemo provide all the functionality described in AbstractAlgebra for fields:.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Below, we document all the additional function that is provide by Nemo for q-adic fields.","category":"page"},{"location":"qadic/#Constructors","page":"Qadics","title":"Constructors","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"In order to construct q-adic field elements in Nemo, one must first construct the q-adic field itself. This is accomplished with one of the following constructors.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"FlintQadicField(::Integer, ::Int, ::Int)","category":"page"},{"location":"qadic/#Nemo.FlintQadicField-Tuple{Integer, Int64, Int64}","page":"Qadics","title":"Nemo.FlintQadicField","text":"FlintQadicField(p::Integer, d::Int, prec::Int, var::String = \"a\")\n\nReturns the parent object for the q-adic field for given prime p and degree d, where the default absolute precision of elements of the field is given by prec and the generator is printed as var.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"It is also possible to call the inner constructor directly. It has the following form.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"FlintQadicField(p::ZZRingElem, d::Int, prec::Int)","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Returns the parent object for the q-adic field for given prime p and degree d, where the default absolute precision of elements of the field is given by prec. It also return the uniformizer p with the default precision.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Here are some examples of creating q-adic fields and making use of the resulting parent objects to coerce various elements into those fields.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"julia> R, p = QadicField(7, 1, 30);\n\njulia> S, _ = QadicField(ZZ(65537), 1, 30);\n\njulia> a = R()\n0\n\njulia> b = S(1)\n65537^0 + O(65537^30)\n\njulia> c = S(ZZ(123))\n123*65537^0 + O(65537^30)\n\njulia> d = R(ZZ(1)//7^2)\n7^-2 + O(7^28)","category":"page"},{"location":"qadic/#Big-oh-notation","page":"Qadics","title":"Big-oh notation","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Elements of p-adic fields can be constructed using the big-oh notation. For this purpose we define the following functions.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"O(::FlintQadicField, ::Integer)\nO(::FlintQadicField, ::ZZRingElem)\nO(::FlintQadicField, ::QQFieldElem)","category":"page"},{"location":"qadic/#AbstractAlgebra.O-Tuple{FlintQadicField, Integer}","page":"Qadics","title":"AbstractAlgebra.O","text":"O(R::FlintQadicField, m::Integer)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"qadic/#AbstractAlgebra.O-Tuple{FlintQadicField, ZZRingElem}","page":"Qadics","title":"AbstractAlgebra.O","text":"O(R::FlintQadicField, m::ZZRingElem)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"qadic/#AbstractAlgebra.O-Tuple{FlintQadicField, QQFieldElem}","page":"Qadics","title":"AbstractAlgebra.O","text":"O(R::FlintQadicField, m::QQFieldElem)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"The O(p^n) construction can be used to construct q-adic values of precision n by adding it to integer values representing the q-adic value modulo p^n as in the examples.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"julia> R, _ = QadicField(7, 1, 30);\n\njulia> S, _ = QadicField(ZZ(65537), 1, 30);\n\njulia> c = 1 + 2*7 + 4*7^2 + O(R, 7^3)\n7^0 + 2*7^1 + 4*7^2 + O(7^3)\n\njulia> d = 13 + 357*ZZ(65537) + O(S, ZZ(65537)^12)\n13*65537^0 + 357*65537^1 + O(65537^12)\n\njulia> f = ZZ(1)//7^2 + ZZ(2)//7 + 3 + 4*7 + O(R, 7^2)\n7^-2 + 2*7^-1 + 3*7^0 + 4*7^1 + O(7^2)","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Beware that the expression 1 + 2*p + 3*p^2 + O(R, p^n) is actually computed as a normal Julia expression. Therefore if {Int} values are used instead of Flint integers or Julia bignums, overflow may result in evaluating the value.","category":"page"},{"location":"qadic/#Basic-manipulation","page":"Qadics","title":"Basic manipulation","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"prime(::FlintQadicField)","category":"page"},{"location":"qadic/#AbstractAlgebra.Generic.prime-Tuple{FlintQadicField}","page":"Qadics","title":"AbstractAlgebra.Generic.prime","text":"prime(R::FlintQadicField)\n\nReturn the prime p for the given q-adic field.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"precision(::qadic)","category":"page"},{"location":"qadic/#Base.precision-Tuple{qadic}","page":"Qadics","title":"Base.precision","text":"precision(a::qadic)\n\nReturn the precision of the given q-adic field element, i.e. if the element is known to O(p^n) this function will return n.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"valuation(::qadic)","category":"page"},{"location":"qadic/#AbstractAlgebra.valuation-Tuple{qadic}","page":"Qadics","title":"AbstractAlgebra.valuation","text":"valuation(a::qadic)\n\nReturn the valuation of the given q-adic field element, i.e. if the given element is divisible by p^n but not a higher power of q then the function will return n.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"lift(::QQPolyRing, ::qadic)\nlift(::ZZPolyRing, ::qadic)","category":"page"},{"location":"qadic/#AbstractAlgebra.lift-Tuple{QQPolyRing, qadic}","page":"Qadics","title":"AbstractAlgebra.lift","text":"lift(R::QQPolyRing, a::qadic)\n\nReturn a lift of the given q-adic field element to mathbbQx.\n\n\n\n\n\n","category":"method"},{"location":"qadic/#AbstractAlgebra.lift-Tuple{ZZPolyRing, qadic}","page":"Qadics","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, a::qadic)\n\nReturn a lift of the given q-adic field element to mathbbZx if possible.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"R, _ = QadicField(7, 1, 30);\n\na = 1 + 2*7 + 4*7^2 + O(R, 7^3)\nb = 7^2 + 3*7^3 + O(R, 7^5)\nc = R(2)\n\nk = precision(a)\nm = prime(R)\nn = valuation(b)\nQx, x = FlintQQ[\"x\"]\np = lift(Qx, a)\nZy, y = FlintZZ[\"y\"]\nq = lift(Zy, divexact(a, b))","category":"page"},{"location":"qadic/#Square-root","page":"Qadics","title":"Square root","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Base.sqrt(::qadic)","category":"page"},{"location":"qadic/#Base.sqrt-Tuple{qadic}","page":"Qadics","title":"Base.sqrt","text":"sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of the given Puiseux series a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nBase.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of f. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.\n\n\n\n\n\nBase.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem\n\nReturn the square root of a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nsqrt(a::FieldElem)\n\nReturn the square root of the element a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"julia> R, _ = QadicField(7, 1, 30);\n\njulia> a = 1 + 7 + 2*7^2 + O(R, 7^3)\n7^0 + 7^1 + 2*7^2 + O(7^3)\n\njulia> b = 2 + 3*7 + O(R, 7^5)\n2*7^0 + 3*7^1 + O(7^5)\n\njulia> c = 7^2 + 2*7^3 + O(R, 7^4)\n7^2 + 2*7^3 + O(7^4)\n\njulia> d = sqrt(a)\n7^0 + 4*7^1 + 3*7^2 + O(7^3)\n\njulia> f = sqrt(b)\n4*7^0 + 7^1 + 5*7^2 + 5*7^3 + 6*7^4 + O(7^5)\n\njulia> f = sqrt(c)\n7^1 + 7^2 + O(7^3)\n\njulia> g = sqrt(R(121))\n4*7^0 + 7^1 + O(7^30)","category":"page"},{"location":"qadic/#Special-functions","page":"Qadics","title":"Special functions","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Base.exp(::qadic)","category":"page"},{"location":"qadic/#Base.exp-Tuple{qadic}","page":"Qadics","title":"Base.exp","text":"exp(a::Generic.LaurentSeriesElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the exponential of the given Puiseux series a.\n\n\n\n\n\nexp(a::AbsPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::RelPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"log(::qadic)","category":"page"},{"location":"qadic/#Base.log-Tuple{qadic}","page":"Qadics","title":"Base.log","text":"log(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the logarithm of the given Puiseux series a.\n\n\n\n\n\nlog(a::SeriesElem{T}) where T <: FieldElement\n\nReturn the logarithm of the power series a.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"teichmuller(::qadic)","category":"page"},{"location":"qadic/#Nemo.teichmuller-Tuple{qadic}","page":"Qadics","title":"Nemo.teichmuller","text":"teichmuller(a::qadic)\n\nReturn the Teichmuller lift of the q-adic value a. We require the valuation of a to be nonnegative. The precision of the output will be the same as the precision of the input. For convenience, if a is congruent to zero modulo q we return zero. If the input is not valid an exception is thrown.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"frobenius(::qadic, ::Int)","category":"page"},{"location":"qadic/#Nemo.frobenius-Tuple{qadic, Int64}","page":"Qadics","title":"Nemo.frobenius","text":"frobenius(a::qadic, e::Int = 1)\n\nReturn the image of the e-th power of Frobenius on the q-adic value a. The precision of the output will be the same as the precision of the input.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"julia> R, _ = QadicField(7, 1, 30);\n\njulia> a = 1 + 7 + 2*7^2 + O(R, 7^3)\n7^0 + 7^1 + 2*7^2 + O(7^3)\n\njulia> b = 2 + 5*7 + 3*7^2 + O(R, 7^3)\n2*7^0 + 5*7^1 + 3*7^2 + O(7^3)\n\njulia> c = 3*7 + 2*7^2 + O(R, 7^5)\n3*7^1 + 2*7^2 + O(7^5)\n\njulia> c = exp(c)\n7^0 + 3*7^1 + 3*7^2 + 4*7^3 + 4*7^4 + O(7^5)\n\njulia> d = log(a)\n7^1 + 5*7^2 + O(7^3)\n\njulia> c = exp(R(0))\n7^0 + O(7^30)\n\njulia> d = log(R(1))\n0\n\njulia> f = teichmuller(b)\n2*7^0 + 4*7^1 + 6*7^2 + O(7^3)\n\njulia> g = frobenius(a, 2)\n7^0 + 7^1 + 2*7^2 + O(7^3)","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"developer/parents/#Parent-objects","page":"Parent objects","title":"Parent objects","text":"","category":"section"},{"location":"developer/parents/#The-use-of-parent-objects-in-Nemo","page":"Parent objects","title":"The use of parent objects in Nemo","text":"","category":"section"},{"location":"developer/parents/#The-parent/element-model","page":"Parent objects","title":"The parent/element model","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"As for other major computer algebra projects such as Sage and Magma, Nemo uses the parent/element model to manage its mathematical objects.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"As explained in the appendix to the AbstractAlgebra documentation, the standard type/object model used in most programming languages is insufficient for much of mathematics which often requires mathematical structures parameterised by other objects.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For example a quotient ring by an ideal would be parameterised by the ideal. The ideal is an object in the system and not a type and so parameterised types are not sufficient to represent such quotient rings.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"This means that each mathematical \"domain\" in the system (set, group, ring, field, module, etc.) must be represented by an object in the system, rather than a type. Such objects are called parent objects.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Just as one would write typeof(a) to get the type of an object a in an object/type system of a standard programming language, we write parent(a) to return the parent of the object a.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"When talked about with reference to a parent in this way, the object a is referred to as an element of the parent. Thus the system is divided into elements and parents. For example a polynomial would be an element of a polynomial ring, the latter being the parent of the former.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Naturally the parent/element system leads to some issues in a programming language not built around this model. We discuss some of these issues below.","category":"page"},{"location":"developer/parents/#Types-in-the-parent/element-model","page":"Parent objects","title":"Types in the parent/element model","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"As all elements and parents in Nemo are objects, those objects have types which we refer to as the element type and parent type respectively.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For example, Flint integers have type ZZRingElem and the parent object they all belong to, FlintZZ has type ZZRing.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"More complex parents and elements are parameterised. For example, generic univariate polynomials over a base ring R are parameterised by R. The base ring of a ring S can be obtained by the call base_ring(S).","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"We have found it extremely useful to parameterise the type of both the parent and element objects of such a ring by the type of the elements of the base ring. Thus for example, a generic polynomial with Flint integer coefficients would have type Poly{ZZRingElem}.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"In practice Flint already implements univariate polynomials over Flint integers, and these have type ZZPolyRingElem. But both ZZPolyRingElem and the generic polynomials Poly{ZZRingElem} belong to the abstract type PolyRingElem{ZZRingElem} making it possible to write functions for all univariate polynomials over Flint integers.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Given a specific element type or parent type it is possible to compute one from the other with the functions elem_type and parent_type. For example parent_type(ZZPolyRingElem) returns ZZPolyRing and elem_type(ZZPolyRing) returns ZZPolyRingElem. Similarly parent_type(Generic.Poly{ZZRingElem}) returns Generic.PolyRing{ZZRingElem} and so on.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"These functions are especially useful when writing type assertions or constructing arrays of elements insides function where only the parent object was passed.","category":"page"},{"location":"developer/parents/#Other-functions-for-computing-types","page":"Parent objects","title":"Other functions for computing types","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Sometimes one needs to know the type of a polynomial or matrix one would obtain if it were constructed over a given ring or with coefficients/entries of a given element type.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"This is especially important in generic code where it may not even be known which Julia package is being used. The user may be expecting an AbstractAlgebra object, a Nemo object or even some other kind of object to be constructed, depending on which package they are using.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"The function for returning the correct type for a dense matrix is dense_matrix_type to which one can pass either a base ring or an element type. For example, if AbstractAlgebra is being used, dense_matrix_type(ZZ) will return Mat{BigInt} whereas if Nemo is being used it will return ZZMatrix.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"We also have dense_poly_type for univariate polynomials, abs_series_type for absolute series and rel_series_type for relative series.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"In theory such functions should exist for all major object types, however they have in most cases not been implemented yet.","category":"page"},{"location":"developer/parents/#Functions-for-creating-objects-of-a-similar-type","page":"Parent objects","title":"Functions for creating objects of a similar type","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"A slightly more consistent interface for creating objects of a type that is suitable for the package currently in use is the similar interface.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For example, given a matrix M one can create one with the same dimensions but over a different ring R by calling similar(M, R). Likewise one can create one over the same ring with different dimensions r x c by calling similar(M, r, c).","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"The similar system is sophisticated enough to know that there is no native type provided by Flint/Antic for matrices and polynomials over a number field. The system knows that in such cases it must create a generic matrix or polynomial over the given number field.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"A great deal of thought went into the design of the similar system so that developers would not be required to implement similar for every pair of types in the package.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Again this interface should exist for all major Nemo domains, but the functionality is still being implemented in some cases.","category":"page"},{"location":"developer/parents/#Changing-base-rings-and-map","page":"Parent objects","title":"Changing base rings and map","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Given a polynomial, matrix or other composite object over a base ring, it is often convenient to create a similar object but with all the entries or coefficients coerced into a different ring.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For this purpose the function change_base_ring is provided.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Similarly it may be useful to create the matrix or polynomial that results by applying a given map/function/lambda to each of the entries or coefficients.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For this purpose Julia's map function is overloaded. There are also functions specific to polynomials and matrices called map_coefficients and map_entries respectively, which essentially do the same thing.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Note that the implementation of such functions must make use of the functions discussed above to ensure that a matrix/polynomial of the right type is output.","category":"page"},{"location":"developer/parents/#Parent-checking","page":"Parent objects","title":"Parent checking","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"When applying binary operations to a pair of elements of a given ring, it is useful to check that they are in fact elements of the same ring. This is not possible by checking the types alone. For example elements of Z7Z and Z3Z would have the same type but different parents (one parameterised by the integer 7, the other by the integer 3).","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"In order to perform such a check in a function one uses check_parent(a, b) where a and b are the objects one wishes to assert must have the same parent. If not, an exception is raised by check_parent.","category":"page"},{"location":"developer/parents/#Parent-object-constructors","page":"Parent objects","title":"Parent object constructors","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Various functions are provided for constructing parent objects. For example a polynomial ring is constructed by calling a polynomial_ring function. Such functions are called parent object constructors.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"In general parent object constructors are intended for the user and should not be used in library code. There are a number of reasons for this.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Firstly, inside the Generic submodule of AbstractAlgebra the only parent object constructors that are directly accessible are the ones inside Generic. Thus if a Nemo function calls a function inside Generic and it creates a parent object using one of the parent object constructors, it will create a parent object for a generic ring rather than a Nemo one.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"One can work around this by calling AbstractAlgebra.polynomial_ring instead of simply polynomial_ring inside Generic, but even safer would be to find another way to construct the polynomials required.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"A second issue is that parent objects are allowed to be as large as one likes and they are cached by the system. They can also perform arbitrary precomputations for the ring/field/module etc. that is being constructed. Over time they tend to accumulate such precomputations, slowing down all generic code which made use of them. Both memory usage and performance may blow out in previously working code.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Thirdly, parent objects must be unique across the system for a given set of parameters. This means they must be cached globally. This is problematic for any future attempts to parallelise library code and in the worst case memory usage can balloon due to swelling caches.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Most parent object constructors take a cached keyword which specifies whether the parent object should be cached or not, but again it is better overall to simply eschew the use of parent object constructors in library code.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Instead, it is recommended to use functions such as similar, zero, zero_matrix, identity_matrix, change_base_ring, map, etc. for constructing polynomials and matrices directly.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"There are also functions that provide alternative ways of constructing objects, e.g. matrix provides a means of creating a matrix over a given ring with given dimensions. The constructor polynomial allows creation of a polynomial over a given base ring with given coefficients and abs_series and rel_series do similar things for absolute and relative series. These should be used in preference to parent object constructors where possible. Additional functions of this type should be added in future.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"However even when using these functions in library code, it is important to remember to pass cached=false so that the cache is not filled up by calls to the library code. But this creates an additional problem, namely that if one uses polynomial say, to construct two polynomials over the same base ring, they will not be compatible in the sense that they will have different parents.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"When one wishes to construct multiple elements in the same group/ring/field, it is convenient to be able to construct a parent just as a user would. For this purpose various light-weight and very safe parent constructors are provided for use in library code.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For example there are the constructors PolyRing, AbsPowerSeriesRing and RelPowerSeriesRing. These functions return the parent ring R only and no generator (it can be obtained by calling gen(R)). They also set the variable for printing to a default (usually x). Moreover, these parents are not cached, so they are completely safe to use in library code. They can be thousands of times faster than the full parent constructors intended for users.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Here is an example of their use:","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"julia> R = PolyRing(ZZ)\nUnivariate polynomial ring in x over ZZ\n\njulia> p = R([1, 2, 3])\n3*x^2 + 2*x + 1\n\njulia> q = R([2, 3, 4])\n4*x^2 + 3*x + 2\n\njulia> s = p + q\n7*x^2 + 5*x + 3","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Naturally functions like polynomial and matrix and the light-weight parent constructors are missing for other modules in Nemo at present and it is hoped that developers will fill in such infrastructure rather than simply push the can down the road for someone else to fix. Forcing the creating of full parent objects into as few bottlenecks as possible will make it much easier for developers to remove problems associated with such calls when they arise in future.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/topics/#Specific-topics","page":"Specific topics","title":"Specific topics","text":"","category":"section"},{"location":"developer/topics/#Julia-arithmetic","page":"Specific topics","title":"Julia arithmetic","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"At the console, Julia arithmetic is often defined in a way that a numerical person would expect. For example, 3/1 returns a floating point number 3.0, sqrt(4) returns the floating point number 2.0 and exp(0) returns the floating point number 1.0.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In each case the ring is changed from the input to the output of the function. Whilst this is often what one expects to happen in a computer algebra system, these are not the definitions one would want for algebraic operations.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In this section we describe the alternatives we have implemented to allow algebraic computations, particularly for rings and fields.","category":"page"},{"location":"developer/topics/#divexact-and-divides","page":"Specific topics","title":"divexact and divides","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Nemo implements numerous kinds of division:","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"floating point division using the / operator as per Julia\nexact division in a ring using divexact and divides\nquotient field element construction using // as per Julia\nEuclidean division using div, rem, divrem, mod and %","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The expression divexact(a, b) for a and b in a ring R returns a value c in R such that a = bc. If such an element of R does not exist, an exception is raised.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"To instead test whether such an element exists, divides(a, b) returns a tuple (flag, q) where flag is a boolean saying whether such an exact quotient exists in the ring and if so q is such a quotient.","category":"page"},{"location":"developer/topics/#Euclidean-division","page":"Specific topics","title":"Euclidean division","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Nemo must provide Euclidean division, i.e. given a and b in a Euclidean ring R it must be able to find q and r such that a = bq + r with r smaller than a with respect to some fixed Euclidean function on R. There are some restrictions imposed by Julia however.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Firstly, % is a constant alias of rem in Julia, so these are not actually two independent functions but the same function.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Julia defines div, rem and divrem for integers as a triple of functions that return Euclidean quotient and remainder, where the remainder has the same sign as the dividend, e.g. rem(1, 3) == 1 but rem(-2, 3) == -2. In other words, this triple of functions gives Euclidean division, but without a consistent set of representatives.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"When using Nemo at the console (or indeed inside any other package without importing the internal Nemo definitions) div, rem and divrem return the same values as Julia and these functions follows the Julia convention of making the sign of the remainder the same as the dividend over ZZ, e.g. rem(ZZ(1), ZZ(3)) == 1 but rem(ZZ(-2), ZZ(3)) == -2.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Internally to Nemo however, this is not convenient. For example, Hermite normal form over ZZ will only return a unique result if there is a consistent choice of representatives for the Euclidean division. This applies to the generic HNF code in AbstractAlgebra, but similar problems exist for the generic finitely presented module code in AbstractAlgebra, even when used over Nemo integers. Thus the Julia definition of rem will not suffice.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Furthermore, as Nemo wraps Flint, it is convenient that Euclidean division inside Nemo should operate the way Flint operates. This is critical if for example one wants the result of a Hermite normal form coming from Flint to be reduced using the same definition of Euclidean remainder as used elsewhere throughout the Nemo module and to return the same answers as the generic HNF code in AbstractAlgebra for example.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In particular, Flint defines Euclidean remainder over the integers in line with the Julia function mod, namely by returning the smallest remainder with the same sign as the divisor, i.e. mod(1, 3) == 1 but mod(1, -3) == -2.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Therefore internally, Nemo chooses div, mod and divrem to be a consistent triple of functions for Euclidean division, with mod defined as per Julia. Thus in particular, div and divrem behave differently to Julia inside of Nemo itself, viz. Nemo.divrem(-1, 3) == (-1, 2).","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The same definitions for div, mod and divrem are used internally to AbstractAlgebra as well, even for Julia integers, so that AbstractAlgebra and Nemo are both consistent internally. However, both AbstractAlgebra and Nemo export definitions in line with Julia so that behaviour at the console is consistent.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The Nemo developers have given considerable thought to this compromise and the current situation has evolved over many iterations to the current state. We do not consider this to be a situation that needs 'fixing', though we are acutely aware that many tickets will be opened complaining about some inconsistency.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"When reflecting on the choice we have made, one must consider the following:","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Nemo must internally behave as Flint does for consistency\nThere are also functions such as powmod, invmod that reduce as per mod\nHNF requires a consistent set of representatives for uniqueness over ZZ","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Also note that Julia's rem does not provide symmetric mod, a misconception that often arises. The issues here are independent of the decision to use positive remainder (for positive modulus) in Flint, rather than symmetric mod.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"We are aware that the conventions we have chosen have inconsistencies with Julia and do not have the nice property that div, rem and divrem are a triple of Euclidean functions inside Nemo. However, we are sure that the convention we have chosen is one of only two sensible possibilities, and switching to the other convention (apart from being a huge amount of effort) would only succeed in replacing one kind of inconsistency with another.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"As a consequence of these choices, div, mod and divrem are a triple of functions for all Euclidean division across Nemo, not just for the integers. As generic code must use a consistent set of functions, we ask that developers respect this choice by using these three functions in all generic code. The functions rem and % should only be used for Julia integers, and only when one specifically wants the Julia definition.","category":"page"},{"location":"developer/topics/#sqrt,-inv-and-exp","page":"Specific topics","title":"sqrt, inv and exp","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"As mentioned above, Julia does not perform computations within a given ring, but often returns a numerical result when given an exact input.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Whilst this is often what a user expects, it makes operations such as power series square root, inversion or exponentiation more tricky over an exact ring.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Therefore, AbstractAlgebra defines sqrt, inv and exp internally in a strictly algebraic way, returning a result only if it exists in the ring of the input and otherwise raising an exception.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"For example, AbstractAlgebra.sqrt(4) == 2, AbstractAlgebra.inv(-1) == -1 and AbstractAlgebra.exp(0) == 1.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Naturally these definitions are not so terribly useful to a user and are only needed for internal consistency. Therefore, of course these definitions are not exported by AbstractAlgebra so that the behaviour at the console is not affected by these definitions.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"There is currently some inconsistency in that Nemo follows the Julia numerical definitions internally rather than following the algebraic definitions provided internally in AbstractAlgebra. This may or may not change in future.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"It is worth recalling that Julia provides isqrt for integer square root. This is not sufficient to solve our problem as we require square root for all rings, not just integers. We don't feel that developers will want to type isqrt rather than sqrt internally for all rings.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"A number of changes are expected to be made with regard to the behaviour of root taking and division functions, including the ability to specify high performance alternatives that do not check the exactness of the computation. These changes are being discussed on the Nemo ticket https://github.com/Nemocas/Nemo.jl/issues/862 In particular, the table given there by thofma represents the current consensus on the changes that will be made in the future.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that many of the above issues with exact computations in rings exist for all the Julia transcendental functions, sin, cos, log, etc., of which there are many. If we ever add some kind of generic power series functions for these, we may extend the internal definitions to include exact algebraic versions of all these functions. At least for now this is not a pressing issue.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The way that AbstractAlgebra deals with functions which must have a different definition inside the module than what it exports is as follows. Firstly, we do not import the functions from Base or export the functions at all. Internally we make our definitions as we want them, but then we overload the Base version explicitly to do what the console version of the function should do. This is done by explicitly defining Base.sqrt(::ZZRingElem) for example without explicitly importing sqrt from Base, etc.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the Generic module discussed below, we import the definitions from AbstractAlgebra rather than Base.","category":"page"},{"location":"developer/topics/#Determinant","page":"Specific topics","title":"Determinant","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Another function which Nemo handles differently to Julia is det for determinant of matrices. If the input is an integer matrix, Nemo outputs an integer rather than a floating point number for the determinant.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"However, this is not such an acute problem as Julia's det has now been placed in LinearAlgebra rather than Base. Moreover, Nemo has its own matrices and so does not conflict with the definition of det for Julia matrices.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"It is important for developers to understand this difference however. It is not generally wise to use the Julia linear algebra functionality on the Julia matrices underlying generic Nemo matrices for this reason.","category":"page"},{"location":"developer/topics/#The-Generic-submodule","page":"Specific topics","title":"The Generic submodule","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In AbstractAlgebra we define a submodule called Generic. The purpose of this module is to allow generic constructions over a given base ring. For example in Nemo, R, x = Generic.polynomial_ring(ZZ, \"x\") will construct a generic polynomial ring over Nemo integers instead of constructing a Flint polynomial ring.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In other words x will have the type Generic.Poly{ZZRingElem} instead of the usual ZZPolyRingElem.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The ability to construct generic polynomials and matrices and the like is useful for test code and for tracking down bugs in basic arithmetic. It is also useful for performance comparison of arithmetic defined for generic ring constructions vs the specialised implementations provided by C libraries like Flint.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Whilst most developers will not need to use the Generic module specifically, unless they have such needs, all Nemo developers need to understand how to define new generic ring constructions and functions for them. They also need to understand some subtleties that arise because of this mechanism.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Firstly, a generic construction like polynomial_ring must be defined inside the Generic submodule of AbstractAlgebra. All files inside the src/generic directory of AbstractAlgebra exist for this purpose. However, exporting from that submodule will not export the functionality to the Nemo user.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"To do this, one must add a function polynomial_ring for example, in src/Poly.jl, say, which calls Generic.polynomial_ring. Then one needs to export polynomial_ring from AbstractAlgebra (also in that file).","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Similarly, all functions provided for generic polynomial rings are not automatically available, even when exported from the Generic submodule. Two additional things are required, namely an import from Generic into AbstractAlgebra and then an export from AbstractAlgebra to the user.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"An exception to this is if there is a function with the same name in AbstractAlgebra (i.e. in the top level src directory). In this case it is sufficient to simply import that function into Generic in the file src/Generic.jl.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the former case, two large lists exist in src/AbstractAlgebra.jl with these imports and exports. These are kept in alphabetical order to prevent duplicate imports/exports being added over time.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"If one wishes to extend a definition provided by Base, one can simply overload Base.blah inside the Generic submodule directly. Exceptions to this include the div, mod, divrem, sqrt, inv and exp functions mentioned above.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"For AbstractAlgebra types, one still defines these exceptions blah by overloading Base.blah directly inside Generic. However, for the versions that would conflict with the Julia definition (e.g. the definition for Int), we instead define AbstractAlgebra.blah for that specific type and a fallback AbstractAlgebra.blah(a) = Base.blah(a) which calls the Base version of the function for all other types. Of course we do not export blah from AbstractAlgebra.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In order to make the AbstractAlgebra version available in Generic (rather than the Base version), we do not import blah from Base inside Generic, but instead import it from AbstractAlgebra. One can see these imports for the exceptional functions blah in the file src/Generic.jl.","category":"page"},{"location":"developer/topics/#Unsafe-operations-and-aliasing","page":"Specific topics","title":"Unsafe operations and aliasing","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"As with most object oriented languages that overload arithmetic operators, Julia creates new objects when doing an arithmetic operation. For example, BigInt(3) + BigInt(5) creates a new BigInt object to return the value BigInt(8). This can be problematic when accumulating many such operations in a single coefficient of a polynomial or entry of a matrix due to the large number of temporary objects the garbage collector must allocate and clean up.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"To speed up such accumulations, Nemo provides numerous unsafe operators, which mutate the existing elements of the polynomial, matrix, etc. These include functions such as add!, addeq!, mul!, zero! and addmul!.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"These functions take as their first argument the object that should be modified with the return value.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that functions such as sub!, submul! and subeq! are not in the official interface and not provided consistently, thus generic code cannot rely on them existing. So far it has always been the case that when doing accumulation where subtraction is needed rather than addition, that a single negation can be performed outside the accumulation loop and then the additive versions of the functions can be called inside the loop where the performance matters.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"If we encounter cases in future where this is not the case, it may be necessary to add the versions that do subtraction to the interface. However, this can only be done if all rings in Nemo support it. One cannot define a fallback which turns a subtraction into a negation and an addition, as then the old performance characteristics of a new object being created per operation will result, meaning that the developer will not be able to reason about the likely performance of unsafe operators.","category":"page"},{"location":"developer/topics/#Interaction-of-unsafe-operators-and-immutable-types","page":"Specific topics","title":"Interaction of unsafe operators and immutable types","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Because not all objects in Nemo are mutable, the unsafe operators somehow have to support immutable objects. This is done by also returning the \"modified\" return value from the unsafe operators. Naturally, this return value is not a mutated version of the original value, as that is not possible. However, it does allow the unsafe operators to accept immutable values in their first argument. Instead of modifying this value, the old value is replaced with the return value of the unsafe operator.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In order to make this work correctly, every single call to an unsafe operator must assign the return value to the original location. This requires discipline on the part of the developer using unsafe operators.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"For example, to set the existing value a to a + b one must write","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"a = addeq!(a, b)","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"i.e. one must have an explicit assignment to the left of the addeq! call and indeed all the unsafe operator calls.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the case of a mutable type, addeq! will simply modify the original a. The modified object will be returned and assigned to the exact same variable, which has no effect.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the case of an immutable type, addeq! does not modify the original object a as this is impossible, but it still returns the new value and assigns it to a which is what one wants.","category":"page"},{"location":"developer/topics/#Aliasing-rules-and-mutation","page":"Specific topics","title":"Aliasing rules and mutation","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"One must be incredibly careful when mutating an existing value that one owns the value. If the user passes an object to a generic function for example and it changes the object without the user knowing, this can result in incorrect results in user code due to the value of their objects changing from under them.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the first instance, functions should never modify their inputs. But further problems can also occur if the output of an unsafe operator happens to alias one of the other inputs. Such cases need to be handled exceptionally carefully.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"A second issue arises as Nemo is based on Flint, which has its own aliasing rules which are distinct from the default expectation in Julia. This leads to some interesting corner cases.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In particularly, Flint always allows aliasing of inputs and outputs in its polynomial functions but expects matrix functions to have output matrices that are distinct from their inputs, except in a handful of functions that are specially documented to be inplace operations.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Moreover, when assigning an element to a coefficient of a polynomial or entry of a matrix Flint always makes a copy of the element being assigned to that location. In Julia however, if one assigns an element to some index of an array, the existing object at that location is replaced with the new object. This means that inplace modification of Julia array elements is not safe as it would modify the original object that was assigned to that location, whereas in Flint inplace modification is highly desirable for performance reasons and is completely safe due to the fact that a copy was made when the value was assigned to that location.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"We have developed over a period of many years a set of rules that maximise the performance benefit we get from our unsafe operators, whilst keeping the burden imposed on the programmer to a minimum. It has been a very difficult task to arrive at the set of rules we have whilst respecting correctness of our code, and it would be extremely hard to change any of them.","category":"page"},{"location":"developer/topics/#Arithmetic-operations-return-a-new-object","page":"Specific topics","title":"Arithmetic operations return a new object","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In order to make it easy for the Nemo developer to create a completely new object when one is needed, e.g. for accumulating values using unsafe operators, we developed the following rules.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Whenever an arithmetic operation is used, i.e. +, -, *, unary minus and ^, Nemo always returns a new object, in line with Julia. Naturally, deepcopy also makes a copy of an object which can be used in unsafe functions.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that if R is a type and an element a of that type is passed to it, e.g. R(a) then, the Julia convention is that the original object a will be returned rather than a copy of a. This convention ensures there is not an additional cost when coercing values that are already of the right type, e.g in generic code where coercion may or may not be needed depending on the type.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"We extend this convention to parent objects R and elements a of that parent. In particular, R(a) cannot be used to make a copy of a for use in an unsafe function if R is the parent of a.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"All other functions may also return the input object if they wish. In other words, the return value of all other functions is not suitable for use in an unsafe function. Only return values of arithmetic operations and deepcopy or objects freshly created using inner constructors will be suitable for such use.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"This convention has been chosen to maximise performance of Nemo. Low level operations (where performance matters) make a new object, even if the result is the same arithmetically as one of the inputs. But higher level functions will not necessarily make a new object, meaning that they cannot be used with unsafe functions.","category":"page"},{"location":"developer/topics/#Aliasing-rules","page":"Specific topics","title":"Aliasing rules","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"We now summarise the aliasing rules used by Nemo and AbstractAlgebra. We are relatively confident by now that following these rules will result in correct code given the constraints mentioned above.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"matrices are viewed as containers which may contain elements that alias one another. Other objects, e.g. polynomials, series, etc., are constructed from objects that do not alias one another, even in part\nstandard unsafe operators, addeq!, mul!, addmul!, zero!, add! which mutate their outputs are allow to be used iff that output is entirely under the control of the caller, i.e. it was created for the purpose of accumulation, but otherwise must not be used\nall arithmetic functions i.e. unary minus, +, -, *, ^, and deepcopy must return new objects and cannot return one of their inputs\nall other functions are allowed to return their inputs as outputs\nmatrix functions with an exclamation mark should not mutate the objects that occur as entries of the output matrix, though should be allowed to arbitrarily replace/swap the entries that appear in the matrix. In other words, these functions should be interpreted as inplace operations, rather than operations that are allowed to mutate the actual entries themselves\nR(a) where R is the parent of a, always just returns a and not a copy\nsetcoeff! and setindex! and getcoeff and getindex should not make copies. Note that this implies that setcoeff! should not be passed an element that aliases another somewhere else, even in part\nConstructors for polynomials, series and similar ring element objects (that are not matrices) that take an array as input, must ensure that the coefficients being placed into the object do not alias, even in part","category":"page"},{"location":"developer/topics/#The-SparsePoly-module","page":"Specific topics","title":"The SparsePoly module","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The SparsePoly module in AbstractAlgebra is a generic module for sparse univariate polynomials over a given base ring.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"This module is used internally, e.g. in the generic multivariate gcd code, however it is not particularly suitable for general use.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Firstly, whilst the representation is sparse (recursive) the algorithms used generally are not. This is because the amount of time taken by the Jit in Julia is simply too large (upwards of 6s for the first multivariate gcd).","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Secondly, the order of terms in that representation is not the one which a developer would expect for a sparse univariate format.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"If the Julia Jit is ever made orders of magnitude faster, it may be worth cleaning up this module and making it generally available. But for now, it should be considered internal and heavily incomplete.","category":"page"},{"location":"developer/topics/#Parent-object-caching","page":"Specific topics","title":"Parent object caching","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Parent objects in Nemo must be unique given the data that is used to create them. For this purpose most parent objects are cached globally and looked up upon creation. If a parent object with that data already exists, it is returned from the cache instead of creating a new one.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"There are two situations where this can be problematic however.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The first situation is if one is doing some parallel programming. Here global objects are a blight and it may be necessary to turn off caching and simply ensure that that same data is only ever used once when creating parent objects.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The second situation is when doing multimodular algorithms, where many similar parent objects with different moduli are created. The cache can become overwhelmed slowing the code down or even grinding to a halt.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In both these situations one can pass false as an additional argument to a parent constructor to avoid caching the parent object it creates. This parameter normally has a default value of true and under normal circumstances doesn't need to be supplied.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that special light-weight parent constructors, PolyRing, AbsPowerSeriesRing, RelPowerSeriesRing, etc. are also provided which do not cache.","category":"page"},{"location":"developer/topics/#Throw/nothrow-for-check_parent","page":"Specific topics","title":"Throw/nothrow for check_parent","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"By default the check_parent functions throw an exception if parents do not match. However sometimes one would like to know if they match without throwing.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"For this purpose one can pass an additional false argument to check_parent. This suppresses the exception that would be thrown if the parent objects didn't match. Instead the function simply returns true or false to indicate whether they matched or not.","category":"page"},{"location":"developer/topics/#Delayed-reduction","page":"Specific topics","title":"Delayed reduction","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"When working in residue rings, various functions will perform an arithmetic operation followed by a reduction modulo the modulus of the residue ring.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Some accumulations, e.g. in linear algebra or polynomial arithmetic, can be dramatically sped up if one can delay the reductions that would happen after each operation in the accumulation.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Some of the Generic code in Nemo is designed to allow such delayed reduction if the ring supports it and to simply use fallbacks that do the reduction after every intermediate operation if they don't.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"To support delayed reduction, a ring must support the delayed reduction interface which we describe here.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Two additional functions must be supplied for the element type. We give examples for the Nemo nf_elem type:","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"mul_red!(z::nf_elem, x::nf_elem, y::nf_elem, red::Bool)","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"This function behaves as per mul! but only performs reduction if the additional boolean argument red is set to true. This function can assume that both the inputs are reduced.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"reduce!(x::nf_elem)","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"This function must perform reduction on an unreduced element (mutating it). Note that it must return the mutated value as per all unsafe operators.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Finally, the add! and addeq! operators must be able to add nonreduced values.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"If one wishes to speed up generic code for rings that provide delayed reduction, one makes use of the function addmul_delayed_reduction! in the accumulation loop. Here is an example for accumulation into a two dimensional matrix element in Generic in a matrix multiplication routine:","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"A[i, j] = base_ring(X)()\nfor k = 1:ncols(X)\n A[i, j] = addmul_delayed_reduction!(A[i, j], x[i, k], y[k, j], C)\nend\nA[i, j] = reduce!(A[i, j])","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Here C is a temporary element of the same type as the other inputs which is used internally in addmul_delayed_reduction! if needed.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Notice the final call to reduce! to reduce the accumulated value after the accumulation loop has finished.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that mul_red! is never called directly but is called inside the generic implementation of addmul_delayed_reduction! for rings that support delayed reduction. That generic code falls back to a call to addmul! which in turn falls back to mul! and addeq! where delayed reduction or addmul! are not available.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"padic/#Padics","page":"Padics","title":"Padics","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"P-adic fields are provided in Nemo by Flint. This allows construction of p-adic fields for any prime p.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"P-adic fields are constructed using the FlintPadicField function. However, for convenience we define","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"PadicField = FlintPadicField","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"so that p-adic fields can be constructed using PadicField rather than FlintPadicField. Note that this is the name of the constructor, but not of padic field type.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"The types of p-adic fields in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Library Field Element type Parent type\nFlint mathbbQ_p padic PadicField","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"All the p-adic field types belong to the Field abstract type and the p-adic field element types belong to the FieldElem abstract type.","category":"page"},{"location":"padic/#P-adic-functionality","page":"Padics","title":"P-adic functionality","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"P-adic fields in Nemo implement all the AbstractAlgebra field functionality:.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Below, we document all the additional function that is provide by Nemo for p-adic fields.","category":"page"},{"location":"padic/#Constructors","page":"Padics","title":"Constructors","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"In order to construct p-adic field elements in Nemo, one must first construct the p-adic field itself. This is accomplished with one of the following constructors.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"FlintPadicField(::Integer, ::Int)","category":"page"},{"location":"padic/#Nemo.FlintPadicField-Tuple{Integer, Int64}","page":"Padics","title":"Nemo.FlintPadicField","text":"FlintPadicField(p::Integer, prec::Int; kw...)\n\nReturns the parent object for the p-adic field for given prime p, where the default absolute precision of elements of the field is given by prec.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"It is also possible to call the inner constructor directly. It has the following form.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"FlintPadicField(p::ZZRingElem, prec::Int)","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Returns the parent object for the p-adic field for given prime p, where the default absolute precision of elements of the field is given by prec.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Here are some examples of creating p-adic fields and making use of the resulting parent objects to coerce various elements into those fields.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\nS = PadicField(ZZ(65537), 30)\n\na = R()\nb = S(1)\nc = S(ZZ(123))\nd = R(ZZ(1)//7^2)","category":"page"},{"location":"padic/#Big-oh-notation","page":"Padics","title":"Big-oh notation","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"Elements of p-adic fields can be constructed using the big-oh notation. For this purpose we define the following functions.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"O(::FlintPadicField, ::Integer)\nO(::FlintPadicField, ::ZZRingElem)\nO(::FlintPadicField, ::QQFieldElem)","category":"page"},{"location":"padic/#AbstractAlgebra.O-Tuple{FlintPadicField, Integer}","page":"Padics","title":"AbstractAlgebra.O","text":"O(R::FlintPadicField, m::Integer)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"padic/#AbstractAlgebra.O-Tuple{FlintPadicField, ZZRingElem}","page":"Padics","title":"AbstractAlgebra.O","text":"O(R::FlintPadicField, m::ZZRingElem)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"padic/#AbstractAlgebra.O-Tuple{FlintPadicField, QQFieldElem}","page":"Padics","title":"AbstractAlgebra.O","text":"O(R::FlintPadicField, m::QQFieldElem)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"The O(p^n) construction can be used to construct p-adic values of precision n by adding it to integer values representing the p-adic value modulo p^n as in the examples.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\nS = PadicField(ZZ(65537), 30)\n\nc = 1 + 2*7 + 4*7^2 + O(R, 7^3)\nd = 13 + 357*ZZ(65537) + O(S, ZZ(65537)^12)\nf = ZZ(1)//7^2 + ZZ(2)//7 + 3 + 4*7 + O(R, 7^2)","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Beware that the expression 1 + 2*p + 3*p^2 + O(R, p^n) is actually computed as a normal Julia expression. Therefore if {Int} values are used instead of Flint integers or Julia bignums, overflow may result in evaluating the value.","category":"page"},{"location":"padic/#Basic-manipulation","page":"Padics","title":"Basic manipulation","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"prime(::FlintPadicField)","category":"page"},{"location":"padic/#AbstractAlgebra.Generic.prime-Tuple{FlintPadicField}","page":"Padics","title":"AbstractAlgebra.Generic.prime","text":"prime(R::FlintPadicField)\n\nReturn the prime p for the given p-adic field.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"precision(::padic)","category":"page"},{"location":"padic/#Base.precision-Tuple{padic}","page":"Padics","title":"Base.precision","text":"precision(a::padic)\n\nReturn the precision of the given p-adic field element, i.e. if the element is known to O(p^n) this function will return n.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"valuation(::padic)","category":"page"},{"location":"padic/#AbstractAlgebra.valuation-Tuple{padic}","page":"Padics","title":"AbstractAlgebra.valuation","text":"valuation(a::padic)\n\nReturn the valuation of the given p-adic field element, i.e. if the given element is divisible by p^n but not a higher power of p then the function will return n.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"lift(::ZZRing, ::padic)\nlift(::QQField, ::padic)","category":"page"},{"location":"padic/#AbstractAlgebra.lift-Tuple{ZZRing, padic}","page":"Padics","title":"AbstractAlgebra.lift","text":"lift(R::ZZRing, a::padic)\n\nReturn a lift of the given p-adic field element to mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"padic/#AbstractAlgebra.lift-Tuple{QQField, padic}","page":"Padics","title":"AbstractAlgebra.lift","text":"lift(R::QQField, a::padic)\n\nReturn a lift of the given p-adic field element to mathbbQ.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\n\na = 1 + 2*7 + 4*7^2 + O(R, 7^3)\nb = 7^2 + 3*7^3 + O(R, 7^5)\nc = R(2)\n\nk = precision(a)\nm = prime(R)\nn = valuation(b)\np = lift(FlintZZ, a)\nq = lift(FlintQQ, divexact(a, b))","category":"page"},{"location":"padic/#Square-root","page":"Padics","title":"Square root","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"Base.sqrt(::padic)","category":"page"},{"location":"padic/#Base.sqrt-Tuple{padic}","page":"Padics","title":"Base.sqrt","text":"sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of the given Puiseux series a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nBase.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of f. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.\n\n\n\n\n\nBase.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem\n\nReturn the square root of a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nsqrt(a::FieldElem)\n\nReturn the square root of the element a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\n\na = 1 + 7 + 2*7^2 + O(R, 7^3)\nb = 2 + 3*7 + O(R, 7^5)\nc = 7^2 + 2*7^3 + O(R, 7^4)\n\nd = sqrt(a)\nf = sqrt(b)\nf = sqrt(c)\ng = sqrt(R(121))","category":"page"},{"location":"padic/#Special-functions","page":"Padics","title":"Special functions","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"Base.exp(::padic)","category":"page"},{"location":"padic/#Base.exp-Tuple{padic}","page":"Padics","title":"Base.exp","text":"exp(a::Generic.LaurentSeriesElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the exponential of the given Puiseux series a.\n\n\n\n\n\nexp(a::AbsPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::RelPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"log(::padic)","category":"page"},{"location":"padic/#Base.log-Tuple{padic}","page":"Padics","title":"Base.log","text":"log(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the logarithm of the given Puiseux series a.\n\n\n\n\n\nlog(a::SeriesElem{T}) where T <: FieldElement\n\nReturn the logarithm of the power series a.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"teichmuller(::padic)","category":"page"},{"location":"padic/#Nemo.teichmuller-Tuple{padic}","page":"Padics","title":"Nemo.teichmuller","text":"teichmuller(a::padic)\n\nReturn the Teichmuller lift of the p-adic value a. We require the valuation of a to be nonnegative. The precision of the output will be the same as the precision of the input. For convenience, if a is congruent to zero modulo p we return zero. If the input is not valid an exception is thrown.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\n\na = 1 + 7 + 2*7^2 + O(R, 7^3)\nb = 2 + 5*7 + 3*7^2 + O(R, 7^3)\nc = 3*7 + 2*7^2 + O(R, 7^5)\n\nc = exp(c)\nd = log(a)\nc = exp(R(0))\nd = log(R(1))\nf = teichmuller(b)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"complex/#Arbitrary-precision-complex-balls","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Arbitrary precision complex ball arithmetic is supplied by Arb which provides a ball representation which tracks error bounds rigorously. Complex numbers are represented in rectangular form a+bi where ab are arb balls.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The corresponding field is constructed using the ComplexField constructor. This constructs the parent object for the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The types of complex boxes in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Library Field Element type Parent type\nArb mathbbC (boxes) ComplexFieldElem ComplexField","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"All the complex field types belong to the Field abstract type and the types of elements in this field, i.e. complex boxes in this case, belong to the FieldElem abstract type.","category":"page"},{"location":"complex/#Complex-ball-functionality","page":"Arbitrary precision complex balls","title":"Complex ball functionality","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The complex balls in Nemo provide all the field functionality defined by AbstractAlgebra:.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Below, we document the additional functionality provided for complex balls.","category":"page"},{"location":"complex/#Precision-management","page":"Arbitrary precision complex balls","title":"Precision management","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"See Precision management.","category":"page"},{"location":"complex/#Complex-field-constructors","page":"Arbitrary precision complex balls","title":"Complex field constructors","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"In order to construct complex boxes in Nemo, one must first construct the Arb complex field itself. This is accomplished with the following constructor.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"ComplexField(prec::Int)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Here is an example of creating an Arb complex field and using the resulting parent object to coerce values into the resulting field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\n\na = CC(\"0.25\")\nb = CC(\"0.1\")\nc = CC(0.5)\nd = CC(12)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.","category":"page"},{"location":"complex/#Constructors","page":"Arbitrary precision complex balls","title":"Constructors","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"onei(::ComplexField)","category":"page"},{"location":"complex/#Nemo.onei-Tuple{ComplexField}","page":"Arbitrary precision complex balls","title":"Nemo.onei","text":"onei(r::ComplexField)\n\nReturn exact one times i in the given Arb complex field.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\n\nc = onei(CC)","category":"page"},{"location":"complex/#Basic-functionality","page":"Arbitrary precision complex balls","title":"Basic functionality","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The following basic functionality is provided by the default Arb complex field implementation in Nemo, to support construction of generic rings over complex fields. Any custom complex field implementation in Nemo should provide analogues of these functions along with the usual arithmetic operations.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"parent_type(::Type{ComplexFieldElem})","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Gives the type of the parent object of an Arb complex field element.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"elem_type(R::ComplexField)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Given the parent object for an Arb complex field, return the type of elements of the field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"mul!(c::ComplexFieldElem, a::ComplexFieldElem, b::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Multiply a by b and set the existing Arb complex field element c to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"addeq!(c::ComplexFieldElem, a::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"In-place addition adds a to c and sets c to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"deepcopy(a::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Return a copy of the Arb complex field element a, recursively copying the internal data. Arb complex field elements are mutable in Nemo so a shallow copy is not sufficient.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Given the parent object R for an Arb complex field, the following coercion functions are provided to coerce various elements into the Arb complex field. Developers provide these by overloading the call operator for the complex field parent objects.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R()","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce zero into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(n::Integer)\nR(f::ZZRingElem)\nR(q::QQFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce an integer or rational value into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(f::Float64)\nR(f::BigFloat)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce the given floating point number into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(f::AbstractString)\nR(f::AbstractString, g::AbstractString)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce the decimal number, given as a string, into the Arb complex field. In each case f is the real part and g is the imaginary part.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(f::arb)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce the given Arb real ball into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(f::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Take an Arb complex field element that is already in an Arb field and simply return it. A copy of the original is not made.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Here are some examples of coercing elements into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"RR = RealField(64)\nCC = ComplexField(64)\n\na = CC(3)\nb = CC(QQ(2,3))\nc = CC(\"3 +/- 0.0001\")\nd = CC(\"-1.24e+12345\")\nf = CC(\"nan +/- inf\")\ng = CC(RR(3))","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::ComplexField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::ComplexFieldElem) to return the parent object of a complex field element.","category":"page"},{"location":"complex/#Basic-manipulation","page":"Arbitrary precision complex balls","title":"Basic manipulation","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"isfinite(::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.isfinite-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.isfinite","text":"isfinite(x::ComplexFieldElem)\n\nReturn true if x is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"is_exact(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.is_exact-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.is_exact","text":"is_exact(x::ComplexFieldElem)\n\nReturn true if x is exact, i.e. has its real and imaginary parts have zero radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"isinteger(::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.isinteger-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.isinteger","text":"isinteger(x::ComplexFieldElem)\n\nReturn true if x is an exact integer, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"accuracy_bits(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.accuracy_bits-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.accuracy_bits","text":"accuracy_bits(x::ComplexFieldElem)\n\nReturn the relative accuracy of x measured in bits, capped between typemax(Int) and -typemax(Int).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\n\na = CC(\"1.2 +/- 0.001\")\nb = CC(3)\n\nisreal(a)\nisfinite(b)\nisinteger(b)\nc = real(a)\nd = imag(b)\nf = accuracy_bits(a)","category":"page"},{"location":"complex/#Containment","page":"Arbitrary precision complex balls","title":"Containment","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"overlaps(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.overlaps-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.overlaps","text":"overlaps(x::ComplexFieldElem, y::ComplexFieldElem)\n\nReturns true if any part of the box x overlaps any part of the box y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"contains(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.contains-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.contains","text":"contains(x::ComplexFieldElem, y::ComplexFieldElem)\n\nReturns true if the box x contains the box y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"contains(::ComplexFieldElem, ::Integer)\ncontains(::ComplexFieldElem, ::ZZRingElem)\ncontains(::ComplexFieldElem, ::QQFieldElem)","category":"page"},{"location":"complex/#Base.contains-Tuple{ComplexFieldElem, Integer}","page":"Arbitrary precision complex balls","title":"Base.contains","text":"contains(x::ComplexFieldElem, y::Integer)\n\nReturns true if the box x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/#Base.contains-Tuple{ComplexFieldElem, ZZRingElem}","page":"Arbitrary precision complex balls","title":"Base.contains","text":"contains(x::ComplexFieldElem, y::ZZRingElem)\n\nReturns true if the box x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/#Base.contains-Tuple{ComplexFieldElem, QQFieldElem}","page":"Arbitrary precision complex balls","title":"Base.contains","text":"contains(x::ComplexFieldElem, y::QQFieldElem)\n\nReturns true if the box x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The following functions are also provided for determining if a box intersects a certain part of the complex number plane.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"contains_zero(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.contains_zero-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.contains_zero","text":"contains_zero(x::ComplexFieldElem)\n\nReturns true if the box x contains zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"1 +/- 0.001\")\ny = CC(\"3\")\n\noverlaps(x, y)\ncontains(x, y)\ncontains(y, 3)\ncontains(x, ZZ(1)//2)\ncontains_zero(x)","category":"page"},{"location":"complex/#Comparison","page":"Arbitrary precision complex balls","title":"Comparison","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Nemo provides a full range of comparison operations for Arb complex boxes. ","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"isequal(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.isequal-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.isequal","text":"isequal(x::ComplexFieldElem, y::ComplexFieldElem)\n\nReturn true if the boxes x and y are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Function\n==(x::ComplexFieldElem, y::Integer)\n==(x::Integer, y::ComplexFieldElem)\n==(x::ComplexFieldElem, y::ZZRingElem)\n==(x::ZZRingElem, y::ComplexFieldElem)\n==(x::arb, y::ZZRingElem)\n==(x::ZZRingElem, y::arb)\n==(x::ComplexFieldElem, y::Float64)\n==(x::Float64, y::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"1 +/- 0.001\")\ny = CC(\"3\")\nz = CC(\"4\")\n\nisequal(x, deepcopy(x))\nx == 3\nZZ(3) == z\nx != 1.23","category":"page"},{"location":"complex/#Absolute-value","page":"Arbitrary precision complex balls","title":"Absolute value","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"-1 +/- 0.001\")\n\na = abs(x)","category":"page"},{"location":"complex/#Shifting","page":"Arbitrary precision complex balls","title":"Shifting","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"-3 +/- 0.001\")\n\na = ldexp(x, 23)\nb = ldexp(x, -ZZ(15))","category":"page"},{"location":"complex/#Miscellaneous-operations","page":"Arbitrary precision complex balls","title":"Miscellaneous operations","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"trim(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.trim-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.trim","text":"trim(x::ComplexFieldElem)\n\nReturn an acb box containing x but which may be more economical, by rounding off insignificant bits from midpoints.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"unique_integer(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.unique_integer-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.unique_integer","text":"unique_integer(x::ComplexFieldElem)\n\nReturn a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box x contains a unique integer. If this is the case, the second return value is set to this unique integer.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"-3 +/- 0.001\", \"0.1\")\n\na = trim(x)\nb, c = unique_integer(x)\nd = conj(x)\nf = angle(x)","category":"page"},{"location":"complex/#Constants","page":"Arbitrary precision complex balls","title":"Constants","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"const_pi(::ComplexField)","category":"page"},{"location":"complex/#Nemo.const_pi-Tuple{ComplexField}","page":"Arbitrary precision complex balls","title":"Nemo.const_pi","text":"const_pi(r::ComplexField)\n\nReturn pi = 314159ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(200)\n\na = const_pi(CC)","category":"page"},{"location":"complex/#Mathematical-and-special-functions","page":"Arbitrary precision complex balls","title":"Mathematical and special functions","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"rsqrt(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.rsqrt-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.rsqrt","text":"rsqrt(x::ComplexFieldElem)\n\nReturn the reciprocal of the square root of x, i.e. 1sqrtx.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"cispi(::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.cispi-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.cispi","text":"cispi(x::ComplexFieldElem)\n\nReturn the exponential of pi i x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"root_of_unity(::ComplexField, k::Int)","category":"page"},{"location":"complex/#Nemo.root_of_unity-Tuple{ComplexField, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.root_of_unity","text":"root_of_unity(C::ComplexField, k::Int)\n\nReturn exp(2pi ik).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"log_sinpi(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.log_sinpi-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.log_sinpi","text":"log_sinpi(x::ComplexFieldElem)\n\nReturn logsin(pi x), constructed without branch cuts off the real line.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma","text":"gamma(x::ComplexFieldElem)\n\nReturn the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"lgamma(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.lgamma-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.lgamma","text":"lgamma(x::ComplexFieldElem)\n\nReturn the logarithm of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"rgamma(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.rgamma-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.rgamma","text":"rgamma(x::ComplexFieldElem)\n\nReturn the reciprocal of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"digamma(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.digamma-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.digamma","text":"digamma(x::ComplexFieldElem)\n\nReturn the logarithmic derivative of the gamma function evaluated at x, i.e. psi(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"zeta(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.zeta-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.zeta","text":"zeta(x::ComplexFieldElem)\n\nReturn the Riemann zeta function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"barnes_g(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.barnes_g-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.barnes_g","text":"barnes_g(x::ComplexFieldElem)\n\nReturn the Barnes G-function, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"log_barnes_g(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.log_barnes_g-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.log_barnes_g","text":"log_barnes_g(x::ComplexFieldElem)\n\nReturn the logarithm of the Barnes G-function, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"erf(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.erf-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.erf","text":"erf(x::ComplexFieldElem)\n\nReturn the error function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"erfi(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.erfi-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.erfi","text":"erfi(x::ComplexFieldElem)\n\nReturn the imaginary error function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"exp_integral_ei(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.exp_integral_ei-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.exp_integral_ei","text":"exp_integral_ei(x::ComplexFieldElem)\n\nReturn the exponential integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"sin_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.sin_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.sin_integral","text":"sin_integral(x::ComplexFieldElem)\n\nReturn the sine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"cos_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.cos_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.cos_integral","text":"cos_integral(x::ComplexFieldElem)\n\nReturn the exponential cosine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"sinh_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.sinh_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.sinh_integral","text":"sinh_integral(x::ComplexFieldElem)\n\nReturn the hyperbolic sine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"cosh_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.cosh_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.cosh_integral","text":"cosh_integral(x::ComplexFieldElem)\n\nReturn the hyperbolic cosine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"dedekind_eta(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.dedekind_eta-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.dedekind_eta","text":"dedekind_eta(x::ComplexFieldElem)\n\nReturn the Dedekind eta function eta(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_weber_f(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_weber_f-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_weber_f","text":"modular_weber_f(x::ComplexFieldElem)\n\nReturn the modular Weber function mathfrakf(tau) = fraceta^2(tau)eta(tau2)eta(2tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_weber_f1(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_weber_f1-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_weber_f1","text":"modular_weber_f1(x::ComplexFieldElem)\n\nReturn the modular Weber function mathfrakf_1(tau) = fraceta(tau2)eta(tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_weber_f2(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_weber_f2-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_weber_f2","text":"modular_weber_f2(x::ComplexFieldElem)\n\nReturn the modular Weber function mathfrakf_2(tau) = fracsqrt2eta(2tau)eta(tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"j_invariant(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.j_invariant-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.j_invariant","text":"j_invariant(x::ComplexFieldElem)\n\nReturn the j-invariant j(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_lambda(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_lambda-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_lambda","text":"modular_lambda(x::ComplexFieldElem)\n\nReturn the modular lambda function lambda(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_delta(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_delta-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_delta","text":"modular_delta(x::ComplexFieldElem)\n\nReturn the modular delta function Delta(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"eisenstein_g(::Int, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.eisenstein_g-Tuple{Int64, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.eisenstein_g","text":"eisenstein_g(k::Int, x::ComplexFieldElem)\n\nReturn the non-normalized Eisenstein series G_k(tau) of mathrmSL_2(mathbbZ). Also defined for tau = i infty.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hilbert_class_polynomial(::Int, ::ZZPolyRing)","category":"page"},{"location":"complex/#Nemo.hilbert_class_polynomial-Tuple{Int64, ZZPolyRing}","page":"Arbitrary precision complex balls","title":"Nemo.hilbert_class_polynomial","text":"hilbert_class_polynomial(D::Int, R::ZZPolyRing)\n\nReturn in the ring R the Hilbert class polynomial of discriminant D, which is only defined for D 0 and D equiv 0 1 pmod 4.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"elliptic_k(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.elliptic_k-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.elliptic_k","text":"elliptic_k(x::ComplexFieldElem)\n\nReturn the complete elliptic integral K(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"elliptic_e(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.elliptic_e-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.elliptic_e","text":"elliptic_e(x::ComplexFieldElem)\n\nReturn the complete elliptic integral E(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"agm(::ComplexFieldElem)\nagm(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.agm-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.agm","text":"agm(x::ComplexFieldElem)\n\nReturn the arithmetic-geometric mean of 1 and x.\n\n\n\n\n\n","category":"method"},{"location":"complex/#Nemo.agm-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.agm","text":"agm(x::ComplexFieldElem, y::ComplexFieldElem)\n\nReturn the arithmetic-geometric mean of x and y.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"polygamma(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.polygamma-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.polygamma","text":"polygamma(s::ComplexFieldElem, a::ComplexFieldElem)\n\nReturn the generalised polygamma function psi(sz).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"zeta(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.zeta-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.zeta","text":"zeta(s::ComplexFieldElem, a::ComplexFieldElem)\n\nReturn the Hurwitz zeta function zeta(sa).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"rising_factorial(::ComplexFieldElem, ::Int)","category":"page"},{"location":"complex/#Nemo.rising_factorial-Tuple{ComplexFieldElem, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::ComplexFieldElem, n::Int)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an Acb.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"rising_factorial2(::ComplexFieldElem, ::Int)","category":"page"},{"location":"complex/#Nemo.rising_factorial2-Tuple{ComplexFieldElem, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.rising_factorial2","text":"rising_factorial2(x::ComplexFieldElem, n::Int)\n\nReturn a tuple containing the rising factorial x(x + 1)ldots (x + n - 1) and its derivative.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"polylog(::Union{ComplexFieldElem,Int}, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.polylog-Tuple{Union{Int64, ComplexFieldElem}, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.polylog","text":"polylog(s::Union{ComplexFieldElem,Int}, a::ComplexFieldElem)\n\nReturn the polylogarithm Li_s(a).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"log_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.log_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.log_integral","text":"log_integral(x::ComplexFieldElem)\n\nReturn the logarithmic integral, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"log_integral_offset(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.log_integral_offset-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.log_integral_offset","text":"log_integral_offset(x::ComplexFieldElem)\n\nReturn the offset logarithmic integral, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"exp_integral_e(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.exp_integral_e-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.exp_integral_e","text":"exp_integral_e(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the generalised exponential integral E_s(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma","text":"gamma(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the upper incomplete gamma function Gamma(sx).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma_regularized(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma_regularized-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma_regularized","text":"gamma_regularized(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the regularized upper incomplete gamma function Gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma_lower(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma_lower-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma_lower","text":"gamma_lower(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma_lower_regularized(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma_lower_regularized-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma_lower_regularized","text":"gamma_lower_regularized(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the regularized lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"airy_ai(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.airy_ai-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.airy_ai","text":"airy_ai(x::ComplexFieldElem)\n\nReturn the Airy function operatornameAi(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"airy_ai_prime(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.airy_ai_prime-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.airy_ai_prime","text":"airy_ai_prime(x::ComplexFieldElem)\n\nReturn the derivative of the Airy function operatornameAi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"airy_bi(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.airy_bi-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.airy_bi","text":"airy_bi(x::ComplexFieldElem)\n\nReturn the Airy function operatornameBi(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"airy_bi_prime(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.airy_bi_prime-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.airy_bi_prime","text":"airy_bi_prime(x::ComplexFieldElem)\n\nReturn the derivative of the Airy function operatornameBi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"bessel_j(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.bessel_j-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.bessel_j","text":"bessel_j(nu::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the Bessel function J_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"bessel_y(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.bessel_y-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.bessel_y","text":"bessel_y(nu::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the Bessel function Y_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"bessel_i(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.bessel_i-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.bessel_i","text":"bessel_i(nu::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the Bessel function I_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"bessel_k(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.bessel_k-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.bessel_k","text":"bessel_k(nu::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the Bessel function K_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hypergeometric_1f1(::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.hypergeometric_1f1-Tuple{ComplexFieldElem, ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.hypergeometric_1f1","text":"hypergeometric_1f1(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the confluent hypergeometric function _1F_1(abx).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hypergeometric_1f1_regularized(::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.hypergeometric_1f1_regularized-Tuple{ComplexFieldElem, ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.hypergeometric_1f1_regularized","text":"hypergeometric_1f1_regularized(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the regularized confluent hypergeometric function _1F_1(abx) Gamma(b).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hypergeometric_u(::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.hypergeometric_u-Tuple{ComplexFieldElem, ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.hypergeometric_u","text":"hypergeometric_u(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the confluent hypergeometric function U(abx).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hypergeometric_2f1(::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.hypergeometric_2f1-NTuple{4, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.hypergeometric_2f1","text":"hypergeometric_2f1(a::ComplexFieldElem, b::ComplexFieldElem, c::ComplexFieldElem, x::ComplexFieldElem; flags=0)\n\nReturn the Gauss hypergeometric function _2F_1(abcx).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"jacobi_theta(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.jacobi_theta-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.jacobi_theta","text":"jacobi_theta(z::ComplexFieldElem, tau::ComplexFieldElem)\n\nReturn a tuple of four elements containing the Jacobi theta function values theta_1 theta_2 theta_3 theta_4 evaluated at z tau.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"weierstrass_p(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.weierstrass_p-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.weierstrass_p","text":"weierstrass_p(z::ComplexFieldElem, tau::ComplexFieldElem)\n\nReturn the Weierstrass elliptic function wp(ztau).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\n\ns = CC(1, 2)\nz = CC(\"1.23\", \"3.45\")\n\na = sin(z)^2 + cos(z)^2\nb = zeta(z)\nc = bessel_j(s, z)\nd = hypergeometric_1f1(s, s+1, z)","category":"page"},{"location":"complex/#Linear-dependence","page":"Arbitrary precision complex balls","title":"Linear dependence","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"lindep(::Vector{ComplexFieldElem}, n::Int)","category":"page"},{"location":"complex/#Nemo.lindep-Tuple{Vector{ComplexFieldElem}, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.lindep","text":"lindep(A::Vector{ComplexFieldElem}, bits::Int)\n\nFind a small linear combination of the entries of the array A that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"lindep(A::Matrix{ComplexFieldElem}, bits::Int)","category":"page"},{"location":"complex/#Nemo.lindep-Tuple{Matrix{ComplexFieldElem}, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.lindep","text":"lindep(A::Matrix{ComplexFieldElem}, bits::Int)\n\nFind a (common) small linear combination of the entries in each row of the array A, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(128)\n\n# These are two of the roots of x^5 + 3x + 1\na = CC(1.0050669478588622428791051888364775253, - 0.93725915669289182697903585868761513585)\nb = CC(-0.33198902958450931620250069492231652319)\n\n# We recover the polynomial from one root....\nV1 = [CC(1), a, a^2, a^3, a^4, a^5];\nW = lindep(V1, 20)\n\n# ...or from two\nV2 = [CC(1), b, b^2, b^3, b^4, b^5];\nVs = [V1 V2]\nX = lindep(Vs, 20)","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"finitefield/#Finite-fields","page":"Finite fields","title":"Finite fields","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Finite fields are provided in Nemo by Flint. This allows construction of finite fields of any characteristic and degree for which there are Conway polynomials. It is also possible for the user to specify their own irreducible polynomial generating a finite field.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Finite fields are constructed using the FlintFiniteField function. However, for convenience we define","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"FiniteField = FlintFiniteField","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"so that finite fields can be constructed using FiniteField rather than FlintFiniteField. Note that this is the name of the constructor, but not of finite field type.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"The types of finite field elements in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Library Field Element type Parent type\nFlint mathbbF_p^n (small p) fqPolyRepFieldElem fqPolyRepField\nFlint mathbbF_p^n (large p) FqPolyRepFieldElem FqPolyRepField","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"The only difference between the FqPolyRepFieldElem and fqPolyRepFieldElem types is the representation. The former is for finite fields with multiprecision characteristic and the latter is for characteristics that fit into a single unsigned machine word. The FlintFiniteField constructor automatically picks the correct representation for the user, and so the average user doesn't need to know about the actual types.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"All the finite field types belong to the FinField abstract type and the finite field element types belong to the FinFieldElem abstract type.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Since all the functionality for the FqPolyRepFieldElem finite field type is identical to that provided for the fqPolyRepFieldElem finite field type, we simply document the former.","category":"page"},{"location":"finitefield/#Finite-field-functionality","page":"Finite fields","title":"Finite field functionality","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Finite fields in Nemo provide all the field functionality described in AbstractAlgebra:","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Below we describe the functionality that is provided in addition to this.","category":"page"},{"location":"finitefield/#Constructors","page":"Finite fields","title":"Constructors","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"In order to construct finite field elements in Nemo, one must first construct the finite field itself. This is accomplished with one of the following constructors.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"FlintFiniteField","category":"page"},{"location":"finitefield/#Nemo.FlintFiniteField","page":"Finite fields","title":"Nemo.FlintFiniteField","text":"FlintFiniteField(char::ZZRingElem, deg::Int, s::VarName; cached = true)\n\nReturns a tuple S x consisting of a finite field parent object S and generator x for the finite field of the given characteristic and degree. The string s is used to designate how the finite field generator will be printed. The characteristic must be prime. When a Conway polynomial is known, the field is generated using the Conway polynomial. Otherwise a random sparse, irreducible polynomial is used. The generator of the field is guaranteed to be a multiplicative generator only if the field is generated by a Conway polynomial. We require the degree to be positive.\n\n\n\n\n\nFlintFiniteField(pol::Union{ZZModPolyRingElem, FpPolyRingElem}, s::VarName; cached = true, check = true)\n\nReturns a tuple S x consisting of a finite field parent object S and generator x for the finite field over F_p defined by the given polynomial, i.e. mathbbF_pt(pol). The characteristic is specified by the modulus of pol. The polynomial is required to be irreducible, but this is not checked. The base ring of the polynomial is required to be a field, which is checked by default. Use check = false to disable the check. The string s is used to designate how the finite field generator will be printed. The generator will not be multiplicative in general.\n\n\n\n\n\nFlintFiniteField(F::FqPolyRepField, deg::Int, s::VarName; cached = true)\n\nReturn a finite field with the same type as F but with a possibly different degree deg over the prime subfield.\n\n\n\n\n\n","category":"function"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Here are some examples of creating finite fields and making use of the resulting parent objects to coerce various elements into those fields.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Examples","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"julia> R, x = FiniteField(7, 3, \"x\")\n(Finite field of degree 3 over GF(7), x)\n\njulia> S, y = FiniteField(ZZ(12431351431561), 2, \"y\")\n(Finite field of degree 2 over GF(12431351431561), y)\n\njulia> T, t = polynomial_ring(residue_ring(ZZ, 12431351431561), \"t\")\n(Univariate polynomial ring in t over ZZ/(12431351431561), t)\n\njulia> U, z = FiniteField(t^2 + 7, \"z\")\n(Finite field of degree 2 over GF(12431351431561), z)\n\njulia> a = R(5)\n5\n\njulia> b = R(x)\nx\n\njulia> c = S(ZZ(11))\n11\n\njulia> d = U(7)\n7","category":"page"},{"location":"finitefield/#Basic-manipulation","page":"Finite fields","title":"Basic manipulation","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"gen(::FqPolyRepField)","category":"page"},{"location":"finitefield/#AbstractAlgebra.gen-Tuple{FqPolyRepField}","page":"Finite fields","title":"AbstractAlgebra.gen","text":"gen(a::FqPolyRepField)\n\nReturn the generator of the finite field. Note that this is only guaranteed to be a multiplicative generator if the finite field is generated by a Conway polynomial automatically.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"is_gen(::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#AbstractAlgebra.is_gen-Tuple{FqPolyRepFieldElem}","page":"Finite fields","title":"AbstractAlgebra.is_gen","text":"is_gen(a::FqPolyRepFieldElem)\n\nReturn true if the given finite field element is the generator of the finite field, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"coeff(::FqPolyRepFieldElem, ::Int)","category":"page"},{"location":"finitefield/#AbstractAlgebra.coeff-Tuple{FqPolyRepFieldElem, Int64}","page":"Finite fields","title":"AbstractAlgebra.coeff","text":"coeff(x::FqPolyRepFieldElem, n::Int)\n\nReturn the degree n coefficient of the polynomial representing the given finite field element.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"degree(::FqPolyRepField)","category":"page"},{"location":"finitefield/#AbstractAlgebra.degree-Tuple{FqPolyRepField}","page":"Finite fields","title":"AbstractAlgebra.degree","text":"degree(a::FqPolyRepField)\n\nReturn the degree of the given finite field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"modulus(::FqPolyRepField)","category":"page"},{"location":"finitefield/#AbstractAlgebra.modulus-Tuple{FqPolyRepField}","page":"Finite fields","title":"AbstractAlgebra.modulus","text":"modulus(k::FqPolyRepField, var::VarName=:T)\n\nReturn the modulus defining the finite field k.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Examples","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"julia> R, x = FiniteField(ZZ(7), 5, \"x\")\n(Finite field of degree 5 over GF(7), x)\n\njulia> c = gen(R)\nx\n\njulia> d = characteristic(R)\n7\n\njulia> f = order(R)\n16807\n\njulia> g = degree(R)\n5\n\njulia> n = is_gen(x)\ntrue","category":"page"},{"location":"finitefield/#Special-functions","page":"Finite fields","title":"Special functions","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Various special functions with finite field specific behaviour are defined.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"tr(::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#LinearAlgebra.tr-Tuple{FqPolyRepFieldElem}","page":"Finite fields","title":"LinearAlgebra.tr","text":"tr(x::FqPolyRepFieldElem)\n\nReturn the trace of x. This is an element of mathbbF_p, but the value returned is this value embedded in the original finite field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"norm(::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#LinearAlgebra.norm-Tuple{FqPolyRepFieldElem}","page":"Finite fields","title":"LinearAlgebra.norm","text":"norm(x::FqPolyRepFieldElem)\n\nReturn the norm of x. This is an element of mathbbF_p, but the value returned is this value embedded in the original finite field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"frobenius(::FqPolyRepFieldElem, ::Int)","category":"page"},{"location":"finitefield/#Nemo.frobenius-Tuple{FqPolyRepFieldElem, Int64}","page":"Finite fields","title":"Nemo.frobenius","text":"frobenius(x::FqPolyRepFieldElem, n = 1)\n\nReturn the iterated Frobenius sigma_p^n(x) where sigma_p is the Frobenius map sending the element a to a^p in the finite field of characteristic p. By default the Frobenius map is applied n = 1 times if n is not specified.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"pth_root(::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#Nemo.pth_root-Tuple{FqPolyRepFieldElem}","page":"Finite fields","title":"Nemo.pth_root","text":"pth_root(x::FqPolyRepFieldElem)\n\nReturn the p-th root of x in the finite field of characteristic p. This is the inverse operation to the Frobenius map sigma_p.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Examples","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"julia> R, x = FiniteField(ZZ(7), 5, \"x\")\n(Finite field of degree 5 over GF(7), x)\n\njulia> a = x^4 + 3x^2 + 6x + 1\nx^4 + 3*x^2 + 6*x + 1\n\njulia> b = tr(a)\n1\n\njulia> c = norm(a)\n4\n\njulia> d = frobenius(a)\nx^4 + 2*x^3 + 3*x^2 + 5*x + 1\n\njulia> f = frobenius(a, 3)\n3*x^4 + 3*x^3 + 3*x^2 + x + 4\n\njulia> g = pth_root(a)\n4*x^4 + 3*x^3 + 4*x^2 + 5*x + 2","category":"page"},{"location":"finitefield/#Lift","page":"Finite fields","title":"Lift","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"lift(::FpPolyRing, ::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#AbstractAlgebra.lift-Tuple{FpPolyRing, FqPolyRepFieldElem}","page":"Finite fields","title":"AbstractAlgebra.lift","text":"lift(R::FpPolyRing, x::FqPolyRepFieldElem)\n\nLift the finite field element x to a polynomial over the prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Examples","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"julia> R, x = FiniteField(23, 2, \"x\")\n(Finite field of degree 2 over GF(23), x)\n\njulia> S, y = polynomial_ring(GF(23), \"y\")\n(Univariate polynomial ring in y over GF(23), y)\n\njulia> f = 8x + 9\n8*x + 9\n\njulia> lift(S, f)\n8*y + 9","category":"page"},{"location":"finitefield/#Uniform-finite-fields","page":"Finite fields","title":"Uniform finite fields","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"An (experimental) uniform finite field interface is provided by the type FqField. Such a finite field can be constructed as an extension of a prime field mathbfF_p (an absolute extension) or of another finite field (a relative extension). The field over which the extension is constructed is referred to as the base field and field theoretic properties like the degree of an extension or the trace of an element are understood with respect to the base field. The corresponding functionality for the implicit absolute extension over the prime field is available by methods with the prefix absolute_.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Note that all finite fields are simple extension kt(f) of their base field k. The irreducible polynomial f in kt is the defining polynomial and the class of t is referred to as the generator of the extension.","category":"page"},{"location":"finitefield/#Construction-of-finite-fields","page":"Finite fields","title":"Construction of finite fields","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Nemo._FiniteField\nNemo._GF","category":"page"},{"location":"finitefield/#Nemo._FiniteField","page":"Finite fields","title":"Nemo._FiniteField","text":"_FiniteField(q::IntegerUnion, s::String; cached::Bool, check::Bool)\n_FiniteField(p::IntegerUnion, d::Int, s::String; cached::Bool, check::Bool)\n_FiniteField(f::FqPolyRingElem; s::String; cached::Bool, check::Bool)\n\nReturn a tuple S x consisting of a finite field S of order q = p^d and algebra generator x. The string s is used to designate how the finite field generator will be printed.\n\nIf a polynomial f in kt over a finite field k is specified, the finite field S = kt(f) will be constructed as a finite field with base field k.\n\n\n\n\n\n","category":"function"},{"location":"finitefield/#Nemo._GF","page":"Finite fields","title":"Nemo._GF","text":"_GF(q::IntegerUnion, s::String; cached::Bool, check::Bool)\n_GF(p::IntegerUnion, d::Int, s::String; cached::Bool, check::Bool)\n_GF(f::FqPolyRingElem; s::String; cached::Bool, check::Bool)\n\nReturn a finite field S of order q = p^d. The string s is used to designate how the finite field generator will be printed.\n\nIf a polynomial f in kt over a finite field k is specified, the finite field S = kt(f) will be constructed as a finite field with base field k.\n\n\n\n\n\n","category":"function"},{"location":"finitefield/#Field-properties","page":"Finite fields","title":"Field properties","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"base_field(::FqField)\nprime_field(::FqField)\ndegree(::FqField)\nabsolute_degree(::FqField)\nis_absolute(::FqField)\ndefining_polynomial(::FqPolyRing, ::FqField)","category":"page"},{"location":"finitefield/#AbstractAlgebra.Generic.base_field-Tuple{FqField}","page":"Finite fields","title":"AbstractAlgebra.Generic.base_field","text":"base_field(F::FqField)\n\nReturn the base field of F.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.prime_field-Tuple{FqField}","page":"Finite fields","title":"Nemo.prime_field","text":"prime_field(F::FqField)\n\nReturn the prime field of F.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#AbstractAlgebra.degree-Tuple{FqField}","page":"Finite fields","title":"AbstractAlgebra.degree","text":"degree(a::FqField)\n\nReturn the degree of the given finite field over the base field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.absolute_degree-Tuple{FqField}","page":"Finite fields","title":"Nemo.absolute_degree","text":"absolute_degree(a::FqField)\n\nReturn the degree of the given finite field over the prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.is_absolute-Tuple{FqField}","page":"Finite fields","title":"Nemo.is_absolute","text":"is_absolute(F::FqField)\n\nReturn whether the base field of F is a prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#AbstractAlgebra.Generic.defining_polynomial-Tuple{FqPolyRing, FqField}","page":"Finite fields","title":"AbstractAlgebra.Generic.defining_polynomial","text":"defining_polynomial([R::FqPolyRing], L::FqField)\n\nReturn the defining polynomial of L as a polynomial over the base field of L.\n\nIf the polynomial ring R is specified, the polynomial will be an element of R.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Element-properties","page":"Finite fields","title":"Element properties","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"tr(::FqFieldElem)\nabsolute_tr(::FqFieldElem)\nnorm(::FqFieldElem)\nabsolute_norm(::FqFieldElem)\nlift(::FqPolyRing, ::FqFieldElem)","category":"page"},{"location":"finitefield/#LinearAlgebra.tr-Tuple{FqFieldElem}","page":"Finite fields","title":"LinearAlgebra.tr","text":"tr(x::FqFieldElem)\n\nReturn the trace of x. This is an element of the base field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.absolute_tr-Tuple{FqFieldElem}","page":"Finite fields","title":"Nemo.absolute_tr","text":"absolute_tr(x::FqFieldElem)\n\nReturn the absolute trace of x. This is an element of the prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#LinearAlgebra.norm-Tuple{FqFieldElem}","page":"Finite fields","title":"LinearAlgebra.norm","text":"norm(x::FqFieldElem)\n\nReturn the norm of x. This is an element of the base field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.absolute_norm-Tuple{FqFieldElem}","page":"Finite fields","title":"Nemo.absolute_norm","text":"absolute_norm(x::FqFieldElem)\n\nReturn the absolute norm of x. This is an element of the prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#AbstractAlgebra.lift-Tuple{FqPolyRing, FqFieldElem}","page":"Finite fields","title":"AbstractAlgebra.lift","text":"lift(R::FqPolyRing, a::FqFieldElem) -> FqPolyRingElem\n\nGiven a polynomial ring over the base field of the parent of a, return a lift such that parent(a)(lift(R, a)) == a is true.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"fraction/#Fraction-fields","page":"Fraction fields","title":"Fraction fields","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Nemo allows the creation of fraction fields over any ring R. We don't require R to be an integral domain, however no attempt is made to deal with the general case. Two fractions ab and cd are equal in Nemo iff ad = bc. Thus, in practice, a greatest common divisor function is currently required for the ring R.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"In order to make the representation ab unique for printing, we have a notion of canonical unit for elements of a ring R. When canonicalising ab, each of the elements a and b is first divided by the canonical unit of b.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The canonical_unit function is defined for elements of every Nemo ring. It must have the properties","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"canonical_unit(u) == u\ncanonical_unit(a*b) == canonical_unit(a)*canonical_unit(b)","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"for any unit u of the ring in question, and a and b arbitrary elements of the ring.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"For example, the canonical unit of an integer is its sign. Thus a fraction of integers always has positive denominator after canonicalisation.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The canonical unit of a polynomial is the canonical unit of its leading coefficient, etc.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"There are two different kinds of implementation of fraction fields in Nemo: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of fractions over specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The following table shows each of the fraction types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of fraction (the type information is mainly of concern to developers).","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.Frac{T} Generic.FracField{T}\nmathbbZ Flint QQFieldElem QQField","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"All fraction element types belong to the abstract type FracElem and all of the fraction field types belong to the abstract type FracField. This enables one to write generic functions that can accept any Nemo fraction type.","category":"page"},{"location":"fraction/#Fraction-functionality","page":"Fraction fields","title":"Fraction functionality","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"All fraction types in Nemo provide functionality for fields described in AbstractAlgebra.jl:","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"In addition all the fraction field functionality of AbstractAlgebra.jl is provided, along with generic fractions fields as described here:","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/fraction","category":"page"},{"location":"fraction/#Basic-manipulation","page":"Fraction fields","title":"Basic manipulation","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"sign(::QQFieldElem)","category":"page"},{"location":"fraction/#Base.sign-Tuple{QQFieldElem}","page":"Fraction fields","title":"Base.sign","text":"sign(a::QQFieldElem)\n\nReturn the sign of a (-1, 0 or 1) as a fraction.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"height(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.height-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.height","text":"height(a::QQFieldElem)\n\nReturn the height of the fraction a, namely the largest of the absolute values of the numerator and denominator.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"height_bits(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.height_bits-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.height_bits","text":"height_bits(a::QQFieldElem)\n\nReturn the number of bits of the height of the fraction a.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"<<(::QQFieldElem, ::Int)","category":"page"},{"location":"fraction/#Base.:<<-Tuple{QQFieldElem, Int64}","page":"Fraction fields","title":"Base.:<<","text":"<<(a::QQFieldElem, b::Int)\n\nReturn a times 2^b.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":">>(::QQFieldElem, ::Int)","category":"page"},{"location":"fraction/#Base.:>>-Tuple{QQFieldElem, Int64}","page":"Fraction fields","title":"Base.:>>","text":">>(a::QQFieldElem, b::Int)\n\nReturn a2^b.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"floor(::QQFieldElem)\nceil(::QQFieldElem)","category":"page"},{"location":"fraction/#Base.floor-Tuple{QQFieldElem}","page":"Fraction fields","title":"Base.floor","text":"floor(a::QQFieldElem)\n\nReturn the greatest integer that is less than or equal to a. The result is returned as a rational with denominator 1.\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Base.ceil-Tuple{QQFieldElem}","page":"Fraction fields","title":"Base.ceil","text":"ceil(a::QQFieldElem)\n\nReturn the least integer that is greater than or equal to a. The result is returned as a rational with denominator 1.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Examples","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"julia> d = abs(ZZ(11)//3)\n11//3\n\njulia> 4 <= ZZ(7)//ZZ(3)\nfalse","category":"page"},{"location":"fraction/#Modular-arithmetic","page":"Fraction fields","title":"Modular arithmetic","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The following functions are available for rationals.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"mod(a::QQFieldElem, b::ZZRingElem)","category":"page"},{"location":"fraction/#Base.mod-Tuple{QQFieldElem, ZZRingElem}","page":"Fraction fields","title":"Base.mod","text":"mod(a::QQFieldElem, b::ZZRingElem)\nmod(a::QQFieldElem, b::Integer)\n\nReturn a pmodb where b is an integer coprime to the denominator of a.\n\nExamples\n\njulia> mod(-ZZ(2)//3, 7)\n4\n\njulia> mod(ZZ(1)//2, ZZ(5))\n3\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Rational-Reconstruction","page":"Fraction fields","title":"Rational Reconstruction","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Rational reconstruction is available for rational numbers.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"reconstruct(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"fraction/#Nemo.reconstruct-Tuple{ZZRingElem, ZZRingElem}","page":"Fraction fields","title":"Nemo.reconstruct","text":"reconstruct(a::ZZRingElem, b::ZZRingElem)\nreconstruct(a::ZZRingElem, b::Integer)\nreconstruct(a::Integer, b::ZZRingElem)\nreconstruct(a::Integer, b::Integer)\n\nAttempt to return a rational number nd such that 0 leq n leq lfloorsqrtm2rfloor and 0 d leq lfloorsqrtm2rfloor such that gcd(n d) = 1 and a equiv nd^-1 pmodm. If no solution exists, an exception is thrown.\n\nExamples\n\njulia> a = reconstruct(7, 13)\n1//2\n\njulia> b = reconstruct(ZZ(15), 31)\n-1//2\n\njulia> c = reconstruct(ZZ(123), ZZ(237))\n9//2\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Rational-enumeration","page":"Fraction fields","title":"Rational enumeration","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Various methods exist to enumerate rationals.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"next_minimal(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.next_minimal-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.next_minimal","text":"next_minimal(a::QQFieldElem)\n\nGiven a, return the next rational number in the sequence obtained by enumerating all positive denominators q, and for each q enumerating the numerators 1 le p q in order and generating both pq and qp, but skipping all gcd(pq) neq 1. Starting with zero, this generates every nonnegative rational number once and only once, with the first few entries being 0 1 12 2 13 3 23 32 14 4 34 43 ldots. This enumeration produces the rational numbers in order of minimal height. It has the disadvantage of being somewhat slower to compute than the Calkin-Wilf enumeration. If a 0 we throw a DomainError().\n\nExamples\n\njulia> next_minimal(ZZ(2)//3)\n3//2\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"next_signed_minimal(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.next_signed_minimal-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.next_signed_minimal","text":"next_signed_minimal(a::QQFieldElem)\n\nGiven a signed rational number a assumed to be in canonical form, return the next element in the minimal-height sequence generated by next_minimal but with negative numbers interleaved. The sequence begins 0 1 -1 12 -12 2 -2 13 -13 ldots. Starting with zero, this generates every rational number once and only once, in order of minimal height.\n\nExamples\n\njulia> next_signed_minimal(-ZZ(21)//31)\n31//21\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"next_calkin_wilf(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.next_calkin_wilf-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.next_calkin_wilf","text":"next_calkin_wilf(a::QQFieldElem)\n\nReturn the next number after a in the breadth-first traversal of the Calkin-Wilf tree. Starting with zero, this generates every nonnegative rational number once and only once, with the first few entries being 0 1 12 2 13 32 23 3 14 43 35 52 25 ldots. Despite the appearance of the initial entries, the Calkin-Wilf enumeration does not produce the rational numbers in order of height: some small fractions will appear late in the sequence. This order has the advantage of being faster to produce than the minimal-height order.\n\nExamples\n\njulia> next_calkin_wilf(ZZ(321)//113)\n113//244\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"next_signed_calkin_wilf(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.next_signed_calkin_wilf-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.next_signed_calkin_wilf","text":"next_signed_calkin_wilf(a::QQFieldElem)\n\nGiven a signed rational number a returns the next element in the Calkin-Wilf sequence with negative numbers interleaved. The sequence begins 0 1 -1 12 -12 2 -2 13 -13 ldots. Starting with zero, this generates every rational number once and only once, but not in order of minimal height.\n\nExamples\n\njulia> next_signed_calkin_wilf(-ZZ(51)//(17))\n1//4\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Random-generation","page":"Fraction fields","title":"Random generation","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"rand_bits(::QQField, b::Int)","category":"page"},{"location":"fraction/#Nemo.rand_bits-Tuple{QQField, Int64}","page":"Fraction fields","title":"Nemo.rand_bits","text":"rand_bits(::QQField, b::Int)\n\nReturn a random signed rational whose numerator and denominator both have b bits before canonicalisation. Note that the resulting numerator and denominator can be smaller than b bits.\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Special-functions","page":"Fraction fields","title":"Special functions","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The following special functions are available for specific rings in Nemo.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"harmonic(::Int)","category":"page"},{"location":"fraction/#Nemo.harmonic-Tuple{Int64}","page":"Fraction fields","title":"Nemo.harmonic","text":"harmonic(n::Int)\n\nReturn the harmonic number H_n = 1 + 12 + 13 + cdots + 1n. Table lookup is used for H_n whose numerator and denominator fit in a single limb. For larger n, a divide and conquer strategy is used.\n\nExamples\n\njulia> a = harmonic(12)\n86021//27720\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"bernoulli(::Int)","category":"page"},{"location":"fraction/#Nemo.bernoulli-Tuple{Int64}","page":"Fraction fields","title":"Nemo.bernoulli","text":"bernoulli(n::Int)\n\nReturn the Bernoulli number B_n for nonnegative n.\n\nSee also bernoulli_cache.\n\nExamples\n\njulia> d = bernoulli(12)\n-691//2730\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"bernoulli_cache(::Int)","category":"page"},{"location":"fraction/#Nemo.bernoulli_cache-Tuple{Int64}","page":"Fraction fields","title":"Nemo.bernoulli_cache","text":"bernoulli_cache(n::Int)\n\nPrecomputes and caches all the Bernoulli numbers up to B_n. This is much faster than repeatedly calling bernoulli(k). Once cached, subsequent calls to bernoulli(k) for any k le n will read from the cache, making them virtually free.\n\nSee also bernoulli.\n\nExamples\n\njulia> bernoulli_cache(100)\n\njulia> e = bernoulli(100)\n-94598037819122125295227433069493721872702841533066936133385696204311395415197247711//33330\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"dedekind_sum(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"fraction/#Nemo.dedekind_sum-Tuple{ZZRingElem, ZZRingElem}","page":"Fraction fields","title":"Nemo.dedekind_sum","text":"dedekind_sum(h::ZZRingElem, k::ZZRingElem)\n\nReturn the Dedekind sum s(hk) for arbitrary h and k.\n\nExamples\n\njulia> b = dedekind_sum(12, 13)\n-11//13\n\njulia> c = dedekind_sum(-120, ZZ(1305))\n-575//522\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"simplest_between(::QQFieldElem, ::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.simplest_between-Tuple{QQFieldElem, QQFieldElem}","page":"Fraction fields","title":"Nemo.simplest_between","text":" simplest_between(l::QQFieldElem, r::QQFieldElem)\n\nReturn the simplest fraction in the closed interval l r. A canonical fraction a_1 b_1 is defined to be simpler than a_2 b_2 if and only if b_1 b_2 or b_1 = b_2 and a_1 a_2.\n\nExamples\n\njulia> simplest_between(QQ(1//10), QQ(3//10))\n1//4\n\n\n\n\n\n","category":"method"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/introduction/#Introduction-to-Nemo-development","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"","category":"section"},{"location":"developer/introduction/#Relationship-to-AbstractAlgebra.jl","page":"Introduction to Nemo development","title":"Relationship to AbstractAlgebra.jl","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Some time in the past, Nemo was split into two packages called Nemo.jl and AbstractAlgebra.jl. The purpose was to provide a Julia only package which did some subset of what Nemo could do, albeit slower. This was requested by people in the Julia community.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Unfortunately this hasn't been terribly successful. Most Julia developers expect that AbstractAlgebra and Nemo functionality will work for Julia matrices over AbstractAlgebra/Nemo rings. This would be possible for functions that do not conflict with Base or LinearAlgebra at least when working with non-empty matrices. However, for reasons that we explain in both the Appendix to the AbstractAlgebra package and in the parent object section of the developer documentation, this is not possible even in theory for functions that would conflict with Julia's standard library or for empty matrices (except in a limited number of special cases).","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Unfortunately the Julia standard library functions do not work with matrices of Nemo objects and there is little we can do about this. Moreover, some Julia functionality isn't supported by the underlying C libraries in Nemo and would be difficult or impossible to provide on the C side.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Nowadays we see AbstractAlgebra to provide three things to Nemo:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"An abstract type hierarchy\nGeneric ring constructions, e.g. generic polynomials and matrices\nGeneric implementations that should work for any ring implementing the required interfaces. These interfaces are documented in the AbstractAlgebra documentation.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Nemo itself is now more or less just a wrapper of four C libraries:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Flint : polynomials and matrices over Z, Q, Z/nZ, Qp, Fq\nArb : polynomials, matrices and special functions over balls over R and C\nAntic : algebraic number field element arithmetic\nCalcium : exact real and complex numbers, including algebraic numbers","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Each ring implemented in those C libraries is wrapped in such a way as to implement the interfaces described by AbstractAlgebra.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Most of the time an AbstractAlgebra implementation will work just as well using Nemo, but the latter will usually be faster, due to the extremely performant C code (around half a million lines of it).","category":"page"},{"location":"developer/introduction/#Layout-of-files","page":"Introduction to Nemo development","title":"Layout of files","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the src directory of Nemo are four directories flint, arb, antic and calcium, each containing the wrappers for the relevant C libraries. The test directory is similarly organised.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Within each of these directories is a set of files, one per module within the C libraries, e.g. the fmpz.jl file wraps the Flint fmpz module for multiple precision integers. The fmpz_poly.jl file wraps the Flint univariate polynomials over fmpz integers, and so on.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The QQFieldElem prefix is for Flint rationals, FqPolyRepFieldElem for Flint finite fields with multiprecision characteristic, fqPolyRepFieldElem is the same but for single word characteristic. The padic prefix is for the field of p-adic numbers for a given p. The zzModRingElem prefix is for Z/nZ for a given n. The gfp prefix is the same as Z/nZ but where n is prime, so that we are dealing with a field.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The FlintTypes.jl file contains the implementation of all the Flint types.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the antic directory, nf_elem is for elements of a number field.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The AnticTypes.jl file contains the Antic types.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the arb directory the arb prefix is for arbitrary precision ball arithmetic over the reals. The acb prefix is similar but for complex numbers.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The ArbTypes.jl file contains the Arb types.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the calcium directory the ca prefix is for Calcium's type. There is also a qqbar file for the field of algebraic numbers.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the AbstractAlgebra.jl package the src directory contains a directory called generic. This is where the implementations of generic types, such as matrices, polynomials, series, etc. reside. Each file such as Matrix.jl corresponds to a generic group/ring/field or other algebraic construction (typically over a base ring). The files in this directory exist inside a submodule of AbstractAlgebra called Generic.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The file GenericTypes.jl is where all the generic types are implemented.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"At the top level of the src directory is a file Generic.jl which is where the Generic submodule of AbstractAlgebra begins and where imports are made from AbstractAlgebra into Generic.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the src directory we have implementations that work for every type belonging to a given abstract type, e.g. Matrix.jl has implementations that will work for any matrix type, whether from AbstractAlgebra's Generic module or even matrix types from Nemo, and so on. So long as they are implemented to provide the Matrix interface all the functions there will work for them. The same applies for Poly.jl for polynomial types, AbsSeries.jl for absolute series types, RelSeries.jl for relative series types, etc.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the src directory is AbstractTypes.jl where all the AbstractAlgebra abstract types are defined.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Also in the src directory is a subdirectory called Julia. This is where we give our own implementations of functionality for Julia Integers and Rationals and various other basic rings implemented in terms of Julia types. These are provided so that the package will work as a pure Julia package, replacing many of the rings and fields that would be available in Flint and the other C libraries with Julia equivalents.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Note that some of the implementations we give there would conflict with Base and so are only available inside AbstractAlgebra and are not exported!","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"We try to keep the test directory at the top level of the source tree organised in the same manner as the other directories just discussed, though there is currently no split between tests for Generic and for the implementations in src. All tests are currently combined in test/generic..","category":"page"},{"location":"developer/introduction/#Git,-GitHub-and-project-workflows","page":"Introduction to Nemo development","title":"Git, GitHub and project workflows","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The official repositories for AbstractAlgebra and Nemo are:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://github.com/Nemocas/AbstractAlgebra.jl","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://github.com/Nemocas/Nemo.jl","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"If you wish to contribute to these projects, the first step is to fork them on GitHub. The button for this is in the upper right of the main project page. You will need to sign up for a free GitHub account to do this.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Once you have your own GitHub copy of our repository you can push changes to it from your local machine and this will make them visible to the world.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Before sinking a huge amount of time into a contribution, please open a ticket on the official project page on GitHub explaining what you intend to do and discussing it with the other developers.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The easiest way to get going with development on your local machine is to dev AbstractAlgebra and/or Nemo. To do this, press the ] key in Julia to enter the special package mode and type:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"dev Nemo","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Now you will find a local copy on your machine of the Nemo repository in","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":".julia/dev/Nemo","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"However, this will be set up to push to the official repository instead of your own, so you will need to change this. For example, if your GitHub account name is myname, edit the .git/config file in your local Nemo directory to say:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":" url = https://github.com/Nemocas/Nemo.jl.git\n pushurl = https://github.com/myname/Nemo.jl","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"instead of just the first line which will already be there.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"It is highly recommended that you do not work in the master branch, but create a new branch for each thing you want to contribute to Nemo.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"git checkout -b mynewbranch","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"If your contribution is small and does not take a long time to implement, everything will likely be fine if you simply commit the changes locally, then push them to your GitHub account online:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"git commit -a\ngit push --all","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"However, if you are working on a much larger project it is highly recommended that you frequently pull from the official master branch and rebase your new branch on top of any changes that have been made there:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"git checkout master\ngit pull\ngit checkout mynewbranch\ngit rebase master","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Note that rebasing will try to rewrite each of your commits over the top of the branch you are rebasing on (master in this case). This process will have many steps if there are many commits and lots of conflicts. Simply follow the instructions until the process is finished.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The longer you leave it before rebasing on master the longer the rebase process will take. It can eventually become overwhelming as it is not replaying the latest state of your repository over master, but each commit that you made in order. You may have completely forgotten what those older commits were about, so this can become very difficult if not done regularly.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Once you have pushed your changes to your GitHub account, go to the official project GitHub page and you should see your branch mentioned near the top of the page. Open a pull request.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Someone will review your code and suggest changes they'd like made. Simply add more commits to your branch and push again. They will automatically get added to your pull request.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Note that we don't accept code without tests and documentation. We use Documenter.jl for our documentation, in Markdown format. See our existing code for examples of docstrings above functions in the source code and look in the docs/src directory to see how these docstrings are merged into our online documentation.","category":"page"},{"location":"developer/introduction/#Development-list","page":"Introduction to Nemo development","title":"Development list","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"All developers of AbstractAlgebra and Nemo are welcome to write to our development list to ask questions and discuss development:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://groups.google.com/g/nemo-devel","category":"page"},{"location":"developer/introduction/#Reporting-bugs","page":"Introduction to Nemo development","title":"Reporting bugs","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Bugs should be reported by opening an issue (ticket) on the official GitHub page for the relevant project. Please state the Julia version being used, the machine you are using and the version of AbstractAlgebra/Nemo you are using. The version can be found in the Project.toml file at the top level of the source tree.","category":"page"},{"location":"developer/introduction/#Development-roadmap","page":"Introduction to Nemo development","title":"Development roadmap","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"AbstractAlgebra has a special roadmap ticket which lists the most important tickets that have been opened. If you want to contribute something high value this is the place to start:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://github.com/Nemocas/AbstractAlgebra.jl/issues/492","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"This ticket is updated every so often.","category":"page"},{"location":"developer/introduction/#Binaries","page":"Introduction to Nemo development","title":"Binaries","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Binaries of C libraries for Nemo are currently made in a separate repository:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://github.com/JuliaPackaging/Yggdrasil","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"If code is added to any of the C libraries used by Nemo, this jll package must be updated first and the version updated in Nemo.jl before the new functionality can be used. Ask the core developers for help with this as various other tasks must be completed at the same time.","category":"page"},{"location":"developer/introduction/#Relationship-to-Oscar","page":"Introduction to Nemo development","title":"Relationship to Oscar","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Nemo and AbstractAlgebra are heavily used by the Oscar computer algebra system being developed in Germany by a number of universities involved in a large project known as TRR 195, funded by the DFG.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Oscar is the number one customer for Nemo. Many bugs in Nemo are found and fixed by Oscar developers and most of the key Nemo developers are part of the Oscar project.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"See the Oscar website for further details:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://www.oscar-system.org/","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/typesystem/#The-type-system","page":"The type system","title":"The type system","text":"","category":"section"},{"location":"developer/typesystem/#Use-of-Julia-types-in-Nemo","page":"The type system","title":"Use of Julia types in Nemo","text":"","category":"section"},{"location":"developer/typesystem/#Concrete-and-abstract-types","page":"The type system","title":"Concrete and abstract types","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Julia does not provide a traditional class/inheritance approach to programming. Instead, the basic unit of its object oriented approach is the type definition (struct and mutable struct) and inheritance exists only on the function side of the language rather than data side. Julia provides a rich system of abstract types and unions on the data side and multimethods on the function side to effect this.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example Julia's Number type is an abstract type containing all concrete types that behave like numbers, e.g. Int64, Float64, and so on.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Abstract types can also belong to other abstract types, forming a tree of abstract types.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"In Nemo the most important abstract types are Ring and Field, with the latter belonging to the former so that all fields are rings, and the abstract types RingElem and FieldElem for the objects that represent elements of rings and fields, again with the latter abstract type belonging to the former.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Because this hierarchy of abstract types must form a tree, Julia is strictly speaking single inheritance, as each concrete and abstract type can belong to at most one other abstract type. For example, one could not have a diamond of abstract types with ExactField belonging to both Field and ExactRing.","category":"page"},{"location":"developer/typesystem/#Recovering-aspects-of-multiple-inheritance-in-Nemo","page":"The type system","title":"Recovering aspects of multiple inheritance in Nemo","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Various possibilities exist to get around the limitation that abstract types must form a 'tree' in Nemo and AbstractAlgebra.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"One such possibility is union types. If a function should accept one of a number of concrete or abstract types that can't all be made to belong to a single abstract type due to this limitation then one can use a union type.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example, Nemo defines RingElement to be a union of RingElem and all the Julia standard types which behave like ring elements, e.g. all Integer types and types of rationals with Integer components.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Other union types are defined in src/AbstractAlgebra.jl in AbstractAlgebra.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"A second feature we make use of in Nemo is parameterised types. Each concrete and abstract type can take one or more parameters. These parameter can be any other type, either concrete or abstract. For example, in Julia Rational{T} is for rationals with numerator and denominator of type T.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"A great deal of control over parameterised types is possible, e.g. one can restrict the type parameter T using a where clause, e.g. to write a function that accepts all rational types with integer components of the same type one can use the type Rational{T} where T <: Integer.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Nemo makes use of such parameterised types for generic ring constructions such as generic polynomial rings and matrices over a given base ring. The type of the elements of the base ring is substituted for the parameter T in any concrete instantiation of the types Poly{T} and Mat{T}, which are defined in AbstractAlgebra in src/generic/GenericTypes.jl.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The totality of all univariate polynomial types, including those of generic Poly{T} types and those coming from C libraries (such as ZZPolyRingElem), is represented by the abstract type PolyRingElem{T} which in turn belongs to RingElem, both defined in AbstractAlgebra in src/AbstractTypes.jl.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Similarly, the totality of all matrix types, including explicit C types like ZZMatrix and the generic Mat{T} types is given by the abstract type MatElem{T}, again defined in AbstractAlgebra in src/AbstractTypes.jl.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This hierarchy of types allows one to write functions at any level, e.g. for all univariate polynomial types, just those with a given base type T, or for a specific concrete type corresponding to just one kind of univariate polynomial.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"A third possibility to get around the single inheritance limitation of Julia is type traits. There is currently no explicit compiler/language support for traits, however various implementations exist that make use of type parameters in tricky ways. This allows one to add 'traits' to types, so long as those traits can be expressed as types. In this way, types can have multiple 'properties' at the same time, instead of belonging to just a single abstract type.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Nemo does not currently use type traits, though the map types in Nemo do make use of a custom analogue of this.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Note that unlike class based systems that dispatch on the type of a (sometimes implicit) this or self parameter, Julia methods dispatch on the type of all arguments. This is a natural fit for mathematics where all sorts of ad hoc left and right operations may be required.","category":"page"},{"location":"developer/typesystem/#Encapsulation,-maps-and-runtime-flags","page":"The type system","title":"Encapsulation, maps and runtime flags","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"One limitation of the Julia approach is that the type of an object cannot be changed at runtime. For example one might like to insist that a given ring is in fact a field. There are three standard ways to handle this in Julia.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The first approach is to encapsulate the object in another object which does have the desired type. The second approach is to map the object to a different one of the required type (e.g. by applying a morphism). The third approach is to introduce data fields in the original type which can be changed at runtime, unlike its type. All three approaches come with downsides. ","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Encapsulation can be time consuming for the developer as methods which applied to the original object do not automatically apply to the encapsulated object. One can write methods which do, but this is not automatic.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Application of a map may come with a performance penalty and may be difficult for the user to navigate. Moreover, mutation of the resulting object does not result in mutation of the original object.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The third option of adding runtime data fields essentially takes one back to writing a (possibly bug ridden) interpreter. It relies on the developer implementing outer methods that make use of hand written control statements to determine which of a range of inner methods should be applied to the object. This misses the benefits of one of the main defining features of Julia, namely its multimethod system and can also make introspection more difficult.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Nemo does not apply any of these three approaches widely at present, though information which can only be known at runtime such as whether a ring is Euclidean will eventually have to be encoded using one of these three methods.","category":"page"},{"location":"developer/typesystem/#Nemo's-custom-map-types","page":"The type system","title":"Nemo's custom map types","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"It makes sense that map types in Nemo should be parameterised by the element types of both the domain and codomain of the map, and of course all maps in the system should somehow belong to an abstract type Map.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This leads one to consider a two parameter system of types Map{D, C} where D and C are the domain and codomain types respectively.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"One may also wish to implement various types of map, e.g. linear maps (where the map contains a matrix representing the map) or functional maps (where the map is implemented by a Julia function) and so on. Notionally one imagines doing this with a hierarchy of two parameter abstract types all ultimately belonging to Map{D, C} as the root of the tree.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This approach begins to break down when constructions from homological algebra begin to be applied to maps. In such cases, the maps themselves are the object of study and functions may be applied to maps to produce other maps.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The simplest such function is composition. In a system where composition of maps always results in a map of the same type, no problem arises with the straightforward approach outlined above.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"However, for various reasons (including performance) it may not be desirable or even possible to construct a composition of two given maps using the same representation as the original maps. This means that the result of composing two maps of the same type may be a map of a different type, e.g. in the worst case a general composition type.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This problem makes many homological and category theoretic operations on maps difficult or impossible to implement.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Other operations which may be desirable to implement are caching of maps (e.g. where the map is extremely time consuming to compute, such as discrete logarithms) and attaching category theoretic information to maps. Such operations can be effected by encapsulating existing maps in objects containing the extra information, e.g. a cache or a category. However all the methods that applied to the original map objects now no longer apply to the encapsulated objects.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"To work around these limitations Nemo implements a four parameter Map type, Map{D, C, T, U}.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The first two parameters are the domain and codomain types as discussed above.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The parameter T is a \"map class\" which is itself an abstract type existing in a hierarchy of abstract types. This parameter is best thought of as a trait, independent of the hierarchy of abstract types belonging to Map, giving additional flexibility to the map types in the system.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example, T may be set to LinearMap or FunctionalMap. This may be useful if one wishes to distinguish maps in other ways, e.g. whether they are homomorphisms, isomorphisms, maps with section or retraction etc. As usual, offering traits partially gets around the single inheritance problem.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The final parameter U is used to allow maps of a given type U to be composed and still result in a map of type U, even though the concrete type of the composition is different to that of the original maps. Methods can be written for all maps of type U by matching this parameter, rather than matching on the concrete type U of the original maps.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example, two maps with concrete type MyRingHomomorphism would belong to Map{D, C, T, MyRingHomomorphism} as would any composition of such maps, even if the concrete type of the composition was not a MyRingHomomorphism.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Naturally four parameter types are rather unwieldy and so various helper functions are provided to compute four parameter map types. In the first instance one still has the type Map{D, C} which will give the union of all map types whose first two parameters are D and C, and where the remaining two parameters are arbitrary.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"However one can also pass a map class or a concrete type U to a Map function to compute the class of all maps of the given map class or type.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example, to write a function which accepts all maps of \"type\" MyRingHomomorphism, including all compositions of such maps, one inserts Map(MyRingHomomorphism) in place of the type, e.g.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"function myfun(f::Map(MyRingHomomorphism))","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Note the parentheses here, rather than curly braces; it's a function to compute a type! Now the function myfun will accept any map type whose fourth parameter U is set to MyRingHomomorphism.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This four parameter system is flexible, but may need to be expanded in the future. For example it may be useful to have more than one trait T. This could be achieved either by making T a tuple of traits or by introducing a parameterised MapTrait type which can be placed at that location. Naturally the Map functions for computing the four parameter types will have to be similarly expanded to make it easier for the user.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The map type system is currently considered experimental and our observation so far is that it is not intuitive for developers.","category":"page"},{"location":"developer/typesystem/#Type-hierarchy-diagram","page":"The type system","title":"Type hierarchy diagram","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The most important abstract types in the system are the element types. Their hierarchy is shown in the following diagram.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"(Image: alt text)","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Most of the element types have a corresponding parent abstract type. These are shown in the following diagram.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"(Image: alt text)","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"series/#Power-series-and-Laurent-series","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Nemo allows the creation of capped relative and absolute power series over any computable ring R. Capped relative power series are power series of the form a_jx^j + a_j+1x^j+1 + cdots + a_k-1x^k-1 + O(x^k) where j geq 0, a_j in R and the relative precision k - j is at most equal to some specified precision n. On the other hand capped absolute power series are power series of the form a_jx^j + a_j+1x^j+1 + cdots + a_n-1x^n-1 + O(x^n) where j geq 0, a_j in R and the precision n is fixed.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of power series over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The following table shows each of the relative power series types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of series (the type information is mainly of concern to developers).","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl `Generic.RelSeries{T} Generic.RelPowerSeriesRing{T}\nmathbbZ Flint ZZRelPowerSeriesRingElem ZZRelPowerSeriesRing\nmathbbZnmathbbZ (small n) Flint zzModRelPowerSeriesRingElem zzModRelPowerSeriesRing\nmathbbZnmathbbZ (large n) Flint ZZModRelPowerSeriesRingElem ZZModRelPowerSeriesRing\nmathbbQ Flint QQRelPowerSeriesRingElem QQRelPowerSeriesRing\nmathbbF_p (small n) Flint fpRelPowerSeriesRingElem fpRelPowerSeriesRing\nmathbbF_p (large n) Flint FpRelPowerSeriesRingElem FpRelPowerSeriesRing\nmathbbF_p^n (small p) Flint fqPolyRepRelPowerSeriesRingElem fqPolyRepRelPowerSeriesRing\nmathbbF_p^n (large p) Flint FqPolyRepRelPowerSeriesRingElem FqPolyRepRelPowerSeriesRing","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"All relative power series elements belong to the abstract type RelPowerSeriesRingElem and all of the relative power series ring types belong to the abstract type RelPowerSeriesRing.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The maximum relative precision, the string representation of the variable and the base ring R of a generic power series are stored in its parent object. ","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Here is the corresponding table for the absolute power series types.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.AbsSeries{T} Generic.AbsPowerSeriesRing{T}\nmathbbZ Flint ZZAbsPowerSeriesRingElem ZZAbsPowerSeriesRing\nmathbbZnmathbbZ (small n) Flint zzModAbsPowerSeriesRingElem zzModAbsPowerSeriesRing\nmathbbZnmathbbZ (large n) Flint ZZModAbsPowerSeriesRingElem ZZModAbsPowerSeriesRing\nmathbbQ Flint QQAbsPowerSeriesRingElem QQAbsPowerSeriesRing\nmathbbF_p (small n) Flint fpAbsPowerSeriesRingElem fpAbsPowerSeriesRing\nmathbbF_p (large n) Flint FpAbsPowerSeriesRingElem FpAbsPowerSeriesRing\nmathbbF_p^n (small n) Flint fqPolyRepAbsPowerSeriesRingElem fqPolyRepAbsPowerSeriesRing\nmathbbF_p^n (large n) Flint FqPolyRepAbsPowerSeriesRingElem FqPolyRepAbsPowerSeriesRing","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"All absolute power series elements belong to the abstract type AbsPowerSeriesRingElem and all of the absolute power series ring types belong to the abstract type AbsPowerSeriesRing.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The absolute precision, the string representation of the variable and the base ring R of a generic power series are stored in its parent object. ","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"All power series element types belong to the abstract type SeriesElem and all of the power series ring types belong to the abstract type SeriesRing. This enables one to write generic functions that can accept any Nemo power series type.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"AbstractAlgebra.jl also provides Nemo with a generic implementation of Laurent series over a given ring R. For completeness, we list it here.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.LaurentSeriesRingElem{T} Generic.LaurentSeriesRing{T}\nGeneric field K AbstractAlgebra.jl Generic.LaurentSeriesFieldElem{T} Generic.LaurentSeriesField{T}","category":"page"},{"location":"series/#Capped-relative-power-series","page":"Power series and Laurent series","title":"Capped relative power series","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Capped relative power series have their maximum relative precision capped at some value prec_max. This means that if the leading term of a nonzero power series element is c_ax^a and the precision is b then the power series is of the form c_ax^a + c_a+1x^a+1 + ldots + O(x^a + b).","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The zero power series is simply taken to be 0 + O(x^b).","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The capped relative model has the advantage that power series are stable multiplicatively. In other words, for nonzero power series f and g we have that divexact(f*g), g) == f.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"However, capped relative power series are not additively stable, i.e. we do not always have (f + g) - g = f.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"In the capped relative model we say that two power series are equal if they agree up to the minimum absolute precision of the two power series. Thus, for example, x^5 + O(x^10) == 0 + O(x^5), since the minimum absolute precision is 5.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"During computations, it is possible for power series to lose relative precision due to cancellation. For example if f = x^3 + x^5 + O(x^8) and g = x^3 + x^6 + O(x^8) then f - g = x^5 - x^6 + O(x^8) which now has relative precision 3 instead of relative precision 5.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Amongst other things, this means that equality is not transitive. For example x^6 + O(x^11) == 0 + O(x^5) and x^7 + O(x^12) == 0 + O(x^5) but x^6 + O(x^11) neq x^7 + O(x^12).","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Sometimes it is necessary to compare power series not just for arithmetic equality, as above, but to see if they have precisely the same precision and terms. For this purpose we introduce the isequal function.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"For example, if f = x^2 + O(x^7) and g = x^2 + O(x^8) and h = 0 + O(x^2) then f == g, f == h and g == h, but isequal(f, g), isequal(f, h) and isequal(g, h) would all return false. However, if k = x^2 + O(x^7) then isequal(f, k) would return true.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"There are further difficulties if we construct polynomial over power series. For example, consider the polynomial in y over the power series ring in x over the rationals. Normalisation of such polynomials is problematic. For instance, what is the leading coefficient of (0 + O(x^10))y + (1 + O(x^10))?","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"If one takes it to be (0 + O(x^10)) then some functions may not terminate due to the fact that algorithms may require the degree of polynomials to decrease with each iteration. Instead, the degree may remain constant and simply accumulate leading terms which are arithmetically zero but not identically zero.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"On the other hand, when constructing power series over other power series, if we simply throw away terms which are arithmetically equal to zero, our computations may have different output depending on the order in which the power series are added!","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"One should be aware of these difficulties when working with power series. Power series, as represented on a computer, simply don't satisfy the axioms of a ring. They must be used with care in order to approximate operations in a mathematical power series ring.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Simply increasing the precision will not necessarily give a \"more correct\" answer and some computations may not even terminate due to the presence of arithmetic zeroes!","category":"page"},{"location":"series/#Capped-absolute-power-series","page":"Power series and Laurent series","title":"Capped absolute power series","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"An absolute power series ring over a ring R with precision p behaves very much like the quotient Rx(x^p) of the polynomial ring over R.","category":"page"},{"location":"series/#Power-series-functionality","page":"Power series and Laurent series","title":"Power series functionality","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Power series rings in Nemo provide all the functionality described for power series in AbstractAlgebra:","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/series","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"In addition, generic power series and Laurent series are provided by AbstractAlgebra.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"We list below only the functionality that is Nemo specific for power series rings.","category":"page"},{"location":"series/#Special-functions","page":"Power series and Laurent series","title":"Special functions","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Examples","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"julia> T, z = power_series_ring(QQ, 30, \"z\")\n(Univariate power series ring over QQ, z + O(z^31))\n\njulia> a = 1 + z + 3z^2 + O(z^5)\n1 + z + 3*z^2 + O(z^5)\n\njulia> b = z + 2z^2 + 5z^3 + O(z^5)\nz + 2*z^2 + 5*z^3 + O(z^5)\n\njulia> d = divexact(z, exp(z + O(z^40)) - 1)\n1 - 1//2*z + 1//12*z^2 - 1//720*z^4 + 1//30240*z^6 - 1//1209600*z^8 + 1//47900160*z^10 - 691//1307674368000*z^12 + 1//74724249600*z^14 - 3617//10670622842880000*z^16 + 43867//5109094217170944000*z^18 - 174611//802857662698291200000*z^20 + 77683//14101100039391805440000*z^22 - 236364091//1693824136731743669452800000*z^24 + 657931//186134520519971831808000000*z^26 - 3392780147//37893265687455865519472640000000*z^28 + O(z^29)\n\njulia> f = exp(b)\n1 + z + 5//2*z^2 + 43//6*z^3 + 193//24*z^4 + O(z^5)\n\njulia> g = log(a)\nz + 5//2*z^2 - 8//3*z^3 - 7//4*z^4 + O(z^5)\n\njulia> h = sqrt(a)\n1 + 1//2*z + 11//8*z^2 - 11//16*z^3 - 77//128*z^4 + O(z^5)\n\njulia> k = sin(b)\nz + 2*z^2 + 29//6*z^3 - z^4 + O(z^5)\n\njulia> m = atanh(b)\nz + 2*z^2 + 16//3*z^3 + 2*z^4 + O(z^5)","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"algebraic/#Algebraic-numbers","page":"Algebraic numbers","title":"Algebraic numbers","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Nemo allows working with exact real and complex algebraic numbers.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The default algebraic number type in Nemo is provided by Calcium. The associated field of algebraic numbers is represented by the constant parent object called CalciumQQBar.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"For convenience we define","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"QQBar = CalciumQQBar","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"so that algebraic numbers can be constructed using QQBar instead of CalciumQQBar. Note that this is the name of a specific parent object, not the name of its type.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Library Element type Parent type\nCalcium qqbar CalciumQQBarField","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Important note on performance","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The default algebraic number type represents algebraic numbers in canonical form using minimal polynomials. This works well for representing individual algebraic numbers, but it does not provide the best performance for field arithmetic. For fast calculation in overlinemathbbQ, CalciumField should typically be used instead (see the section on Exact real and complex numbers). Alternatively, to compute in a fixed subfield of overlinemathbbQ, you may fix a generator a and construct an Antic number field to represent mathbbQ(a).","category":"page"},{"location":"algebraic/#Algebraic-number-functionality","page":"Algebraic numbers","title":"Algebraic number functionality","text":"","category":"section"},{"location":"algebraic/#Constructing-algebraic-numbers","page":"Algebraic numbers","title":"Constructing algebraic numbers","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Methods to construct algebraic numbers include:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Conversion from other numbers and through arithmetic operations\nComputing the roots of a given polynomial\nComputing the eigenvalues of a given matrix\nRandom generation\nExact trigonometric functions (see later section)\nGuessing (see later section)","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Arithmetic:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> ZZRingElem(QQBar(3))\n3\n\njulia> QQFieldElem(QQBar(3) // 2)\n3//2\n\njulia> QQBar(-1) ^ (QQBar(1) // 3)\nRoot 0.500000 + 0.866025*im of x^2 - x + 1","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Solving the quintic equation:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> R, x = polynomial_ring(QQ, \"x\")\n(Univariate polynomial ring in x over QQ, x)\n\njulia> v = roots(QQBar, x^5-x-1)\n5-element Vector{qqbar}:\n Root 1.16730 of x^5 - x - 1\n Root 0.181232 + 1.08395*im of x^5 - x - 1\n Root 0.181232 - 1.08395*im of x^5 - x - 1\n Root -0.764884 + 0.352472*im of x^5 - x - 1\n Root -0.764884 - 0.352472*im of x^5 - x - 1\n\njulia> v[1]^5 - v[1] - 1 == 0\ntrue","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Computing exact eigenvalues of a matrix:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> eigenvalues(ZZ[1 1 0; 0 1 1; 1 0 1], QQBar)\n3-element Vector{qqbar}:\n Root 2.00000 of x - 2\n Root 0.500000 + 0.866025*im of x^2 - x + 1\n Root 0.500000 - 0.866025*im of x^2 - x + 1","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"roots(R::CalciumQQBarField, f::ZZPolyRingElem)\nroots(R::CalciumQQBarField, f::QQPolyRingElem)\neigenvalues(A::ZZMatrix, R::CalciumQQBarField)\neigenvalues(A::QQMatrix, R::CalciumQQBarField)\nrand(R::CalciumQQBarField; degree::Int, bits::Int, randtype::Symbol=:null)","category":"page"},{"location":"algebraic/#AbstractAlgebra.Generic.roots-Tuple{CalciumQQBarField, ZZPolyRingElem}","page":"Algebraic numbers","title":"AbstractAlgebra.Generic.roots","text":"roots(R::CalciumQQBarField, f::ZZPolyRingElem)\n\nReturn all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Roots of multiplicity higher than one are repeated according to their multiplicity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.Generic.roots-Tuple{CalciumQQBarField, QQPolyRingElem}","page":"Algebraic numbers","title":"AbstractAlgebra.Generic.roots","text":"roots(R::CalciumQQBarField, f::QQPolyRingElem)\n\nReturn all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Roots of multiplicity higher than one are repeated according to their multiplicity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.eigenvalues-Tuple{ZZMatrix, CalciumQQBarField}","page":"Algebraic numbers","title":"Nemo.eigenvalues","text":"eigenvalues(A::ZZMatrix, R::CalciumQQBarField)\n\nReturn all the eigenvalues of the matrix A in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Eigenvalues of multiplicity higher than one are repeated according to their multiplicity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.eigenvalues-Tuple{QQMatrix, CalciumQQBarField}","page":"Algebraic numbers","title":"Nemo.eigenvalues","text":"eigenvalues(A::QQMatrix, R::CalciumQQBarField)\n\nReturn all the eigenvalues of the matrix A in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Eigenvalues of multiplicity higher than one are repeated according to their multiplicity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.rand-Tuple{CalciumQQBarField}","page":"Algebraic numbers","title":"Base.rand","text":"rand(R::CalciumQQBarField; degree::Int, bits::Int, randtype::Symbol=:null)\n\nReturn a random algebraic number with degree up to degree and coefficients up to bits in size. By default, both real and complex numbers are generated. Set the optional randtype to :real or :nonreal to generate a specific type of number. Note that nonreal numbers require degree at least 2.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Numerical-evaluation","page":"Algebraic numbers","title":"Numerical evaluation","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Algebraic numbers can be evaluated numerically to arbitrary precision by converting to real or complex Arb fields:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> RR = ArbField(64); RR(sqrt(QQBar(2)))\n[1.414213562373095049 +/- 3.45e-19]\n\njulia> CC = AcbField(32); CC(QQBar(-1) ^ (QQBar(1) // 4))\n[0.707106781 +/- 2.74e-10] + [0.707106781 +/- 2.74e-10]*im","category":"page"},{"location":"algebraic/#Minimal-polynomials,-conjugates,-and-properties","page":"Algebraic numbers","title":"Minimal polynomials, conjugates, and properties","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Retrieving the minimal polynomial and algebraic conjugates of a given algebraic number:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> minpoly(polynomial_ring(ZZ, \"x\")[1], QQBar(1+2im))\nx^2 - 2*x + 5\n\njulia> conjugates(QQBar(1+2im))\n2-element Vector{qqbar}:\n Root 1.00000 + 2.00000*im of x^2 - 2x + 5\n Root 1.00000 - 2.00000*im of x^2 - 2x + 5","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"iszero(x::qqbar)\nisone(x::qqbar)\nisinteger(x::qqbar)\nis_rational(x::qqbar)\nisreal(x::qqbar)\ndegree(x::qqbar)\nis_algebraic_integer(x::qqbar)\nminpoly(R::ZZPolyRing, x::qqbar)\nminpoly(R::QQPolyRing, x::qqbar)\nconjugates(a::qqbar)\ndenominator(x::qqbar)\nnumerator(x::qqbar)\nheight(x::qqbar)\nheight_bits(x::qqbar)","category":"page"},{"location":"algebraic/#Base.iszero-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.iszero","text":"iszero(x::qqbar)\n\nReturn whether x is the number 0.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.isone-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.isone","text":"isone(x::qqbar)\n\nReturn whether x is the number 1.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.isinteger-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.isinteger","text":"isinteger(x::qqbar)\n\nReturn whether x is an integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_rational-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.is_rational","text":"is_rational(x::qqbar)\n\nReturn whether x is a rational number.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.isreal-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.isreal","text":"isreal(x::qqbar)\n\nReturn whether x is a real number.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.degree-Tuple{qqbar}","page":"Algebraic numbers","title":"AbstractAlgebra.degree","text":"degree(x::qqbar)\n\nReturn the degree of the minimal polynomial of x.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_algebraic_integer-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.is_algebraic_integer","text":"is_algebraic_integer(x::qqbar)\n\nReturn whether x is an algebraic integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.minpoly-Tuple{ZZPolyRing, qqbar}","page":"Algebraic numbers","title":"AbstractAlgebra.minpoly","text":"minpoly(R::ZZPolyRing, x::qqbar)\n\nReturn the minimal polynomial of x as an element of the polynomial ring R.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.minpoly-Tuple{QQPolyRing, qqbar}","page":"Algebraic numbers","title":"AbstractAlgebra.minpoly","text":"minpoly(R::ZZPolyRing, x::qqbar)\n\nReturn the minimal polynomial of x as an element of the polynomial ring R.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.conjugates-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.conjugates","text":"conjugates(a::qqbar)\n\nReturn all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.denominator-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.denominator","text":"denominator(x::qqbar)\n\nReturn the denominator of x, defined as the leading coefficient of the minimal polynomial of x. The result is returned as an ZZRingElem.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.numerator-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.numerator","text":"numerator(x::qqbar)\n\nReturn the numerator of x, defined as x multiplied by its denominator. The result is an algebraic integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.height-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.height","text":"height(x::qqbar)\n\nReturn the height of the algebraic number x. The result is an ZZRingElem integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.height_bits-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.height_bits","text":"height_bits(x::qqbar)\n\nReturn the height of the algebraic number x measured in bits. The result is a Julia integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Complex-parts","page":"Algebraic numbers","title":"Complex parts","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> real(sqrt(QQBar(1im)))\nRoot 0.707107 of 2x^2 - 1\n\njulia> abs(sqrt(QQBar(1im)))\nRoot 1.00000 of x - 1\n\njulia> floor(sqrt(QQBar(1000)))\nRoot 31.0000 of x - 31\n\njulia> sign(QQBar(-10-20im))\nRoot -0.447214 - 0.894427*im of 5x^4 + 6x^2 + 5","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"real(a::qqbar)\nimag(a::qqbar)\nabs(a::qqbar)\nabs2(a::qqbar)\nconj(a::qqbar)\nsign(a::qqbar)\ncsgn(a::qqbar)\nsign_real(a::qqbar)\nsign_imag(a::qqbar)\nfloor(a::qqbar)\nceil(a::qqbar)","category":"page"},{"location":"algebraic/#Base.real-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.real","text":"real(a::qqbar)\n\nReturn the real part of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.imag-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.imag","text":"imag(a::qqbar)\n\nReturn the imaginary part of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.abs-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.abs","text":"abs(a::qqbar)\n\nReturn the absolute value of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.abs2-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.abs2","text":"abs2(a::qqbar)\n\nReturn the squared absolute value of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.conj-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.conj","text":"conj(a::qqbar)\n\nReturn the complex conjugate of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.sign-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.sign","text":"sign(a::qqbar)\n\nReturn the complex sign of a, defined as zero if a is zero and as a a otherwise.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.csgn-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.csgn","text":"csgn(a::qqbar)\n\nReturn the extension of the real sign function taking the value 1 strictly in the right half plane, -1 strictly in the left half plane, and the sign of the imaginary part when on the imaginary axis. Equivalently, operatornamecsgn(x) = x sqrtx^2 except that the value is 0 at zero. The value is returned as a Julia integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.sign_real-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.sign_real","text":"sign_real(a::qqbar)\n\nReturn the sign of the real part of a as a Julia integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.sign_imag-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.sign_imag","text":"sign_imag(a::qqbar)\n\nReturn the sign of the imaginary part of a as a Julia integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.floor-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.floor","text":"floor(a::qqbar)\n\nReturn the floor function of a as an algebraic number. Use ZZRingElem(floor(a)) to construct a Nemo integer instead.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.ceil-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.ceil","text":"ceil(a::qqbar)\n\nReturn the ceiling function of b as an algebraic number. Use ZZRingElem(ceil(a)) to construct a Nemo integer instead.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Comparing-algebraic-numbers","page":"Algebraic numbers","title":"Comparing algebraic numbers","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The operators == and != check exactly for equality.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"We provide various comparison functions for ordering algebraic numbers:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Standard comparison for real numbers (<, isless)\nReal parts\nImaginary parts\nAbsolute values\nAbsolute values of real or imaginary parts\nRoot sort order ","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The standard comparison will throw if either argument is nonreal.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The various comparisons for complex parts are provided as separate operations since these functions are far more efficient than explicitly computing the complex parts and then doing real comparisons.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The root sort order is a total order for complex algebraic numbers used to order the output of roots and conjugates canonically. We define this order as follows: real roots come first, in descending order. Nonreal roots are subsequently ordered first by real part in descending order, then in ascending order by the absolute value of the imaginary part, and then in descending order of the sign of the imaginary part. This implies that complex conjugate roots are adjacent, with the root in the upper half plane first.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> 1 < sqrt(QQBar(2)) < QQBar(3)//2\ntrue\n\njulia> x = QQBar(3+4im)\nRoot 3.00000 + 4.00000*im of x^2 - 6x + 25\n\njulia> is_equal_abs(x, -x)\ntrue\n\njulia> is_equal_abs_imag(x, 2-x)\ntrue\n\njulia> is_less_real(x, x // 2)\nfalse","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"is_equal_real(a::qqbar, b::qqbar)\nis_equal_imag(a::qqbar, b::qqbar)\nis_equal_abs(a::qqbar, b::qqbar)\nis_equal_abs_real(a::qqbar, b::qqbar)\nis_equal_abs_imag(a::qqbar, b::qqbar)\nis_less_real(a::qqbar, b::qqbar)\nis_less_imag(a::qqbar, b::qqbar)\nis_less_abs(a::qqbar, b::qqbar)\nis_less_abs_real(a::qqbar, b::qqbar)\nis_less_abs_imag(a::qqbar, b::qqbar)\nis_less_root_order(a::qqbar, b::qqbar)","category":"page"},{"location":"algebraic/#Nemo.is_equal_real-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_real","text":"is_equal_real(a::qqbar, b::qqbar)\n\nCompares the real parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_equal_imag-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_imag","text":"is_equal_imag(a::qqbar, b::qqbar)\n\nCompares the imaginary parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_equal_abs-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_abs","text":"is_equal_abs(a::qqbar, b::qqbar)\n\nCompares the absolute values of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_equal_abs_real-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_abs_real","text":"is_equal_abs_real(a::qqbar, b::qqbar)\n\nCompares the absolute values of the real parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_equal_abs_imag-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_abs_imag","text":"is_equal_abs_imag(a::qqbar, b::qqbar)\n\nCompares the absolute values of the imaginary parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_real-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_real","text":"is_less_real(a::qqbar, b::qqbar)\n\nCompares the real parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_imag-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_imag","text":"is_less_imag(a::qqbar, b::qqbar)\n\nCompares the imaginary parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_abs-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_abs","text":"is_less_abs(a::qqbar, b::qqbar)\n\nCompares the absolute values of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_abs_real-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_abs_real","text":"is_less_abs_real(a::qqbar, b::qqbar)\n\nCompares the absolute values of the real parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_abs_imag-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_abs_imag","text":"is_less_abs_imag(a::qqbar, b::qqbar)\n\nCompares the absolute values of the imaginary parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_root_order-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_root_order","text":"is_less_root_order(a::qqbar, b::qqbar)\n\nCompares the a and b in root sort order.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Roots-and-trigonometric-functions","page":"Algebraic numbers","title":"Roots and trigonometric functions","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> root(QQBar(2), 5)\nRoot 1.14870 of x^5 - 2\n\njulia> sinpi(QQBar(7) // 13)\nRoot 0.992709 of 4096x^12 - 13312x^10 + 16640x^8 - 9984x^6 + 2912x^4 - 364x^2 + 13\n\njulia> tanpi(atanpi(sqrt(QQBar(2)) + 1))\nRoot 2.41421 of x^2 - 2x - 1\n\njulia> root_of_unity(QQBar, 5)\nRoot 0.309017 + 0.951057*im of x^4 + x^3 + x^2 + x + 1\n\njulia> root_of_unity(QQBar, 5, 4)\nRoot 0.309017 - 0.951057*im of x^4 + x^3 + x^2 + x + 1\n\njulia> w = (1 - sqrt(QQBar(-3)))//2\nRoot 0.500000 - 0.866025*im of x^2 - x + 1\n\njulia> is_root_of_unity(w)\ntrue\n\njulia> is_root_of_unity(w + 1)\nfalse\n\njulia> root_of_unity_as_args(w)\n(6, 5)","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"sqrt(a::qqbar)\nroot(a::qqbar, n::Int)\nroot_of_unity(C::CalciumQQBarField, n::Int)\nroot_of_unity(C::CalciumQQBarField, n::Int, k::Int)\nis_root_of_unity(a::qqbar)\nroot_of_unity_as_args(a::qqbar)\nexp_pi_i(a::qqbar)\nlog_pi_i(a::qqbar)\nsinpi(a::qqbar)\ncospi(a::qqbar)\ntanpi(a::qqbar)\nasinpi(a::qqbar)\nacospi(a::qqbar)\natanpi(a::qqbar)","category":"page"},{"location":"algebraic/#Base.sqrt-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.sqrt","text":"sqrt(a::qqbar; check::Bool=true)\n\nReturn the principal square root of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.root-Tuple{qqbar, Int64}","page":"Algebraic numbers","title":"AbstractAlgebra.root","text":"root(a::qqbar, n::Int)\n\nReturn the principal n-th root of a. Requires positive n.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.root_of_unity-Tuple{CalciumQQBarField, Int64}","page":"Algebraic numbers","title":"Nemo.root_of_unity","text":"root_of_unity(C::CalciumQQBarField, n::Int)\n\nReturn the root of unity e^2 pi i n as an element of the field of algebraic numbers C.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.root_of_unity-Tuple{CalciumQQBarField, Int64, Int64}","page":"Algebraic numbers","title":"Nemo.root_of_unity","text":"root_of_unity(C::CalciumQQBarField, n::Int, k::Int)\n\nReturn the root of unity e^2 pi i k n as an element of the field of algebraic numbers C.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_root_of_unity-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.is_root_of_unity","text":"is_root_of_unity(a::qqbar)\n\nReturn whether the given algebraic number is a root of unity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.root_of_unity_as_args-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.root_of_unity_as_args","text":"root_of_unity_as_args(a::qqbar)\n\nReturn a pair of integers (q, p) such that the given a equals e^2 pi i p q. The denominator q will be minimal, with 0 le p q. Throws if a is not a root of unity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.exp_pi_i-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.exp_pi_i","text":"exp_pi_i(a::qqbar)\n\nReturn e^pi i a as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.log_pi_i-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.log_pi_i","text":"log_pi_i(a::qqbar)\n\nReturn log(a) (pi i) as an algebraic number. Throws if this value is transcendental or undefined.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.Math.sinpi-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.Math.sinpi","text":"sinpi(a::qqbar)\n\nReturn sin(pi a) as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.Math.cospi-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.Math.cospi","text":"cospi(a::qqbar)\n\nReturn cos(pi a) as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.tanpi-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.tanpi","text":"tanpi(a::qqbar)\n\nReturn tan(pi a) as an algebraic number. Throws if this value is transcendental or undefined.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.asinpi-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.asinpi","text":"asinpi(a::qqbar)\n\nReturn operatornameasin(a) pi as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.acospi-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.acospi","text":"acospi(a::qqbar)\n\nReturn operatornameacos(a) pi as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.atanpi-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.atanpi","text":"atanpi(a::qqbar)\n\nReturn operatornameatan(a) pi as an algebraic number. Throws if this value is transcendental or undefined.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Guessing","page":"Algebraic numbers","title":"Guessing","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"An algebraic number can be recovered from a numerical value:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> RR = ArbField(53); guess(QQBar, RR(\"1.41421356 +/- 1e-6\"), 2)\nRoot 1.41421 of x^2 - 2","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Warning: the input should be an enclosure. If you have a floating-point approximation, you should add an error estimate; otherwise, the only algebraic number that can be guessed is the binary floating-point number itself.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> RR = ArbField(128);\n\njulia> x = RR(0.1); # note: 53-bit binary approximation of 1//10 without radius\n\njulia> guess(QQBar, x, 1)\nRoot 0.100000 of 36028797018963968x - 3602879701896397\n\njulia> guess(QQBar, x + RR(\"+/- 1e-10\"), 1)\nRoot 0.100000 of 10x - 1","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"guess(R::CalciumQQBarField, x::arb, maxdeg::Int, maxbits::Int=0)\nguess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)","category":"page"},{"location":"algebraic/#Nemo.guess","page":"Algebraic numbers","title":"Nemo.guess","text":"guess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)\n\nTry to reconstruct an algebraic number from a given numerical enclosure x. The algorithm looks for candidates up to degree maxdeg and with coefficients up to size maxbits (which defaults to the precision of x if not given). Throws if no suitable algebraic number can be found.\n\nGuessing typically requires high precision to succeed, and it does not make much sense to call this function with input precision smaller than O(maxdeg cdot maxbits). If this function succeeds, then the output is guaranteed to be contained in the enclosure x, but failure does not prove that such an algebraic number with the specified parameters does not exist.\n\nThis function does a single iteration with the target parameters. For best performance, one should invoke this function repeatedly with successively larger parameters when the size of the intended solution is unknown or may be much smaller than a worst-case bound.\n\n\n\n\n\n","category":"function"},{"location":"algebraic/#Nemo.guess-2","page":"Algebraic numbers","title":"Nemo.guess","text":"guess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)\n\nTry to reconstruct an algebraic number from a given numerical enclosure x. The algorithm looks for candidates up to degree maxdeg and with coefficients up to size maxbits (which defaults to the precision of x if not given). Throws if no suitable algebraic number can be found.\n\nGuessing typically requires high precision to succeed, and it does not make much sense to call this function with input precision smaller than O(maxdeg cdot maxbits). If this function succeeds, then the output is guaranteed to be contained in the enclosure x, but failure does not prove that such an algebraic number with the specified parameters does not exist.\n\nThis function does a single iteration with the target parameters. For best performance, one should invoke this function repeatedly with successively larger parameters when the size of the intended solution is unknown or may be much smaller than a worst-case bound.\n\n\n\n\n\n","category":"function"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"numberfield/#Number-field-arithmetic","page":"Number field arithmetic","title":"Number field arithmetic","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Number fields are provided in Nemo by Antic. This allows construction of absolute number fields and basic arithmetic computations therein.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Number fields are constructed using the AnticNumberField function. However, for convenience we define","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"number_field = AnticNumberField","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"so that number fields can be constructed using number_field rather than AnticNumberField. ","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The types of number field elements in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Library Field Element type Parent type\nAntic mathbbQx(f) nf_elem AnticNumberField","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"All the number field types belong to the Field abstract type and the number field element types belong to the FieldElem abstract type.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The Hecke.jl library radically expands on number field functionality, providing ideals, orders, class groups, relative extensions, class field theory, etc.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The basic number field element type used in Hecke is the Nemo/antic number field element type, making the two libraries tightly integrated.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"https://thofma.github.io/Hecke.jl/stable/","category":"page"},{"location":"numberfield/#Number-field-functionality","page":"Number field arithmetic","title":"Number field functionality","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The number fields in Nemo provide all of the AbstractAlgebra field functionality:","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Below, we document the additional functionality provided for number field elements.","category":"page"},{"location":"numberfield/#Constructors","page":"Number field arithmetic","title":"Constructors","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"In order to construct number field elements in Nemo, one must first construct the number field itself. This is accomplished with one of the following constructors.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"number_field(::QQPolyRingElem, ::VarName)\ncyclotomic_field(::Int, ::VarName)\ncyclotomic_real_subfield(::Int, ::VarName)","category":"page"},{"location":"numberfield/#Nemo.number_field-Tuple{QQPolyRingElem, Union{Char, AbstractString, Symbol}}","page":"Number field arithmetic","title":"Nemo.number_field","text":"number_field(f::QQPolyRingElem, s::VarName;\n cached::Bool = true, check::Bool = true)\n\nReturn a tuple R x consisting of the parent object R and generator x of the number field mathbbQx(f) where f is the supplied polynomial. The supplied string s specifies how the generator of the number field should be printed. If s is not specified, it defaults to _a.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/#Nemo.cyclotomic_field-Tuple{Int64, Union{Char, AbstractString, Symbol}}","page":"Number field arithmetic","title":"Nemo.cyclotomic_field","text":"cyclotomic_field(n::Int, s::VarName = \"z_$n\", t = \"_\\$\"; cached = true)\n\nReturn a tuple R x consisting of the parent object R and generator x of the n-th cyclotomic field, mathbbQ(zeta_n). The supplied string s specifies how the generator of the number field should be printed. If provided, the string t specifies how the generator of the polynomial ring from which the number field is constructed, should be printed. If it is not supplied, a default dollar sign will be used to represent the variable.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/#Nemo.cyclotomic_real_subfield-Tuple{Int64, Union{Char, AbstractString, Symbol}}","page":"Number field arithmetic","title":"Nemo.cyclotomic_real_subfield","text":"cyclotomic_real_subfield(n::Int, s::VarName = \"(z_$n + 1/z_$n)\", t = \"\\$\"; cached = true)\n\nReturn a tuple R x consisting of the parent object R and generator x of the totally real subfield of the n-th cyclotomic field, mathbbQ(zeta_n). The supplied string s specifies how the generator of the number field should be printed. If provided, the string t specifies how the generator of the polynomial ring from which the number field is constructed, should be printed. If it is not supplied, a default dollar sign will be used to represent the variable.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Here are some examples of creating number fields and making use of the resulting parent objects to coerce various elements into those fields.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R, x = polynomial_ring(QQ, \"x\")\nK, a = number_field(x^3 + 3x + 1, \"a\")\nL, b = CyclotomicField(5, \"b\")\nM, c = CyclotomicRealField(5, \"c\")\n\nd = K(3)\nf = L(b)\ng = L(ZZ(11))\nh = L(ZZ(11)//3)\nk = M(x)","category":"page"},{"location":"numberfield/#Number-field-element-constructors","page":"Number field arithmetic","title":"Number field element constructors","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"gen(::AnticNumberField)","category":"page"},{"location":"numberfield/#AbstractAlgebra.gen-Tuple{AnticNumberField}","page":"Number field arithmetic","title":"AbstractAlgebra.gen","text":"gen(a::AnticNumberField)\n\nReturn the generator of the given number field, i.e., a symbolic root of the defining polynomial.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The easiest way of constructing number field elements is to use element arithmetic with the generator, to construct the desired element by its representation as a polynomial. See the following examples for how to do this.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R, x = polynomial_ring(QQ, \"x\")\nK, a = number_field(x^3 + 3x + 1, \"a\")\n\nd = gen(K)\nf = a^2 + 2a - 7","category":"page"},{"location":"numberfield/#Basic-functionality","page":"Number field arithmetic","title":"Basic functionality","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"mul_red!(::nf_elem, ::nf_elem, ::nf_elem, ::Bool)","category":"page"},{"location":"numberfield/#AbstractAlgebra.mul_red!-Tuple{nf_elem, nf_elem, nf_elem, Bool}","page":"Number field arithmetic","title":"AbstractAlgebra.mul_red!","text":"mul_red!(z::nf_elem, x::nf_elem, y::nf_elem, red::Bool)\n\nMultiply x by y and set the existing number field element z to the result. Reduction modulo the defining polynomial is only performed if red is set to true. Note that x and y must be reduced. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"reduce!(::nf_elem)","category":"page"},{"location":"numberfield/#AbstractAlgebra.Generic.reduce!-Tuple{nf_elem}","page":"Number field arithmetic","title":"AbstractAlgebra.Generic.reduce!","text":"reduce!(x::nf_elem)\n\nReduce the given number field element by the defining polynomial, in-place. This only needs to be done after accumulating values computed by mul_red! where reduction has not been performed. All standard Nemo number field functions automatically reduce their outputs.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The following coercion function is provided for a number field R.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R(f::QQPolyRingElem)","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Coerce the given rational polynomial into the number field R, i.e. consider the polynomial to be the representation of a number field element and return it.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Conversely, if R is the polynomial ring to which the generating polynomial of a number field belongs, then we can coerce number field elements into the ring R using the following function.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R(b::nf_elem)","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Coerce the given number field element into the polynomial ring R of which the number field is a quotient.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R, x = polynomial_ring(QQ, \"x\")\nK, a = number_field(x^3 + 3x + 1, \"a\")\n\nf = R(a^2 + 2a + 3)\ng = K(x^2 + 2x + 1)","category":"page"},{"location":"numberfield/#Basic-manipulation","page":"Number field arithmetic","title":"Basic manipulation","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"var(::AnticNumberField)","category":"page"},{"location":"numberfield/#AbstractAlgebra.var-Tuple{AnticNumberField}","page":"Number field arithmetic","title":"AbstractAlgebra.var","text":"var(a::AnticNumberField)\n\nReturns the identifier (as a symbol, not a string), that is used for printing the generator of the given number field.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"is_gen(::nf_elem)","category":"page"},{"location":"numberfield/#AbstractAlgebra.is_gen-Tuple{nf_elem}","page":"Number field arithmetic","title":"AbstractAlgebra.is_gen","text":"is_gen(a::nf_elem)\n\nReturn true if the given number field element is the generator of the number field, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"coeff(::nf_elem, ::Int)","category":"page"},{"location":"numberfield/#AbstractAlgebra.coeff-Tuple{nf_elem, Int64}","page":"Number field arithmetic","title":"AbstractAlgebra.coeff","text":"coeff(x::nf_elem, n::Int)\n\nReturn the n-th coefficient of the polynomial representation of the given number field element. Coefficients are numbered from 0, starting with the constant coefficient.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"denominator(::nf_elem)","category":"page"},{"location":"numberfield/#Base.denominator-Tuple{nf_elem}","page":"Number field arithmetic","title":"Base.denominator","text":"denominator(a::nf_elem)\n\nReturn the denominator of the polynomial representation of the given number field element.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"degree(::AnticNumberField)","category":"page"},{"location":"numberfield/#AbstractAlgebra.degree-Tuple{AnticNumberField}","page":"Number field arithmetic","title":"AbstractAlgebra.degree","text":"degree(a::AnticNumberField)\n\nReturn the degree of the given number field, i.e. the degree of its defining polynomial.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R, x = polynomial_ring(QQ, \"x\")\nK, a = number_field(x^3 + 3x + 1, \"a\")\n\nd = a^2 + 2a - 7\nm = gen(K)\n\nc = coeff(d, 1)\nis_gen(m)\nq = degree(K)\nr, s = signature(K)\nv = var(R)","category":"page"},{"location":"numberfield/#Norm-and-trace","page":"Number field arithmetic","title":"Norm and trace","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"norm(::nf_elem)","category":"page"},{"location":"numberfield/#LinearAlgebra.norm-Tuple{nf_elem}","page":"Number field arithmetic","title":"LinearAlgebra.norm","text":"norm(a::nf_elem)\n\nReturn the absolute norm of a. The result will be a rational number.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"tr(::nf_elem)","category":"page"},{"location":"numberfield/#LinearAlgebra.tr-Tuple{nf_elem}","page":"Number field arithmetic","title":"LinearAlgebra.tr","text":"tr(a::nf_elem)\n\nReturn the absolute trace of a. The result will be a rational number.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"julia> R, x = polynomial_ring(QQ, \"x\")\n(Univariate polynomial ring in x over QQ, x)\n\njulia> K, a = number_field(x^3 + 3x + 1, \"a\")\n(Number field of degree 3 over QQ, a)\n\njulia> c = 3a^2 - a + 1\n3*a^2 - a + 1\n\njulia> d = norm(c)\n113\n\njulia> f = tr(c)\n-15","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"puiseux/#Puiseux-series","page":"Puiseux series","title":"Puiseux series","text":"","category":"section"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Nemo allows the creation of Puiseux series over any computable ring R. Puiseux series are series of the form a_jx^jm + a_j+1x^(j+1)m + cdots + a_k-1x^(k-1)m + O(x^km) where m is a positive integer, a_i in R and the relative precision k - j is at most equal to some specified precision n.","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of Puiseux series over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"The following table shows each of the Puiseux series types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of series (the type information is mainly of concern to developers).","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl `Generic.PuiseuxSeriesRingElem{T} Generic.PuiseuxSeriesRing{T}\nGeneric field K AbstractAlgebra.jl `Generic.PuiseuxSeriesFieldElem{T} Generic.PuiseuxSeriesField{T}\nmathbbZ Flint FlintPuiseuxSeriesRingElem{ZZLaurentSeriesRingElem} FlintPuiseuxSeriesRing{ZZLaurentSeriesRingElem}","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"For convenience, FlintPuiseuxSeriesRingElem and FlintPuiseuxSeriesFieldElem both belong to a union type called FlintPuiseuxSeriesElem.","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"The maximum relative precision, the string representation of the variable and the base ring R of a generic power series are stored in the parent object. ","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Note that unlike most other Nemo types, Puiseux series are parameterised by the type of the underlying Laurent series type (which must exist before Nemo can make use of it), instead of the type of the coefficients.","category":"page"},{"location":"puiseux/#Puiseux-power-series","page":"Puiseux series","title":"Puiseux power series","text":"","category":"section"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Puiseux series have their maximum relative precision capped at some value prec_max. This refers to the maximum precision of the underlying Laurent series. See the description of the generic Puiseux series in AbstractAlgebra.jl for details.","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"There are numerous important things to be aware of when working with Puiseux series, or series in general. Please refer to the documentation of generic Puiseux series and series in general in AbstractAlgebra.jl for details.","category":"page"},{"location":"puiseux/#Puiseux-series-functionality","page":"Puiseux series","title":"Puiseux series functionality","text":"","category":"section"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Puiseux series rings in Nemo implement all the same functionality that is available for AbstractAlgebra series rings, with the exception of the pol_length and polcoeff functions:","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/series","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"In addition, generic Puiseux series are provided by AbstractAlgebra.jl","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"We list below only the functionality that differs from that described in AbstractAlgebra, for specific rings provided by Nemo.","category":"page"},{"location":"puiseux/#Special-functions","page":"Puiseux series","title":"Special functions","text":"","category":"section"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Base.sqrt(a::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})","category":"page"},{"location":"puiseux/#Base.sqrt-Tuple{FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem}}","page":"Puiseux series","title":"Base.sqrt","text":"sqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of the given Puiseux series a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nBase.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of f. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.\n\n\n\n\n\nBase.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem\n\nReturn the square root of a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\n","category":"method"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Base.exp(a::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})","category":"page"},{"location":"puiseux/#Base.exp-Tuple{FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem}}","page":"Puiseux series","title":"Base.exp","text":"exp(a::Generic.LaurentSeriesElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the exponential of the given Puiseux series a.\n\n\n\n\n\nexp(a::AbsPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::RelPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\n","category":"method"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"eta_qexp(x::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})","category":"page"},{"location":"puiseux/#Nemo.eta_qexp-Tuple{FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem}}","page":"Puiseux series","title":"Nemo.eta_qexp","text":"eta_qexp(x::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})\n\nReturn the q-series for eta evaluated at x, which must currently be a rational power of the generator of the Puiseux series ring.\n\n\n\n\n\n","category":"method"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Examples","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"julia> S, z = PuiseuxSeriesRing(ZZ, 30, \"z\")\n(Puiseux series ring in z over ZZ, z + O(z^31))\n\njulia> a = 1 + z + 3z^2 + O(z^5)\n1 + z + 3*z^2 + O(z^5)\n\njulia> h = sqrt(a^2)\n1 + z + 3*z^2 + O(z^5)\n\njulia> k = eta_qexp(z)\nz^(1//24) - z^(25//24) + O(z^(31//24))","category":"page"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"ff_embedding/#Finite-field-embeddings","page":"Finite field embeddings","title":"Finite field embeddings","text":"","category":"section"},{"location":"ff_embedding/#Introduction","page":"Finite field embeddings","title":"Introduction","text":"","category":"section"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"Nemo allows the construction of finite field embeddings making use of the algorithm of Bosma, Cannon and Steel behind the scenes to ensure compatibility. Critical routines (e.g. polynomial factorization, matrix computations) are provided by the C library Flint, whereas high level tasks are written directly in Nemo.","category":"page"},{"location":"ff_embedding/#Embedding-functionality","page":"Finite field embeddings","title":"Embedding functionality","text":"","category":"section"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"It is possible to explicitly call the embedding embed function to create an embedding, but it is also possible to directly ask for the conversion of a finite field element x in some other finite field k via calling k(x). The resulting embedding is of type FinFieldMorphism. It is also possible to compute the preimage map of an embedding via the preimage_map function, applied to an embedding or directly to the finite fields (this actually first computes the embedding), or via conversion. An error is thrown if the element you want to compute the preimage of is not in the image of the embedding.","category":"page"},{"location":"ff_embedding/#Computing-an-embedding","page":"Finite field embeddings","title":"Computing an embedding","text":"","category":"section"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"embed(::fqPolyRepField, ::fqPolyRepField)","category":"page"},{"location":"ff_embedding/#Nemo.embed-Tuple{fqPolyRepField, fqPolyRepField}","page":"Finite field embeddings","title":"Nemo.embed","text":"embed(k::T, K::T) where T <: FinField\n\nEmbed k in K, with some additional computations in order to satisfy compatibility conditions with previous and future embeddings.\n\n\n\n\n\n","category":"method"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"Examples","category":"page"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"julia> k2, x2 = FiniteField(19, 2, \"x2\")\n(Finite field of degree 2 over GF(19), x2)\n\njulia> k4, x4 = FiniteField(19, 4, \"x4\")\n(Finite field of degree 4 over GF(19), x4)\n\njulia> f = embed(k2, k4)\nMorphism of finite fields from\n from finite field of degree 2 over gF(19)\n to finite field of degree 4 over gF(19)\n\njulia> y = f(x2)\n6*x4^3 + 5*x4^2 + 9*x4 + 17\n\njulia> z = k4(x2)\n6*x4^3 + 5*x4^2 + 9*x4 + 17","category":"page"},{"location":"ff_embedding/#Computing-the-preimage-of-an-embedding","page":"Finite field embeddings","title":"Computing the preimage of an embedding","text":"","category":"section"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"preimage_map(::fqPolyRepField, ::fqPolyRepField)\npreimage_map(::FinFieldMorphism)","category":"page"},{"location":"ff_embedding/#AbstractAlgebra.Generic.preimage_map-Tuple{fqPolyRepField, fqPolyRepField}","page":"Finite field embeddings","title":"AbstractAlgebra.Generic.preimage_map","text":"preimage_map(k::T, k::T) where T <: FinField\n\nComputes the preimage map corresponding to the embedding of k into K.\n\n\n\n\n\n","category":"method"},{"location":"ff_embedding/#AbstractAlgebra.Generic.preimage_map-Tuple{Nemo.FinFieldMorphism}","page":"Finite field embeddings","title":"AbstractAlgebra.Generic.preimage_map","text":"preimage_map(f::FinFieldMorphism)\n\nCompute the preimage map corresponding to the embedding f.\n\n\n\n\n\n","category":"method"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"Examples","category":"page"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"julia> k7, x7 = FiniteField(13, 7, \"x7\")\n(Finite field of degree 7 over GF(13), x7)\n\njulia> k21, x21 = FiniteField(13, 21, \"x21\")\n(Finite field of degree 21 over GF(13), x21)\n\njulia> s = preimage_map(k7, k21)\nPreimage of the morphism from Finite field of degree 7 over GF(13) to Finite field of degree 21 over GF(13)\n\njulia> y = k21(x7);\n\njulia> z = s(y)\nx7\n\njulia> t = k7(y)\nx7","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"gfp/#Galois-fields","page":"Galois fields","title":"Galois fields","text":"","category":"section"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Nemo allows the creation of Galois fields of the form mathbbZpmathbbZ for a prime p. Note that these are not the same as finite fields of degree 1, as Conway polynomials are not used and no generator is given.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"For convenience, the following constructors are provided.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"GF(n::UInt)\nGF(n::Int)\nGF(n::ZZRingElem)","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"For example, one can create the Galois field of characteristic 7 as follows.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"R = GF(7)","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Elements of the field are then created in the usual way.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"a = R(3)","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Elements of Galois fields have type fpFieldElem when p is given to the constructor as an Int or UInt, and of type FpFieldElem if p is given as an ZZRingElem, and the type of the parent objects is fpField or FpField respectively.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"The modulus p of an element of a Galois field is stored in its parent object.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"The fpFieldElem and FpFieldElem types belong to the abstract type FinFieldElem and the fpField and FpField parent object types belong to the abstract type FinField.","category":"page"},{"location":"gfp/#Galois-field-functionality","page":"Galois fields","title":"Galois field functionality","text":"","category":"section"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Galois fields in Nemo provide all the residue ring functionality of AbstractAlgebra.jl:","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/residue","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"In addition, all the functionality for rings is available:","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/ring","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Below we describe the functionality that is provided in addition to these.","category":"page"},{"location":"gfp/#Basic-manipulation","page":"Galois fields","title":"Basic manipulation","text":"","category":"section"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Examples","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"julia> F = GF(3)\nFinite field of characteristic 3\n\njulia> a = characteristic(F)\n3\n\njulia> b = order(F)\n3","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"integer/#Integers","page":"Integers","title":"Integers","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"The default integer type in Nemo is provided by Flint. The associated ring of integers is represented by the constant parent object called FlintZZ.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"For convenience we define","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"ZZ = FlintZZ","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"so that integers can be constructed using ZZ instead of FlintZZ. Note that this is the name of a specific parent object, not the name of its type.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"The types of the integer ring parent objects and elements of the associated rings of integers are given in the following table according to the library providing them.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Library Element type Parent type\nFlint ZZRingElem ZZRing","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"All integer element types belong directly to the abstract type RingElem and all the integer ring parent object types belong to the abstract type Ring.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"A lot of code will want to accept both ZZRingElem integers and Julia integers, that is, subtypes of Base.Integer. Thus for convenience we define","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"IntegerUnion = Union{Integer,ZZRingElem}","category":"page"},{"location":"integer/#Integer-functionality","page":"Integers","title":"Integer functionality","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"Nemo integers provide all of the ring and Euclidean ring functionality of AbstractAlgebra.jl.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/ring","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/euclidean_interface","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Below, we describe the functionality that is specific to the Nemo/Flint integer ring.","category":"page"},{"location":"integer/#Constructors","page":"Integers","title":"Constructors","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"ZZ(n::Integer)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Coerce a Julia integer value into the integer ring.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"ZZ(n::String)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Parse the given string as an integer.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"ZZ(n::Float64)\nZZ(n::Float32)\nZZ(n::Float16)\nZZ(n::BigFloat)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Coerce the given floating point number into the integer ring, assuming that it can be exactly represented as an integer.","category":"page"},{"location":"integer/#Basic-manipulation","page":"Integers","title":"Basic manipulation","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"sign(::ZZRingElem)","category":"page"},{"location":"integer/#Base.sign-Tuple{ZZRingElem}","page":"Integers","title":"Base.sign","text":"sign(a::ZZRingElem)\n\nReturn the sign of a, i.e. +1, 0 or -1.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"size(::ZZRingElem)","category":"page"},{"location":"integer/#Base.size-Tuple{ZZRingElem}","page":"Integers","title":"Base.size","text":"size(a::ZZRingElem)\n\nReturn the number of limbs required to store the absolute value of a.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"fits(::Type{UInt}, ::ZZRingElem)\nfits(::Type{Int}, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.fits-Tuple{Type{UInt64}, ZZRingElem}","page":"Integers","title":"Nemo.fits","text":"fits(::Type{UInt}, a::ZZRingElem)\n\nReturn true if a fits into a UInt, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.fits-Tuple{Type{Int64}, ZZRingElem}","page":"Integers","title":"Nemo.fits","text":"fits(::Type{Int}, a::ZZRingElem)\n\nReturn true if a fits into an Int, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"denominator(::ZZRingElem)","category":"page"},{"location":"integer/#Base.denominator-Tuple{ZZRingElem}","page":"Integers","title":"Base.denominator","text":"denominator(a::ZZRingElem)\n\nReturn the denominator of a thought of as a rational. Always returns 1.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"numerator(::ZZRingElem)","category":"page"},{"location":"integer/#Base.numerator-Tuple{ZZRingElem}","page":"Integers","title":"Base.numerator","text":"numerator(a::ZZRingElem)\n\nReturn the numerator of a thought of as a rational. Always returns a.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> a = ZZ(12)\n12\n\njulia> is_unit(a)\nfalse\n\njulia> sign(a)\n1\n\njulia> s = size(a)\n1\n\njulia> fits(Int, a)\ntrue\n\njulia> n = numerator(a)\n12\n\njulia> d = denominator(a)\n1","category":"page"},{"location":"integer/#Euclidean-division","page":"Integers","title":"Euclidean division","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"Nemo also provides a large number of Euclidean division operations. Recall that for a dividend a and divisor b, we can write a = bq + r with 0 leq r b. We call q the quotient and r the remainder.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"We distinguish three cases. If q is rounded towards zero, r will have the same sign as a. If q is rounded towards plus infinity, r will have the opposite sign to b. Finally, if q is rounded towards minus infinity, r will have the same sign as b.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"In the following table we list the division functions and their rounding behaviour. We also give the return value of the function, with q representing return of the quotient and r representing return of the remainder.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function Return Rounding of the quotient\nmod r towards minus infinity\nrem r towards zero\ndiv q towards minus infinity\ndivrem(a::ZZRingElem, b::ZZRingElem) q, r towards minus infinity\ntdivrem(a::ZZRingElem, b::ZZRingElem) q, r towards zero\nfdivrem(a::ZZRingElem, b::ZZRingElem) q, r towards minus infinity\ncdivrem(a::ZZRingElem, b::ZZRingElem) q, r towards plus infinity\nntdivrem(a::ZZRingElem, b::ZZRingElem) q, r nearest integer, ties toward zero\nnfdivrem(a::ZZRingElem, b::ZZRingElem) q, r nearest integer, ties toward minus infinity\nncdivrem(a::ZZRingElem, b::ZZRingElem) q, r nearest integer, ties toward plus infinity","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"N.B: the internal definition of Nemo.div and Nemo.divrem are the same as fdiv and fdivrem. The definitions in the table are of Base.div and Base.divrem which agree with Julia's definitions of div and divrem.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Nemo also offers the following ad hoc division operators. The notation and description is as for the other Euclidean division functions.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function Return Rounding\nmod(a::ZZRingElem, b::Int) r towards minus infinity\nrem(a::ZZRingElem, b::Int) r towards zero\ndiv(a::ZZRingElem, b::Int) q towards zero\ntdiv(a::ZZRingElem, b::Int) q towards zero\nfdiv(a::ZZRingElem, b::Int) q towards minus infinity\ncdiv(a::ZZRingElem, b::Int) q towards plus infinity","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"N.B: the internal definition of Nemo.div is the same as fdiv. The definition in the table is Base.div which agrees with Julia's definition of div.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"The following functions are also available, for the case where one is dividing by a power of 2. In other words, for Euclidean division of the form a = b2^d + r. These are useful for bit twiddling.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function Return Rounding\ntdivpow2(a::ZZRingElem, d::Int) q towards zero\nfdivpow2(a::ZZRingElem, d::Int) q towards minus infinity\nfmodpow2(a::ZZRingElem, d::Int) r towards minus infinity\ncdivpow2(a::ZZRingElem, d::Int) q towards plus infinity","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> a = ZZ(12)\n12\n\njulia> b = ZZ(5)\n5\n\njulia> q, r = divrem(a, b)\n(2, 2)\n\njulia> c = cdiv(a, b)\n3\n\njulia> d = fdiv(a, b)\n2\n\njulia> f = tdivpow2(a, 2)\n3\n\njulia> g = fmodpow2(a, 3)\n4","category":"page"},{"location":"integer/#Comparison","page":"Integers","title":"Comparison","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"Instead of isless we implement a function cmp(a, b) which returns a positive value if a b, zero if a == b and a negative value if a b. We then implement all the other operators, including == in terms of cmp.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"For convenience we also implement a cmpabs(a, b) function which returns a positive value if a b, zero if a == b and a negative value if a b. This can be slightly faster than a call to cmp or one of the comparison operators when comparing nonnegative values for example.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Here is a list of the comparison functions implemented, with the understanding that cmp provides all of the comparison operators listed above.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function\ncmp(a::ZZRingElem, b::ZZRingElem)\ncmpabs(a::ZZRingElem, b::ZZRingElem)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"We also provide the following ad hoc comparisons which again provide all of the comparison operators mentioned above.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function\ncmp(a::ZZRingElem, b::Int)\ncmp(a::Int, b::ZZRingElem)\ncmp(a::ZZRingElem, b::UInt)\ncmp(a::UInt, b::ZZRingElem)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> a = ZZ(12)\n12\n\njulia> b = ZZ(3)\n3\n\njulia> a < b\nfalse\n\njulia> a != b\ntrue\n\njulia> a > 4\ntrue\n\njulia> 5 <= b\nfalse\n\njulia> cmpabs(a, b)\n1","category":"page"},{"location":"integer/#Shifting","page":"Integers","title":"Shifting","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"<<(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#Base.:<<-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Base.:<<","text":"<<(x::ZZRingElem, c::Int)\n\nReturn 2^cx where c geq 0.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":">>(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#Base.:>>-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Base.:>>","text":">>(x::ZZRingElem, c::Int)\n\nReturn x2^c, discarding any remainder, where c geq 0.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> a = ZZ(12)\n12\n\njulia> a << 3\n96\n\njulia> a >> 5\n0","category":"page"},{"location":"integer/#Modular-arithmetic","page":"Integers","title":"Modular arithmetic","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"sqrtmod(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.sqrtmod-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.sqrtmod","text":"sqrtmod(x::ZZRingElem, m::ZZRingElem)\n\nReturn a square root of x (mod m) if one exists. The remainder will be in the range 0 m). We require that m is prime, otherwise the algorithm may not terminate.\n\nExamples\n\njulia> sqrtmod(ZZ(12), ZZ(13))\n5\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"crt(r1::ZZRingElem, m1::ZZRingElem, r2::ZZRingElem, m2::ZZRingElem, signed=false; check::Bool=true)","category":"page"},{"location":"integer/#AbstractAlgebra.crt","page":"Integers","title":"AbstractAlgebra.crt","text":"crt(r1::ZZRingElem, m1::ZZRingElem, r2::ZZRingElem, m2::ZZRingElem, signed=false; check::Bool=true)\ncrt(r1::ZZRingElem, m1::ZZRingElem, r2::Union{Int, UInt}, m2::Union{Int, UInt}, signed=false; check::Bool=true)\ncrt(r::Vector{ZZRingElem}, m::Vector{ZZRingElem}, signed=false; check::Bool=true)\ncrt_with_lcm(r1::ZZRingElem, m1::ZZRingElem, r2::ZZRingElem, m2::ZZRingElem, signed=false; check::Bool=true)\ncrt_with_lcm(r1::ZZRingElem, m1::ZZRingElem, r2::Union{Int, UInt}, m2::Union{Int, UInt}, signed=false; check::Bool=true)\ncrt_with_lcm(r::Vector{ZZRingElem}, m::Vector{ZZRingElem}, signed=false; check::Bool=true)\n\nAs per the AbstractAlgebra crt interface, with the following option. If signed = true, the solution is the range (-m2 m2, otherwise it is in the range 0m), where m is the least common multiple of the moduli.\n\nExamples\n\njulia> crt(ZZ(5), ZZ(13), ZZ(7), ZZ(37), true)\n44\n\njulia> crt(ZZ(5), ZZ(13), 7, 37, true)\n44\n\n\n\n\n\n","category":"function"},{"location":"integer/#Integer-logarithm","page":"Integers","title":"Integer logarithm","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"flog(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.flog-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.flog","text":"flog(x::ZZRingElem, c::ZZRingElem)\nflog(x::ZZRingElem, c::Int)\n\nReturn the floor of the logarithm of x to base c.\n\nExamples\n\njulia> flog(ZZ(12), ZZ(2))\n3\n\njulia> flog(ZZ(12), 3)\n2\n\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"clog(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.clog-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.clog","text":"clog(x::ZZRingElem, c::ZZRingElem)\nclog(x::ZZRingElem, c::Int)\n\nReturn the ceiling of the logarithm of x to base c.\n\nExamples\n\njulia> clog(ZZ(12), ZZ(2))\n4\n\njulia> clog(ZZ(12), 3)\n3\n\n\n\n\n\n\n","category":"method"},{"location":"integer/#Integer-roots","page":"Integers","title":"Integer roots","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"isqrt(::ZZRingElem)","category":"page"},{"location":"integer/#Base.isqrt-Tuple{ZZRingElem}","page":"Integers","title":"Base.isqrt","text":"isqrt(x::ZZRingElem)\n\nReturn the floor of the square root of x.\n\nExamples\n\njulia> isqrt(ZZ(13))\n3\n\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"isqrtrem(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.isqrtrem-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.isqrtrem","text":"isqrtrem(x::ZZRingElem)\n\nReturn a tuple s r consisting of the floor s of the square root of x and the remainder r, i.e. such that x = s^2 + r. We require x geq 0.\n\nExamples\n\njulia> isqrtrem(ZZ(13))\n(3, 4)\n\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"root(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#AbstractAlgebra.root-Tuple{ZZRingElem, Int64}","page":"Integers","title":"AbstractAlgebra.root","text":"root(x::ZZRingElem, n::Int; check::Bool=true)\n\nReturn the n-the root of x. We require n 0 and that x geq 0 if n is even. By default the function tests whether the input was a perfect n-th power and if not raises an exception. If check=false this check is omitted.\n\nExamples\n\njulia> root(ZZ(27), 3; check=true)\n3\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"iroot(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#AbstractAlgebra.iroot-Tuple{ZZRingElem, Int64}","page":"Integers","title":"AbstractAlgebra.iroot","text":"iroot(x::ZZRingElem, n::Int)\n\nReturn the integer truncation of the n-the root of x (round towards zero). We require n 0 and that x geq 0 if n is even.\n\nExamples\n\njulia> iroot(ZZ(13), 3)\n2\n\n\n\n\n\n","category":"method"},{"location":"integer/#Number-theoretic-functionality","page":"Integers","title":"Number theoretic functionality","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"divisible(::ZZRingElem, ::Int)\ndivisible(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.divisible-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.divisible","text":"divisible(x::ZZRingElem, y::Int)\n\nReturn true if x is divisible by y, otherwise return false. We require x neq 0.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.divisible-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.divisible","text":"divisible(x::ZZRingElem, y::ZZRingElem)\n\nReturn true if x is divisible by y, otherwise return false. We require x neq 0.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"is_square(::ZZRingElem)","category":"page"},{"location":"integer/#AbstractAlgebra.is_square-Tuple{ZZRingElem}","page":"Integers","title":"AbstractAlgebra.is_square","text":"is_square(f::PolyRingElem{T}) where T <: RingElement\n\nReturn true if f is a perfect square.\n\n\n\n\n\nis_square(a::FracElem{T}) where T <: RingElem\n\nReturn true if a is a square.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"is_prime(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.is_prime-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.is_prime","text":"is_prime(x::ZZRingElem)\nis_prime(x::Int)\n\nReturn true if x is a prime number, otherwise return false.\n\nExamples\n\njulia> is_prime(ZZ(13))\ntrue\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"is_probable_prime(::ZZRingElem)","category":"page"},{"location":"integer/#AbstractAlgebra.is_probable_prime-Tuple{ZZRingElem}","page":"Integers","title":"AbstractAlgebra.is_probable_prime","text":"is_probable_prime(x::ZZRingElem)\n\nReturn true if x is very probably a prime number, otherwise return false. No counterexamples are known to this test, but it is conjectured that infinitely many exist.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"factor(::ZZRingElem)","category":"page"},{"location":"integer/#AbstractAlgebra.factor-Tuple{ZZRingElem}","page":"Integers","title":"AbstractAlgebra.factor","text":"factor(a::ZZRingElem)\nfactor(a::UInt)\nfactor(a::Int)\n\nReturn a factorisation of a using a Fac struct (see the documentation on factorisation in Nemo).\n\nExamples\n\njulia> factor(ZZ(12))\n1 * 2^2 * 3\n\njulia> factor(UInt(12))\n1 * 2^2 * 3\n\njulia> factor(12)\n1 * 2^2 * 3\n\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"divisor_lenstra(::ZZRingElem, ::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.divisor_lenstra-Tuple{ZZRingElem, ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.divisor_lenstra","text":"divisor_lenstra(n::ZZRingElem, r::ZZRingElem, m::ZZRingElem)\n\nIf n has a factor which lies in the residue class r (mod m) for 0 r m n, this function returns such a factor. Otherwise it returns 0. This is only efficient if m is at least the cube root of n. We require gcd(r m) = 1 and this condition is not checked.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"factorial(::ZZRingElem)","category":"page"},{"location":"integer/#Base.factorial-Tuple{ZZRingElem}","page":"Integers","title":"Base.factorial","text":"factorial(x::ZZRingElem)\n\nReturn the factorial of x, i.e. x = 123ldots x. We require x geq 0.\n\nExamples\n\njulia> factorial(ZZ(100))\n93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"rising_factorial(::ZZRingElem, ::ZZRingElem)\nrising_factorial(::ZZRingElem, ::Int)\nrising_factorial(::Int, ::Int)","category":"page"},{"location":"integer/#Nemo.rising_factorial-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.rising_factorial","text":"rising_factorial(x::ZZRingElem, n::ZZRingElem)\n\nReturn the rising factorial of x, i.e. x(x + 1)(x + 2)cdots (x + n - 1). If n 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.rising_factorial-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.rising_factorial","text":"rising_factorial(x::ZZRingElem, n::Int)\n\nReturn the rising factorial of x, i.e. x(x + 1)(x + 2)ldots (x + n - 1). If n 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.rising_factorial-Tuple{Int64, Int64}","page":"Integers","title":"Nemo.rising_factorial","text":"rising_factorial(x::Int, n::Int)\n\nReturn the rising factorial of x, i.e. x(x + 1)(x + 2)ldots (x + n - 1). If n 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"primorial(::ZZRingElem)\nprimorial(::Int)","category":"page"},{"location":"integer/#Nemo.primorial-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.primorial","text":"primorial(x::ZZRingElem)\n\nReturn the primorial of x, i.e. the product of all primes less than or equal to x. If x 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.primorial-Tuple{Int64}","page":"Integers","title":"Nemo.primorial","text":"primorial(x::Int)\n\nReturn the primorial of x, i.e. the product of all primes less than or equal to x. If x 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"fibonacci(::Int)\nfibonacci(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.fibonacci-Tuple{Int64}","page":"Integers","title":"Nemo.fibonacci","text":"fibonacci(x::Int)\n\nReturn the x-th Fibonacci number F_x. We define F_1 = 1, F_2 = 1 and F_i + 1 = F_i + F_i - 1 for all integers i.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.fibonacci-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.fibonacci","text":"fibonacci(x::ZZRingElem)\n\nReturn the x-th Fibonacci number F_x. We define F_1 = 1, F_2 = 1 and F_i + 1 = F_i + F_i - 1 for all integers i.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"bell(::ZZRingElem)\nbell(::Int)","category":"page"},{"location":"integer/#Nemo.bell-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.bell","text":"bell(x::ZZRingElem)\n\nReturn the Bell number B_x.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.bell-Tuple{Int64}","page":"Integers","title":"Nemo.bell","text":"bell(x::Int)\n\nReturn the Bell number B_x.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"binomial(::ZZRingElem, ::ZZRingElem)\nbinomial(::UInt, ::UInt, ::ZZRing)","category":"page"},{"location":"integer/#Base.binomial-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Base.binomial","text":"binomial(n::ZZRingElem, k::ZZRingElem)\n\nReturn the binomial coefficient fracn (n-1) cdots (n-k+1)k. If k 0 we return 0, and the identity binomial(n, k) == binomial(n - 1, k - 1) + binomial(n - 1, k) always holds for integers n and k.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Base.binomial-Tuple{UInt64, UInt64, ZZRing}","page":"Integers","title":"Base.binomial","text":"binomial(n::UInt, k::UInt, ::ZZRing)\n\nReturn the binomial coefficient fracn(n - k)k as an ZZRingElem.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"moebius_mu(::Int)\nmoebius_mu(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.moebius_mu-Tuple{Int64}","page":"Integers","title":"Nemo.moebius_mu","text":"moebius_mu(x::Int)\n\nReturn the Moebius mu function of x as an Int. The value returned is either -1, 0 or 1. If x leq 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.moebius_mu-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.moebius_mu","text":"moebius_mu(x::ZZRingElem)\n\nReturn the Moebius mu function of x as an Int. The value returned is either -1, 0 or 1. If x leq 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"jacobi_symbol(::Int, ::Int)\njacobi_symbol(::ZZRingElem, ::ZZRingElem)\nkronecker_symbol(::Int, ::Int)","category":"page"},{"location":"integer/#Nemo.jacobi_symbol-Tuple{Int64, Int64}","page":"Integers","title":"Nemo.jacobi_symbol","text":"jacobi_symbol(x::Int, y::Int)\n\nReturn the value of the Jacobi symbol left(fracxyright). The modulus y must be odd and positive, otherwise a DomainError is thrown.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.jacobi_symbol-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.jacobi_symbol","text":"jacobi_symbol(x::ZZRingElem, y::ZZRingElem)\n\nReturn the value of the Jacobi symbol left(fracxyright). The modulus y must be odd and positive, otherwise a DomainError is thrown.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.kronecker_symbol-Tuple{Int64, Int64}","page":"Integers","title":"Nemo.kronecker_symbol","text":"kronecker_symbol(x::ZZRingElem, y::ZZRingElem)\nkronecker_symbol(x::Int, y::Int)\n\nReturn the value of the Kronecker symbol left(fracxyright). The definition is as per Henri Cohen's book, \"A Course in Computational Algebraic Number Theory\", Definition 1.4.8.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"divisor_sigma(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#Nemo.divisor_sigma-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.divisor_sigma","text":"divisor_sigma(x::ZZRingElem, y::Int)\ndivisor_sigma(x::ZZRingElem, y::ZZRingElem)\ndivisor_sigma(x::Int, y::Int)\n\nReturn the value of the sigma function, i.e. sum_0 d x d^y. If x leq 0 or y 0 we throw a DomainError().\n\nExamples\n\njulia> divisor_sigma(ZZ(32), 10)\n1127000493261825\n\njulia> divisor_sigma(ZZ(32), ZZ(10))\n1127000493261825\n\njulia> divisor_sigma(32, 10)\n1127000493261825\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"euler_phi(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.euler_phi-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.euler_phi","text":"euler_phi(x::ZZRingElem)\neuler_phi(x::Int)\n\nReturn the value of the Euler phi function at x, i.e. the number of positive integers up to x (inclusive) that are coprime with x. An exception is raised if x leq 0.\n\nExamples\n\njulia> euler_phi(ZZ(12480))\n3072\n\njulia> euler_phi(12480)\n3072\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"number_of_partitions(::Int)","category":"page"},{"location":"integer/#Nemo.number_of_partitions-Tuple{Int64}","page":"Integers","title":"Nemo.number_of_partitions","text":"number_of_partitions(x::Int)\nnumber_of_partitions(x::ZZRingElem)\n\nReturn the number of partitions of x.\n\nExamples\n\njulia> number_of_partitions(100)\n190569292\n\njulia> number_of_partitions(ZZ(1000))\n24061467864032622473692149727991\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"is_perfect_power(::ZZRingElem)\nNemo.is_prime_power(::ZZRingElem)\nis_prime_power_with_data(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.is_perfect_power-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.is_perfect_power","text":"is_perfect_power(a::IntegerUnion)\n\nReturns whether a is a perfect power, that is, whether a = m^r for some integer m and r 1.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.is_prime_power-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.is_prime_power","text":"is_prime_power(q::IntegerUnion) -> Bool\n\nReturns whether q is a prime power.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.is_prime_power_with_data-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.is_prime_power_with_data","text":"is_prime_power_with_data(q::IntegerUnion) -> Bool, ZZRingElem, Int\n\nReturns a flag indicating whether q is a prime power and integers e p such that q = p^e. If q is a prime power, than p is a prime.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Digits-and-bases","page":"Integers","title":"Digits and bases","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"bin(::ZZRingElem)","category":"page"},{"location":"integer/#Base.bin-Tuple{ZZRingElem}","page":"Integers","title":"Base.bin","text":"bin(n::ZZRingElem)\n\nReturn n as a binary string.\n\nExamples\n\njulia> bin(ZZ(12))\n\"1100\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"oct(::ZZRingElem)","category":"page"},{"location":"integer/#Base.oct-Tuple{ZZRingElem}","page":"Integers","title":"Base.oct","text":"oct(n::ZZRingElem)\n\nReturn n as a octal string.\n\nExamples\n\njulia> oct(ZZ(12))\n\"14\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"dec(::ZZRingElem)","category":"page"},{"location":"integer/#Base.dec-Tuple{ZZRingElem}","page":"Integers","title":"Base.dec","text":"dec(n::ZZRingElem)\n\nReturn n as a decimal string.\n\nExamples\n\njulia> dec(ZZ(12))\n\"12\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"hex(::ZZRingElem)","category":"page"},{"location":"integer/#Base.hex-Tuple{ZZRingElem}","page":"Integers","title":"Base.hex","text":"hex(n::ZZRingElem) = base(n, 16)\n\nReturn n as a hexadecimal string.\n\nExamples\n\njulia> hex(ZZ(12))\n\"c\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"base(::ZZRingElem, ::Integer)","category":"page"},{"location":"integer/#Nemo.base-Tuple{ZZRingElem, Integer}","page":"Integers","title":"Nemo.base","text":"base(n::ZZRingElem, b::Integer)\n\nReturn n as a string in base b. We require 2 leq b leq 62.\n\nExamples\n\njulia> base(ZZ(12), 13)\n\"c\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"ndigits(::ZZRingElem, ::Integer)","category":"page"},{"location":"integer/#Base.ndigits-Tuple{ZZRingElem, Integer}","page":"Integers","title":"Base.ndigits","text":"ndigits(x::ZZRingElem, b::Integer)\n\nReturn the number of digits of x in the base b (default is b = 10).\n\nExamples\n\njulia> ndigits(ZZ(12), 3)\n3\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"nbits(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.nbits-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.nbits","text":"nbits(x::ZZRingElem)\n\nReturn the number of binary bits of x. We return zero if x = 0.\n\nExamples\n\njulia> nbits(ZZ(12))\n4\n\n\n\n\n\n","category":"method"},{"location":"integer/#Bit-twiddling","page":"Integers","title":"Bit twiddling","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"popcount(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.popcount-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.popcount","text":"popcount(x::ZZRingElem)\n\nReturn the number of ones in the binary representation of x.\n\nExamples\n\njulia> popcount(ZZ(12))\n2\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"prevpow2(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.prevpow2-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.prevpow2","text":"prevpow2(x::ZZRingElem)\n\nReturn the previous power of 2 up to including x.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"nextpow2(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.nextpow2-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.nextpow2","text":"nextpow2(x::ZZRingElem)\n\nReturn the next power of 2 that is at least x.\n\nExamples\n\njulia> nextpow2(ZZ(12))\n16\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"trailing_zeros(::ZZRingElem)","category":"page"},{"location":"integer/#Base.trailing_zeros-Tuple{ZZRingElem}","page":"Integers","title":"Base.trailing_zeros","text":"trailing_zeros(x::ZZRingElem)\n\nReturn the number of trailing zeros in the binary representation of x.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"clrbit!(::ZZRingElem, ::Int)\nsetbit!(::ZZRingElem, ::Int)\ncombit!(::ZZRingElem, ::Int)\ntstbit(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#Nemo.clrbit!-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.clrbit!","text":"clrbit!(x::ZZRingElem, c::Int)\n\nClear bit c of x, where the least significant bit is the 0-th bit. Note that this function modifies its input in-place.\n\nExamples\n\njulia> a = ZZ(12)\n12\n\njulia> clrbit!(a, 3)\n\njulia> a\n4\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.setbit!-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.setbit!","text":"setbit!(x::ZZRingElem, c::Int)\n\nSet bit c of x, where the least significant bit is the 0-th bit. Note that this function modifies its input in-place.\n\nExamples\n\njulia> a = ZZ(12)\n12\n\njulia> setbit!(a, 0)\n\njulia> a\n13\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.combit!-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.combit!","text":"combit!(x::ZZRingElem, c::Int)\n\nComplement bit c of x, where the least significant bit is the 0-th bit. Note that this function modifies its input in-place.\n\nExamples\n\njulia> a = ZZ(12)\n12\n\njulia> combit!(a, 2)\n\njulia> a\n8\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.tstbit-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.tstbit","text":"tstbit(x::ZZRingElem, c::Int)\n\nReturn bit i of x (numbered from 0) as true for 1 or false for 0.\n\nExamples\n\njulia> a = ZZ(12)\n12\n\njulia> tstbit(a, 0)\nfalse\n\njulia> tstbit(a, 2)\ntrue\n\n\n\n\n\n","category":"method"},{"location":"integer/#Random-generation","page":"Integers","title":"Random generation","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"rand_bits(::ZZRing, ::Int)","category":"page"},{"location":"integer/#Nemo.rand_bits-Tuple{ZZRing, Int64}","page":"Integers","title":"Nemo.rand_bits","text":"rand_bits(::ZZRing, b::Int)\n\nReturn a random signed integer whose absolute value has b bits.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"rand_bits_prime(::ZZRing, ::Int, ::Bool)","category":"page"},{"location":"integer/#Nemo.rand_bits_prime-Tuple{ZZRing, Int64, Bool}","page":"Integers","title":"Nemo.rand_bits_prime","text":"rand_bits_prime(::ZZRing, n::Int, proved::Bool=true)\n\nReturn a random prime number with the given number of bits. If only a probable prime is required, one can pass proved=false.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"a = rand_bits(ZZ, 23)\nb = rand_bits_prime(ZZ, 7)","category":"page"},{"location":"integer/#Complex-Integers","page":"Integers","title":"Complex Integers","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"The Gaussian integer type in Nemo is provided by a pair of Flint integers. The associated ring of integers and the fraction field can be retrieved by Nemo.GaussianIntegers() and Nemo.GaussianRationals().","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> ZZi = Nemo.GaussianIntegers()\nGaussian integer ring\n\njulia> a = ZZ(5)*im\n5*im\n\njulia> b = ZZi(3, 4)\n3 + 4*im\n\njulia> is_unit(a)\nfalse\n\njulia> factor(a)\nim * (2 - im) * (2 + im)\n\njulia> a//b\n4//5 + 3//5*im\n\njulia> abs2(a//b)\n1","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"CurrentModule = Nemo","category":"page"},{"location":"mpolynomial/#Multivariate-polynomials","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"","category":"section"},{"location":"mpolynomial/#Introduction","page":"Multivariate polynomials","title":"Introduction","text":"","category":"section"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"Nemo allow the creation of sparse, distributed multivariate polynomials over any computable ring R. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of polynomials over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"The following table shows each of the polynomial types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of polynomial (the type information is mainly of concern to developers).","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.MPoly{T} Generic.MPolyRing{T}\nmathbbZ Flint ZZMPolyRingElem ZZMPolyRing\nmathbbZnmathbbZ (small n) Flint zzModMPolyRingElem zzModMPolyRing\nmathbbQ Flint QQMPolyRingElem QQMPolyRing\nmathbbZpmathbbZ (small prime p) Flint fpMPolyRingElem fpMPolyRing\nmathbbF_p^n (small p) Flint fqPolyRepMPolyRingElem fqPolyRepMPolyRing","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"The string representation of the variables and the base ring R of a generic polynomial is stored in its parent object. ","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"All polynomial element types belong to the abstract type MPolyRingElem and all of the polynomial ring types belong to the abstract type MPolyRing. This enables one to write generic functions that can accept any Nemo multivariate polynomial type.","category":"page"},{"location":"mpolynomial/#Polynomial-functionality","page":"Multivariate polynomials","title":"Polynomial functionality","text":"","category":"section"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"All multivariate polynomial types in Nemo provide the multivariate polynomial functionality described by AbstractAlgebra:","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/mpolynomial","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"Generic multivariate polynomials are also available.","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"We describe here only functions that are in addition to that guaranteed by AbstractAlgebra.jl, for specific coefficient rings.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"CurrentModule = Nemo\nDocTestFilters = r\"[0-9\\.]+ seconds \\(.*\\)\"\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"#Getting-Started","page":"Getting Started","title":"Getting Started","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Nemo is a computer algebra package for the Julia programming language, maintained by William Hart, Tommy Hofmann, Claus Fieker, Fredrik Johansson with additional code by Oleksandr Motsak, Marek Kaluba and other contributors.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"https://github.com/Nemocas/Nemo.jl (Source code)\nhttps://nemocas.github.io/Nemo.jl/stable/ (Online documentation)","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"The features of Nemo so far include:","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Multiprecision integers and rationals\nIntegers modulo n\np-adic numbers\nFinite fields (prime and non-prime order)\nNumber field arithmetic\nAlgebraic numbers\nExact real and complex numbers\nArbitrary precision real and complex balls\nUnivariate and multivariate polynomials and matrices over the above","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Nemo depends on AbstractAlgebra.jl which provides Nemo with generic routines for:","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Univariate and multivariate polynomials\nAbsolute and relative power series\nLaurent series\nFraction fields\nResidue rings\nMatrices and linear algebra\nYoung Tableaux\nPermutation groups\nCharacters","category":"page"},{"location":"#Installation","page":"Getting Started","title":"Installation","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"To use Nemo we require Julia 1.6 or higher. Please see https://julialang.org/downloads/ for instructions on how to obtain julia for your system.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"At the Julia prompt simply type","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Pkg; Pkg.add(\"Nemo\")","category":"page"},{"location":"#Quick-start","page":"Getting Started","title":"Quick start","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Here are some examples of using Nemo.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"This example computes recursive univariate polynomials.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Nemo\n\njulia> R, x = polynomial_ring(ZZ, \"x\")\n(Univariate polynomial ring in x over ZZ, x)\n\njulia> S, y = polynomial_ring(R, \"y\")\n(Univariate polynomial ring in y over univariate polynomial ring, y)\n\njulia> T, z = polynomial_ring(S, \"z\")\n(Univariate polynomial ring in z over univariate polynomial ring, z)\n\njulia> f = x + y + z + 1\nz + y + x + 1\n\njulia> p = f^30; # semicolon suppresses output\n\njulia> @time q = p*(p+1);\n 0.161733 seconds (79.42 k allocations: 2.409 MiB)","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Here is an example using generic recursive ring constructions.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Nemo\n\njulia> R, x = FiniteField(7, 11, \"x\")\n(Finite field of degree 11 over GF(7), x)\n\njulia> S, y = polynomial_ring(R, \"y\")\n(Univariate polynomial ring in y over GF(7^11), y)\n\njulia> T = residue_ring(S, y^3 + 3x*y + 1)\nResidue ring of univariate polynomial ring modulo y^3 + 3*x*y + 1\n\njulia> U, z = polynomial_ring(T, \"z\")\n(Univariate polynomial ring in z over residue ring, z)\n\njulia> f = (3y^2 + y + x)*z^2 + ((x + 2)*y^2 + x + 1)*z + 4x*y + 3;\n\njulia> g = (7y^2 - y + 2x + 7)*z^2 + (3y^2 + 4x + 1)*z + (2x + 1)*y + 1;\n\njulia> s = f^12;\n\njulia> t = (s + g)^12;\n\njulia> @time resultant(s, t)\n 0.059095 seconds (391.89 k allocations: 54.851 MiB, 5.22% gc time)\n(x^10 + 4*x^8 + 6*x^7 + 3*x^6 + 4*x^5 + x^4 + 6*x^3 + 5*x^2 + x)*y^2 + (5*x^10 + x^8 + 4*x^7 + 3*x^5 + 5*x^4 + 3*x^3 + x^2 + x + 6)*y + 2*x^10 + 6*x^9 + 5*x^8 + 5*x^7 + x^6 + 6*x^5 + 5*x^4 + 4*x^3 + x + 3","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Here is an example using matrices.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Nemo\n\njulia> R, x = polynomial_ring(ZZ, \"x\")\n(Univariate polynomial ring in x over ZZ, x)\n\njulia> S = matrix_space(R, 40, 40)\nMatrix space of 40 rows and 40 columns\n over univariate polynomial ring in x over ZZ\n\njulia> M = rand(S, 2:2, -20:20);\n\njulia> @time det(M);\n 0.080976 seconds (132.28 k allocations: 23.341 MiB, 4.11% gc time)","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"And here is an example with power series.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Nemo\n\njulia> R, x = QQ[\"x\"]\n(Univariate polynomial ring in x over QQ, x)\n\njulia> S, t = power_series_ring(R, 100, \"t\")\n(Univariate power series ring over univariate polynomial ring, t + O(t^101))\n\njulia> u = t + O(t^100)\nt + O(t^100)\n\njulia> @time divexact((u*exp(x*u)), (exp(u)-1));\n 0.412813 seconds (667.49 k allocations: 33.966 MiB, 90.26% compilation time)","category":"page"},{"location":"#Building-dependencies-from-source","page":"Getting Started","title":"Building dependencies from source","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Nemo depends on various C libraries which are installed using binaries by default. With julia version >= 1.3, the use of these binaries can be overridden by putting the following into the file ~/.julia/artifacts/Overrides.toml:","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"[e134572f-a0d5-539d-bddf-3cad8db41a82]\nFLINT = \"/prefix/for/libflint\"\n\n[d9960996-1013-53c9-9ba4-74a4155039c3]\nArb = \"/prefix/for/libarb\"\n\n[e21ec000-9f72-519e-ba6d-10061e575a27]\nAntic = \"/prefix/for/libantic\"","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"(If only a specific library should be overridden, only the specific entry should be added.)","category":"page"},{"location":"#Experimental-threading-support-for-flint","page":"Getting Started","title":"Experimental threading support for flint","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Enabling a threaded version of flint can be done by setting the environment variable NEMO_THREADED=1. To set the actual number of threads, use Nemo.flint_set_num_threads($numberofthreads).","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/conventions/#Conventions","page":"Conventions","title":"Conventions","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"AbstractAlgebra and Nemo have adopted a number of conventions to help maintain a uniform codebase.","category":"page"},{"location":"developer/conventions/#Code-conventions","page":"Conventions","title":"Code conventions","text":"","category":"section"},{"location":"developer/conventions/#Function-and-type-names","page":"Conventions","title":"Function and type names","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Names of types in Julia follow the convention of CamelCase where the first letter of each word is capitalised, e.g. Int64 and AbstractString.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Function/method names in Julia use all lowercase with underscores between the words, e.g. zip and jacobi_symbol.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We follow these conventions in Nemo with some exceptions:","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"When interfacing C libraries the types use the same spelling and capitalisation in Nemo as they do in C, e.g. the Flint library's ZZPolyRingElem remains uncapitalised in Nemo.\nTypes such as fpPolyRingElem which don't exist under that name on the C side also use the lowercase convention as they wrap an actual C type which must be split into more than one type on the Julia side. For example zzModPolyRingElem and fpPolyRingElem on the Julia side both represent Flint zzModPolyRingElem's on the C side.\nTypes of rings and fields, modules, maps, etc. are capitalised whether they correspond to a C type or not, e.g. fqPolyRepField for the type of an object representing the field that fqPolyRepFieldElem's belong to.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":".","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We omit an underscore if the first word of a method is \"is\" or \"has\", e.g. iseven.\nUnderscores are omitted if the method name is already well established without an underscore in Julia itself, e.g. setindex.\nConstructors with the same name as a type use the same spelling and capitalisation as that type, e.g. ZZRingElem(1).\nFunctions for creating rings, fields, modules, maps, etc. (rather than the elements thereof) use CamelCase, e.g. polynomial_ring. We refer to these functions as parent constructors. Note that we do not follow the Julia convention here, e.g. polynomial_ring is a function and not a type constructor (in fact we often return a tuple consisting of a parent object and other objects such as generators with this type of function) yet we capitalise it.\nWe prefer words to not be abbreviated, e.g. denominator instead of den.\nExceptions always exist where the result would be offensive in any major spoken language (example omitted).","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"It is easy to find counterexamples to virtually all these rules. However we have been making efforts to remove the most egregious cases from our codebase over time. As perfect consistency is not possible, work on this has to at times take a back seat.","category":"page"},{"location":"developer/conventions/#Use-of-ASCII-characters","page":"Conventions","title":"Use of ASCII characters","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"All code and printed output in Nemo should use ASCII characters only. This is because we have developers who are using versions of the WSL that cannot correctly display non-ASCII characters.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"This extends to function and operator names, which saves people having to learn how to enter them to use the system.","category":"page"},{"location":"developer/conventions/#Spacing-and-tabs","page":"Conventions","title":"Spacing and tabs","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"All function bodies and control blocks should be indented using spaces.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"A survey of existing code shows 2, 3 or 4 space indenting commonly used in our files. Values outside this range should not be used.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"When contributing to an existing file, follow the majority convention in that file. Consistency within a file is valued highly.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"If you are new to Nemo development and do not already have a very strong preference, new files should be started with 3 space indenting. This maximises the likelihood that copy and paste between files will be straightforward, though modern editors ease this to some degree.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Function signatures in docstrings should have four spaces before them.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Where possible, line lengths should not exceed 80 characters.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We use a term/factor convention for spacing. This means that all (additive) terms have spaces before and after them, (multiplicative) factors usually do not.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"In practice this means that +, -, =, ==, !=, <, >, <=, >= all have spaces before and after them. The operators *, /, ^ and unary minus do not.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"As per English, commas are followed by a single space in expressions. This applies for example to function arguments and tuples.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We do not put spaces immediately inside or before parentheses.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Colons used for ranges do not have spaces before or after them.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Logical operators, &, |, &&, etc. usually have spaces before and after them.","category":"page"},{"location":"developer/conventions/#Comments","page":"Conventions","title":"Comments","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Despite appearances to the contrary, we now prefer code comments explaining the algorithm as it proceeds.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"The hash when used for a comment should always be followed by a space. Full sentences are preferred.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We do not generally use comments in Nemo for questions, complaints or proposals for future improvement. These are better off in a ticket on GitHub with a discussion that will be brought to the attention of all relevant parties.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Any (necessary) limitations of the implementation should be noted in docstrings.","category":"page"},{"location":"developer/conventions/#Layout-of-files","page":"Conventions","title":"Layout of files","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"In Nemo, all types are places in special files with the word \"Types\" in their name, e.g. FlintTypes.jl. This is because Julia must be aware of all types before they are used. Separation of types from implementations makes it easy to ensure this happens.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Abstract types should be put in the file called AbstractTypes.jl at the top level of the src directory.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Most implementation files present functions in a particular order, which is as follows:","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"A header stating what the file is for, and if needed, any copyright notices\nFunctions applying to any \"types\" used in the file, e.g. parent_type, elem_type, base_ring, parent, check_parent.\nBasic manipulation, including hashes, predicates, getters/setters, functions for creating special values (e.g. one, zero and the like), deepcopy_internal. These are usually fairly short functions, often a single line.\nIndexing (getindex, setindex), iteration, views.\nString I/O (expressify and file access, etc.)\nArithmetic operations, usually in multiple sections, such as unary operations, binary operations, ad hoc binary operations (e.g. multiplication of a complex object by a scalar), comparisons, ad hoc comparisons, division, etc.\nMore complex functionality separated into sections based on functionality provided, e.g. gcd, interpolation, special functions, solving, etc.\nFunctions for mapping between different types, coercion, changing base ring, etc.\nUnsafe operators, e.g. mul!, add!, addeq! etc.\nRandom generation\nPromotion rules\nParent object call overload (e.g. for implementing R(2) where R is an object representing a ring or field, etc.)\nAdditional constructors, e.g. matrix, which might be used instead of a parent object to construct elements.\nParent object constructors, e.g. polynomial_ring, etc.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"The exact order within the file is less important than generally following something like the above. This aids in finding functions in a file since all files are more or less set out the same way.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"For an example to follow, see the src/Poly.jl and src/generic/Poly.jl files in AbstractAlgebra which form the oldest and most canonical example.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Headings for sections should be 80 characters wide and formed of hashes in the style that can be seen in each Nemo file.","category":"page"},{"location":"types/#Types-in-Nemo","page":"Types in Nemo","title":"Types in Nemo","text":"","category":"section"},{"location":"types/","page":"Types in Nemo","title":"Types in Nemo","text":"Nemo is fully compatible with AbstractAlgebra.jl, but specialises implementations of various commonly used rings with a highly optimised C implementation, provided by the C libraries wrapped by Nemo.","category":"page"},{"location":"types/","page":"Types in Nemo","title":"Types in Nemo","text":"Below, we give a list of all of the specialised types available in Nemo that implement rings using a specialised C library. The types of elements of the respective rings and other mathematical structures are given, and in parentheses we list the types of the parent objects of the given rings and structures.","category":"page"},{"location":"types/","page":"Types in Nemo","title":"Types in Nemo","text":"Flint\nZZRingElem (ZZRing)\nQQFieldElem (QQField)\nzzModRingElem (zzModRing)\nZZModRingElem (ZZModRing`)\nfqPolyRepFieldElem (fqPolyRepField)\nfpFieldElem (fpField)\nFpFieldElem (FpField)\nFqPolyRepFieldElem (FqPolyRepField)\npadic (FlintPadicField)\nqadic (FlintQadicField)\nZZPolyRingElem (ZZPolyRing)\nQQPolyRingElem (QQPolyRing)\nzzModPolyRingElem (zzModPolyRing)\nZZModPolyRingElem (ZZModPolyRing)\nFqPolyRepPolyRingElem (FqPolyRepPolyRing)\nfqPolyRepPolyRingElem (fqPolyRepPolyRing)\nZZMPolyRingElem (ZZMPolyRing)\nQQMPolyRingElem (QQMPolyRing)\nzzModMPolyRingElem (zzModMPolyRing)\nfqPolyRepMPolyRingElem (fqPolyRepMPolyRing`)\nfpPolyRingElem (fpPolyRing)\nFpPolyRingElem (FpPolyRing)\nZZRelPowerSeriesRingElem (ZZRelPowerSeriesRing)\nZZAbsPowerSeriesRingElem (ZZAbsPowerSeriesRing)\nQQRelPowerSeriesRingElem (QQRelPowerSeriesRing)\nQQAbsPowerSeriesRingElem (QQAbsPowerSeriesRing)\nZZModRelPowerSeriesRingElem (ZZModRelPowerSeriesRing)\nZZModAbsPowerSeriesRingElem (ZZModAbsPowerSeriesRing)\nzzModRelPowerSeriesRingElem (zzModRelPowerSeriesRing)\nzzModAbsPowerSeriesRingElem (zzModAbsPowerSeriesRing)\nfpRelPowerSeriesRingElem (fpRelPowerSeriesRing)\nfpAbsPowerSeriesRingElem (fpAbsPowerSeriesRing)\nFpRelPowerSeriesRingElem (FpRelPowerSeriesRing)\nFpAbsPowerSeriesRingElem (FpAbsPowerSeriesRing)\nfqPolyRepRelPowerSeriesRingElem (fqPolyRepRelPowerSeriesRing)\nfqPolyRepAbsPowerSeriesRingElem (fqPolyRepAbsPowerSeriesRing)\nFqPolyRepRelPowerSeriesRingElem (FqPolyRepRelPowerSeriesRing)\nFqPolyRepAbsPowerSeriesRingElem (FqPolyRepAbsPowerSeriesRing)\nZZMatrix (ZZMatrixSpace)\nQQMatrix (QQMatrixSpace)\nzzModMatrix (zzModMatrixSpace)\nZZModMatrix (ZZModMatrixSpace`)\nfqPolyRepMatrix (fqPolyRepMatrixSpace)\nFqPolyRepMatrix (FqPolyRepMatrixSpace)\nfpMatrix (fpMatrixSpace)\nperm (SymmetricGroup)\nAntic\nnf_elem (AnticNumberField)\nArb\narb (ArbField)\nacb (AcbField)\narb_poly (ArbPolyRing)\nacb_poly (AcbPolyRing)\narb_mat (ArbMatSpace)\nacb_mat (AcbMatSpace)\nCalcium\nqqbar (CalciumQQBarField)\nca (CalciumField)","category":"page"}] +[{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"arb/#Fixed-precision-real-balls","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Fixed precision real ball arithmetic is supplied by Arb which provides a ball representation which tracks error bounds rigorously. Real numbers are represented in mid-rad interval form m pm r = m-r m+r.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The Arb real field is constructed using the ArbField constructor. This constructs the parent object for the Arb real field.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The types of real balls in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Library Field Element type Parent type\nArb mathbbR (balls) arb ArbField","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"All the real field types belong to the Field abstract type and the types of elements in this field, i.e. balls in this case, belong to the FieldElem abstract type.","category":"page"},{"location":"arb/#Real-ball-functionality","page":"Fixed precision real balls","title":"Real ball functionality","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Real balls in Nemo provide all the field functionality described in AbstractAlgebra:","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Below, we document the additional functionality provided for real balls.","category":"page"},{"location":"arb/#Constructors","page":"Fixed precision real balls","title":"Constructors","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"In order to construct real balls in Nemo, one must first construct the Arb real field itself. This is accomplished with the following constructor.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"ArbField(prec::Int)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Return the Arb field with precision in bits prec used for operations on interval midpoints. The precision used for interval radii is a fixed implementation-defined constant (30 bits).","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Here is an example of creating an Arb real field and using the resulting parent object to coerce values into the resulting field.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\na = RR(\"0.25\")\nb = RR(\"0.1 +/- 0.001\")\nc = RR(0.5)\nd = RR(12)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Note that whilst one can coerce double precision floating point values into an Arb real field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb field.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.","category":"page"},{"location":"arb/#Real-ball-constructors","page":"Fixed precision real balls","title":"Real ball constructors","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"ball(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.ball-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.ball","text":"ball(x::arb, y::arb)\n\nConstructs an Arb ball enclosing x_m pm (x_r + y_m + y_r), given the pair (x y) = (x_m pm x_r y_m pm y_r).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\nc = ball(RR(3), RR(\"0.0001\"))","category":"page"},{"location":"arb/#Conversions","page":"Fixed precision real balls","title":"Conversions","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\nconvert(Float64, RR(1//3))","category":"page"},{"location":"arb/#Basic-manipulation","page":"Fixed precision real balls","title":"Basic manipulation","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_nonzero(::arb)","category":"page"},{"location":"arb/#Nemo.is_nonzero-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_nonzero","text":"is_nonzero(x::arb)\n\nReturn true if x is certainly not equal to zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"isfinite(::arb)","category":"page"},{"location":"arb/#Base.isfinite-Tuple{arb}","page":"Fixed precision real balls","title":"Base.isfinite","text":"isfinite(x::arb)\n\nReturn true if x is finite, i.e. having finite midpoint and radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_exact(::arb)","category":"page"},{"location":"arb/#Nemo.is_exact-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_exact","text":"is_exact(x::arb)\n\nReturn true if x is exact, i.e. has zero radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"isinteger(::arb)","category":"page"},{"location":"arb/#Base.isinteger-Tuple{arb}","page":"Fixed precision real balls","title":"Base.isinteger","text":"isinteger(x::arb)\n\nReturn true if x is an exact integer, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_positive(::arb)","category":"page"},{"location":"arb/#Nemo.is_positive-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_positive","text":"is_positive(x::arb)\n\nReturn true if x is certainly positive, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_nonnegative(::arb)","category":"page"},{"location":"arb/#Nemo.is_nonnegative-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_nonnegative","text":"is_nonnegative(x::arb)\n\nReturn true if x is certainly nonnegative, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_negative(::arb)","category":"page"},{"location":"arb/#AbstractAlgebra.is_negative-Tuple{arb}","page":"Fixed precision real balls","title":"AbstractAlgebra.is_negative","text":"is_negative(x::arb)\n\nReturn true if x is certainly negative, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"is_nonpositive(::arb)","category":"page"},{"location":"arb/#Nemo.is_nonpositive-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.is_nonpositive","text":"is_nonpositive(x::arb)\n\nReturn true if x is certainly nonpositive, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"midpoint(::arb)","category":"page"},{"location":"arb/#Nemo.midpoint-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.midpoint","text":"midpoint(x::arb)\n\nReturn the midpoint of the ball x as an Arb ball.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"radius(::arb)","category":"page"},{"location":"arb/#Nemo.radius-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.radius","text":"radius(x::arb)\n\nReturn the radius of the ball x as an Arb ball.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"accuracy_bits(::arb)","category":"page"},{"location":"arb/#Nemo.accuracy_bits-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.accuracy_bits","text":"accuracy_bits(x::arb)\n\nReturn the relative accuracy of x measured in bits, capped between typemax(Int) and -typemax(Int).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\na = RR(\"1.2 +/- 0.001\")\nb = RR(3)\n\nis_positive(a)\nisfinite(b)\nisinteger(b)\nis_negative(a)\nc = radius(a)\nd = midpoint(b)\nf = accuracy_bits(a)","category":"page"},{"location":"arb/#Printing","page":"Fixed precision real balls","title":"Printing","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Printing real balls can at first sight be confusing. Lets look at the following example:","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\na = RR(1)\nb = RR(2)\nc = RR(12)\n\nx = ball(a, b)\ny = ball(c, b)\n\nmid = midpoint(x)\nrad = radius(x)\n\nprint(x, \"\\n\", y, \"\\n\", mid, \"\\n\", rad)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"which generates","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"[+/- 3.01]\n[1e+1 +/- 4.01]\n1.0000000000000000000\n[2.0000000037252902985 +/- 3.81e-20]","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The first reason that c is not printed as [1 +/- 2] is that the midpoint does not have a greater exponent than the radius in its scientific notation. For similar reasons y is not printed as [12 +/- 2].","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The second reason is that we get an additional error term after our addition. As we see, radius(c) is not equal to 2, which when printed rounds it up to a reasonable decimal place. This is because real balls keep track of rounding errors of basic arithmetic.","category":"page"},{"location":"arb/#Containment","page":"Fixed precision real balls","title":"Containment","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"It is often necessary to determine whether a given exact value or ball is contained in a given real ball or whether two balls overlap. The following functions are provided for this purpose.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"overlaps(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.overlaps-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.overlaps","text":"overlaps(x::arb, y::arb)\n\nReturns true if any part of the ball x overlaps any part of the ball y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains(::arb, ::arb)","category":"page"},{"location":"arb/#Base.contains-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::arb)\n\nReturns true if the ball x contains the ball y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains(::arb, ::Integer)\ncontains(::arb, ::ZZRingElem)\ncontains(::arb, ::QQFieldElem)\ncontains{T <: Integer}(::arb, ::Rational{T})\ncontains(::arb, ::BigFloat)","category":"page"},{"location":"arb/#Base.contains-Tuple{arb, Integer}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::Integer)\n\nReturns true if the ball x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/#Base.contains-Tuple{arb, ZZRingElem}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::ZZRingElem)\n\nReturns true if the ball x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/#Base.contains-Tuple{arb, QQFieldElem}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::QQFieldElem)\n\nReturns true if the ball x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/#Base.contains-Union{Tuple{T}, Tuple{arb, Rational{T}}} where T<:Integer","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::Rational{T}) where {T <: Integer}\n\nReturns true if the ball x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/#Base.contains-Tuple{arb, BigFloat}","page":"Fixed precision real balls","title":"Base.contains","text":"contains(x::arb, y::BigFloat)\n\nReturns true if the ball x contains the given floating point value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"The following functions are also provided for determining if a ball intersects a certain part of the real number line.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_zero(::arb)","category":"page"},{"location":"arb/#Nemo.contains_zero-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_zero","text":"contains_zero(x::arb)\n\nReturns true if the ball x contains zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_negative(::arb)","category":"page"},{"location":"arb/#Nemo.contains_negative-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_negative","text":"contains_negative(x::arb)\n\nReturns true if the ball x contains any negative value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_positive(::arb)","category":"page"},{"location":"arb/#Nemo.contains_positive-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_positive","text":"contains_positive(x::arb)\n\nReturns true if the ball x contains any positive value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_nonnegative(::arb)","category":"page"},{"location":"arb/#Nemo.contains_nonnegative-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_nonnegative","text":"contains_nonnegative(x::arb)\n\nReturns true if the ball x contains any nonnegative value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"contains_nonpositive(::arb)","category":"page"},{"location":"arb/#Nemo.contains_nonpositive-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.contains_nonpositive","text":"contains_nonpositive(x::arb)\n\nReturns true if the ball x contains any nonpositive value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"1 +/- 0.001\")\ny = RR(\"3\")\n\noverlaps(x, y)\ncontains(x, y)\ncontains(y, 3)\ncontains(x, ZZ(1)//2)\ncontains_zero(x)\ncontains_positive(y)","category":"page"},{"location":"arb/#Comparison","page":"Fixed precision real balls","title":"Comparison","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Nemo provides a full range of comparison operations for Arb balls. Note that a ball is considered less than another ball if every value in the first ball is less than every value in the second ball, etc.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"In addition to the standard comparison operators, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"isequal(::arb, ::arb)","category":"page"},{"location":"arb/#Base.isequal-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Base.isequal","text":"isequal(x::arb, y::arb)\n\nReturn true if the balls x and y are precisely equal, i.e. have the same midpoints and radii.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"We also provide a full range of ad hoc comparison operators. These are implemented directly in Julia, but we document them as though isless and == were provided.","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Function\n==(x::arb, y::Integer)\n==(x::Integer, y::arb)\n==(x::arb, y::ZZRingElem)\n==(x::ZZRingElem, y::arb)\n==(x::arb, y::Float64)\n==(x::Float64, y::arb)\nisless(x::arb, y::Integer)\nisless(x::Integer, y::arb)\nisless(x::arb, y::ZZRingElem)\nisless(x::ZZRingElem, y::arb)\nisless(x::arb, y::Float64)\nisless(x::Float64, y::arb)\nisless(x::arb, y::BigFloat)\nisless(x::BigFloat, y::arb)\nisless(x::arb, y::QQFieldElem)\nisless(x::QQFieldElem, y::arb)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"1 +/- 0.001\")\ny = RR(\"3\")\nz = RR(\"4\")\n\nisequal(x, deepcopy(x))\nx == 3\nZZ(3) < z\nx != 1.23","category":"page"},{"location":"arb/#Absolute-value","page":"Fixed precision real balls","title":"Absolute value","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"-1 +/- 0.001\")\n\na = abs(x)","category":"page"},{"location":"arb/#Shifting","page":"Fixed precision real balls","title":"Shifting","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"-3 +/- 0.001\")\n\na = ldexp(x, 23)\nb = ldexp(x, -ZZ(15))","category":"page"},{"location":"arb/#Miscellaneous-operations","page":"Fixed precision real balls","title":"Miscellaneous operations","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"add_error!(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.add_error!-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.add_error!","text":"add_error!(x::arb, y::arb)\n\nAdds the absolute values of the midpoint and radius of y to the radius of x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"trim(::arb)","category":"page"},{"location":"arb/#Nemo.trim-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.trim","text":"trim(x::arb)\n\nReturn an arb interval containing x but which may be more economical, by rounding off insignificant bits from the midpoint.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"unique_integer(::arb)","category":"page"},{"location":"arb/#Nemo.unique_integer-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.unique_integer","text":"unique_integer(x::arb)\n\nReturn a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the interval x contains a unique integer. If this is the case, the second return value is set to this unique integer.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"setunion(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.setunion-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.setunion","text":"setunion(x::arb, y::arb)\n\nReturn an arb containing the union of the intervals represented by x and y.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nx = RR(\"-3 +/- 0.001\")\ny = RR(\"2 +/- 0.5\")\n\na = trim(x)\nb, c = unique_integer(x)\nd = setunion(x, y)","category":"page"},{"location":"arb/#Constants","page":"Fixed precision real balls","title":"Constants","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_pi(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_pi-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_pi","text":"const_pi(r::ArbField)\n\nReturn pi = 314159ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_e(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_e-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_e","text":"const_e(r::ArbField)\n\nReturn e = 271828ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_log2(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_log2-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_log2","text":"const_log2(r::ArbField)\n\nReturn log(2) = 069314ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_log10(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_log10-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_log10","text":"const_log10(r::ArbField)\n\nReturn log(10) = 2302585ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_euler(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_euler-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_euler","text":"const_euler(r::ArbField)\n\nReturn Euler's constant gamma = 0577215ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_catalan(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_catalan-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_catalan","text":"const_catalan(r::ArbField)\n\nReturn Catalan's constant C = 0915965ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_khinchin(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_khinchin-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_khinchin","text":"const_khinchin(r::ArbField)\n\nReturn Khinchin's constant K = 2685452ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"const_glaisher(::ArbField)","category":"page"},{"location":"arb/#Nemo.const_glaisher-Tuple{ArbField}","page":"Fixed precision real balls","title":"Nemo.const_glaisher","text":"const_glaisher(r::ArbField)\n\nReturn Glaisher's constant A = 1282427ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(200)\n\na = const_pi(RR)\nb = const_e(RR)\nc = const_euler(RR)\nd = const_glaisher(RR)","category":"page"},{"location":"arb/#Mathematical-and-special-functions","page":"Fixed precision real balls","title":"Mathematical and special functions","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rsqrt(::arb)","category":"page"},{"location":"arb/#Nemo.rsqrt-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.rsqrt","text":"rsqrt(x::arb)\n\nReturn the reciprocal of the square root of x, i.e. 1sqrtx.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"sqrt1pm1(::arb)","category":"page"},{"location":"arb/#Nemo.sqrt1pm1-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.sqrt1pm1","text":"sqrt1pm1(x::arb)\n\nReturn sqrt1+x-1, evaluated accurately for small x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"sqrtpos(::arb)","category":"page"},{"location":"arb/#Nemo.sqrtpos-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.sqrtpos","text":"sqrtpos(x::arb)\n\nReturn the sqrt root of x, assuming that x represents a nonnegative number. Thus any negative number in the input interval is discarded.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma(::arb)","category":"page"},{"location":"arb/#Nemo.gamma-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.gamma","text":"gamma(x::arb)\n\nReturn the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"lgamma(::arb)","category":"page"},{"location":"arb/#Nemo.lgamma-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.lgamma","text":"lgamma(x::arb)\n\nReturn the logarithm of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rgamma(::arb)","category":"page"},{"location":"arb/#Nemo.rgamma-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.rgamma","text":"rgamma(x::arb)\n\nReturn the reciprocal of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"digamma(::arb)","category":"page"},{"location":"arb/#Nemo.digamma-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.digamma","text":"digamma(x::arb)\n\nReturn the logarithmic derivative of the gamma function evaluated at x, i.e. psi(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.gamma-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.gamma","text":"gamma(s::arb, x::arb)\n\nReturn the upper incomplete gamma function Gamma(sx).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma_regularized(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.gamma_regularized-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.gamma_regularized","text":"gamma_regularized(s::arb, x::arb)\n\nReturn the regularized upper incomplete gamma function Gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma_lower(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.gamma_lower-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.gamma_lower","text":"gamma_lower(s::arb, x::arb)\n\nReturn the lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma_lower_regularized(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.gamma_lower_regularized-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.gamma_lower_regularized","text":"gamma_lower_regularized(s::arb, x::arb)\n\nReturn the regularized lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"zeta(::arb)","category":"page"},{"location":"arb/#Nemo.zeta-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.zeta","text":"zeta(x::arb)\n\nReturn the Riemann zeta function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"atan2(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.atan2-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.atan2","text":"atan2(y::arb, x::arb)\n\nReturn operatornameatan2(yx) = arg(x+yi). Same as atan(y, x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"agm(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.agm-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.agm","text":"agm(x::arb, y::arb)\n\nReturn the arithmetic-geometric mean of x and y\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"zeta(::arb, ::arb)","category":"page"},{"location":"arb/#Nemo.zeta-Tuple{arb, arb}","page":"Fixed precision real balls","title":"Nemo.zeta","text":"zeta(s::arb, a::arb)\n\nReturn the Hurwitz zeta function zeta(sa).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"root(::arb, ::Int)","category":"page"},{"location":"arb/#AbstractAlgebra.root-Tuple{arb, Int64}","page":"Fixed precision real balls","title":"AbstractAlgebra.root","text":"root(x::arb, n::Int)\n\nReturn the n-th root of x. We require x geq 0.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"factorial(::arb)","category":"page"},{"location":"arb/#Base.factorial-Tuple{arb}","page":"Fixed precision real balls","title":"Base.factorial","text":"factorial(x::arb)\n\nReturn the factorial of x.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"factorial(::Int, ::ArbField)","category":"page"},{"location":"arb/#Base.factorial-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Base.factorial","text":"factorial(n::Int, r::ArbField)\n\nReturn the factorial of n in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"binomial(::arb, ::UInt)","category":"page"},{"location":"arb/#Base.binomial-Tuple{arb, UInt64}","page":"Fixed precision real balls","title":"Base.binomial","text":"binomial(x::arb, n::UInt)\n\nReturn the binomial coefficient x choose n.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"binomial(::UInt, ::UInt, ::ArbField)","category":"page"},{"location":"arb/#Base.binomial-Tuple{UInt64, UInt64, ArbField}","page":"Fixed precision real balls","title":"Base.binomial","text":"binomial(n::UInt, k::UInt, r::ArbField)\n\nReturn the binomial coefficient n choose k in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"fibonacci(::ZZRingElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.fibonacci-Tuple{ZZRingElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.fibonacci","text":"fibonacci(n::ZZRingElem, r::ArbField)\n\nReturn the n-th Fibonacci number in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"fibonacci(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.fibonacci-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.fibonacci","text":"fibonacci(n::Int, r::ArbField)\n\nReturn the n-th Fibonacci number in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma(::ZZRingElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.gamma-Tuple{ZZRingElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.gamma","text":"gamma(x::ZZRingElem, r::ArbField)\n\nReturn the Gamma function evaluated at x in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"gamma(::QQFieldElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.gamma-Tuple{QQFieldElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.gamma","text":"gamma(x::QQFieldElem, r::ArbField)\n\nReturn the Gamma function evaluated at x in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"zeta(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.zeta-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.zeta","text":"zeta(n::Int, r::ArbField)\n\nReturn the Riemann zeta function zeta(n) as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"bernoulli(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.bernoulli-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.bernoulli","text":"bernoulli(n::Int, r::ArbField)\n\nReturn the n-th Bernoulli number as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rising_factorial(::arb, ::Int)","category":"page"},{"location":"arb/#Nemo.rising_factorial-Tuple{arb, Int64}","page":"Fixed precision real balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::arb, n::Int)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an Arb.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rising_factorial(::QQFieldElem, ::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.rising_factorial-Tuple{QQFieldElem, Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::QQFieldElem, n::Int, r::ArbField)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rising_factorial2(::arb, ::Int)","category":"page"},{"location":"arb/#Nemo.rising_factorial2-Tuple{arb, Int64}","page":"Fixed precision real balls","title":"Nemo.rising_factorial2","text":"rising_factorial2(x::arb, n::Int)\n\nReturn a tuple containing the rising factorial x(x + 1)ldots (x + n - 1) and its derivative.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"polylog(::Union{arb,Int}, ::arb)","category":"page"},{"location":"arb/#Nemo.polylog-Tuple{Union{Int64, arb}, arb}","page":"Fixed precision real balls","title":"Nemo.polylog","text":"polylog(s::Union{arb,Int}, a::arb)\n\nReturn the polylogarithm Li_s(a).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"chebyshev_t(::Int, ::arb)","category":"page"},{"location":"arb/#AbstractAlgebra.chebyshev_t-Tuple{Int64, arb}","page":"Fixed precision real balls","title":"AbstractAlgebra.chebyshev_t","text":"chebyshev_t(n::Int, x::arb)\n\nReturn the value of the Chebyshev polynomial T_n(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"chebyshev_u(::Int, ::arb)","category":"page"},{"location":"arb/#AbstractAlgebra.chebyshev_u-Tuple{Int64, arb}","page":"Fixed precision real balls","title":"AbstractAlgebra.chebyshev_u","text":"chebyshev_u(n::Int, x::arb)\n\nReturn the value of the Chebyshev polynomial U_n(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"chebyshev_t2(::Int, ::arb)","category":"page"},{"location":"arb/#Nemo.chebyshev_t2-Tuple{Int64, arb}","page":"Fixed precision real balls","title":"Nemo.chebyshev_t2","text":"chebyshev_t2(n::Int, x::arb)\n\nReturn the tuple (T_n(x) T_n-1(x)).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"chebyshev_u2(::Int, ::arb)","category":"page"},{"location":"arb/#Nemo.chebyshev_u2-Tuple{Int64, arb}","page":"Fixed precision real balls","title":"Nemo.chebyshev_u2","text":"chebyshev_u2(n::Int, x::arb)\n\nReturn the tuple (U_n(x) U_n-1(x))\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"bell(::ZZRingElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.bell-Tuple{ZZRingElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.bell","text":"bell(n::ZZRingElem, r::ArbField)\n\nReturn the Bell number B_n as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"bell(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.bell-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.bell","text":"bell(n::Int, r::ArbField)\n\nReturn the Bell number B_n as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"numpart(::ZZRingElem, ::ArbField)","category":"page"},{"location":"arb/#Nemo.numpart-Tuple{ZZRingElem, ArbField}","page":"Fixed precision real balls","title":"Nemo.numpart","text":"numpart(n::ZZRingElem, r::ArbField)\n\nReturn the number of partitions p(n) as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"numpart(::Int, ::ArbField)","category":"page"},{"location":"arb/#Nemo.numpart-Tuple{Int64, ArbField}","page":"Fixed precision real balls","title":"Nemo.numpart","text":"numpart(n::Int, r::ArbField)\n\nReturn the number of partitions p(n) as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"airy_ai(::arb)","category":"page"},{"location":"arb/#Nemo.airy_ai-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.airy_ai","text":"airy_ai(x::arb)\n\nReturn the Airy function operatornameAi(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"airy_ai_prime(::arb)","category":"page"},{"location":"arb/#Nemo.airy_ai_prime-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.airy_ai_prime","text":"airy_ai_prime(x::arb)\n\nReturn the derivative of the Airy function operatornameAi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"airy_bi(::arb)","category":"page"},{"location":"arb/#Nemo.airy_bi-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.airy_bi","text":"airy_bi(x::arb)\n\nReturn the Airy function operatornameBi(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"airy_bi_prime(::arb)","category":"page"},{"location":"arb/#Nemo.airy_bi_prime-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.airy_bi_prime","text":"airy_bi_prime(x::arb)\n\nReturn the derivative of the Airy function operatornameBi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\n\na = floor(exp(RR(1)))\nb = sinpi(QQ(5,6), RR)\nc = gamma(QQ(1,3), ArbField(256))\nd = bernoulli(1000, ArbField(53))\nf = polylog(3, RR(-10))","category":"page"},{"location":"arb/#Linear-dependence","page":"Fixed precision real balls","title":"Linear dependence","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"lindep(::Vector{arb}, n::Int)","category":"page"},{"location":"arb/#Nemo.lindep-Tuple{Vector{arb}, Int64}","page":"Fixed precision real balls","title":"Nemo.lindep","text":"lindep(A::Vector{arb}, bits::Int)\n\nFind a small linear combination of the entries of the array A that is small (using LLL). The entries are first scaled by the given number of bits before truncating to integers for use in LLL. This function can be used to find linear dependence between a list of real numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.\n\nExamples\n\njulia> RR = ArbField(64)\nReal Field with 64 bits of precision and error bounds\n\njulia> a = RR(-0.33198902958450931620250069492231652319)\n[-0.33198902958450932088 +/- 4.15e-22]\n\njulia> V = [RR(1), a, a^2, a^3, a^4, a^5]\n6-element Vector{arb}:\n 1.0000000000000000000\n [-0.33198902958450932088 +/- 4.15e-22]\n [0.11021671576446420510 +/- 7.87e-21]\n [-0.03659074051063616184 +/- 4.17e-21]\n [0.012147724433904692427 +/- 4.99e-22]\n [-0.004032911246472051677 +/- 6.25e-22]\n\njulia> W = lindep(V, 20)\n6-element Vector{ZZRingElem}:\n 1\n 3\n 0\n 0\n 0\n 1\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(128)\n\na = RR(-0.33198902958450931620250069492231652319)\n\nV = [RR(1), a, a^2, a^3, a^4, a^5]\nW = lindep(V, 20)","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"simplest_rational_inside(::arb)","category":"page"},{"location":"arb/#Nemo.simplest_rational_inside-Tuple{arb}","page":"Fixed precision real balls","title":"Nemo.simplest_rational_inside","text":" simplest_rational_inside(x::arb)\n\nReturn the simplest fraction inside the ball x. A canonical fraction a_1b_1 is defined to be simpler than a_2b_2 iff b_1 b_2 or b_1 = b_2 and a_1 a_2.\n\nExamples\n\njulia> RR = ArbField(64)\nReal Field with 64 bits of precision and error bounds\n\njulia> simplest_rational_inside(const_pi(RR))\n8717442233//2774848045\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(64)\nsimplest_rational_inside(const_pi(RR))","category":"page"},{"location":"arb/#Random-generation","page":"Fixed precision real balls","title":"Random generation","text":"","category":"section"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"rand(::ArbField)","category":"page"},{"location":"arb/#Base.rand-Tuple{ArbField}","page":"Fixed precision real balls","title":"Base.rand","text":"rand(r::ArbField; randtype::Symbol=:urandom)\n\nReturn a random element in given Arb field.\n\nThe randtype default is :urandom which return an arb contained in 01.\n\nThe rest of the methods return non-uniformly distributed values in order to exercise corner cases. The option :randtest will return a finite number, and :randtest_exact the same but with a zero radius. The option :randtest_precise return an arb with a radius around 2^-mathrmprec the magnitude of the midpoint, while :randtest_wide return a radius that might be big relative to its midpoint. The :randtest_special-option might return a midpoint and radius whose values are NaN or inf.\n\n\n\n\n\n","category":"method"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"Examples","category":"page"},{"location":"arb/","page":"Fixed precision real balls","title":"Fixed precision real balls","text":"RR = ArbField(100)\n\na = rand(RR)\nb = rand(RR; randtype = :null_exact)\nc = rand(RR; randtype = :exact)\nd = rand(RR; randtype = :special)","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"polynomial/#Univariate-polynomials","page":"Univariate polynomials","title":"Univariate polynomials","text":"","category":"section"},{"location":"polynomial/#Introduction","page":"Univariate polynomials","title":"Introduction","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Nemo allow the creation of dense, univariate polynomials over any computable ring R. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of polynomials over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"The following table shows each of the polynomial types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of polynomial (the type information is mainly of concern to developers).","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.Poly{T} Generic.PolyRing{T}\nmathbbZ Flint ZZPolyRingElem ZZPolyRing\nmathbbZnmathbbZ (small n) Flint zzModPolyRingElem zzModPolyRing\nmathbbZnmathbbZ (large n) Flint ZZModPolyRingElem ZZModPolyRing\nmathbbQ Flint QQPolyRingElem QQPolyRing\nmathbbZpmathbbZ (small prime p) Flint fpPolyRingElem fpPolyRing\nmathbbZpmathbbZ (large prime p) Flint FpPolyRingElem FpPolyRing\nmathbbF_p^n (small p) Flint fqPolyRepPolyRingElem fqPolyRepPolyRing\nmathbbF_p^n (large p) Flint FqPolyRepPolyRingElem FqPolyRepPolyRing\nmathbbR (arbitrary precision) Arb RealPoly RealPolyRing\nmathbbC (arbitrary precision) Arb ComplexPoly ComplexPolyRing\nmathbbR (fixed precision) Arb arb_poly ArbPolyRing\nmathbbC (fixed precision) Arb acb_poly AcbPolyRing","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"The string representation of the variable and the base ring R of a generic polynomial is stored in its parent object. ","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"All polynomial element types belong to the abstract type PolyRingElem and all of the polynomial ring types belong to the abstract type PolyRing. This enables one to write generic functions that can accept any Nemo univariate polynomial type.","category":"page"},{"location":"polynomial/#Polynomial-functionality","page":"Univariate polynomials","title":"Polynomial functionality","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"All univariate polynomial types in Nemo provide the AbstractAlgebra univariate polynomial functionality:","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/polynomial","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Generic polynomials are also available.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"We describe here only functions that are in addition to that guaranteed by AbstractAlgebra.jl, for specific coefficient rings.","category":"page"},{"location":"polynomial/#Remove-and-valuation","page":"Univariate polynomials","title":"Remove and valuation","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"evaluate2(::RealPoly, ::RealFieldElem)","category":"page"},{"location":"polynomial/#Nemo.evaluate2-Tuple{RealPoly, RealFieldElem}","page":"Univariate polynomials","title":"Nemo.evaluate2","text":"evaluate2(x::RealPoly, y::RingElement)\n\nReturn a tuple p q consisting of the polynomial x evaluated at y and its derivative evaluated at y.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"evaluate2(::ComplexPoly, ::ComplexFieldElem)","category":"page"},{"location":"polynomial/#Nemo.evaluate2-Tuple{ComplexPoly, ComplexFieldElem}","page":"Univariate polynomials","title":"Nemo.evaluate2","text":"evaluate2(x::ComplexPoly, y::RingElement; prec::Int = precision(Balls))\n\nReturn a tuple p q consisting of the polynomial x evaluated at y and its derivative evaluated at y.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"RR = RealField(64)\nT, z = polynomial_ring(RR, \"z\")\n \nh = z^2 + 2z + 1\n\ns, t = evaluate2(h, RR(\"2.0 +/- 0.1\"))","category":"page"},{"location":"polynomial/#Signature","page":"Univariate polynomials","title":"Signature","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"signature(::ZZPolyRingElem)\nsignature(::QQPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.signature-Tuple{ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.signature","text":"signature(f::ZZPolyRingElem)\n\nReturn the signature of f, i.e. a tuple (r s) such that r is the number of real roots of f and s is half the number of complex roots.\n\nExamples\n\njulia> R, x = polynomial_ring(ZZ, \"x\");\n\njulia> signature(x^3 + 3x + 1)\n(1, 1)\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.signature-Tuple{QQPolyRingElem}","page":"Univariate polynomials","title":"Nemo.signature","text":"signature(f::QQPolyRingElem)\n\nReturn the signature of f, i.e. a tuple (r s) such that r is the number of real roots of f and s is half the number of complex roots.\n\nExamples\n\njulia> R, x = polynomial_ring(QQ, \"x\");\n\njulia> signature(x^3 + 3x + 1)\n(1, 1)\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Root-finding","page":"Univariate polynomials","title":"Root finding","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"roots(::ComplexPoly)","category":"page"},{"location":"polynomial/#AbstractAlgebra.Generic.roots-Tuple{ComplexPoly}","page":"Univariate polynomials","title":"AbstractAlgebra.Generic.roots","text":"roots(x::ComplexPoly; target=0, isolate_real=false, initial_prec=0, max_prec=0, max_iter=0)\n\nAttempts to isolate the complex roots of the complex polynomial x by iteratively refining balls in which they lie.\n\nThis is done by increasing the working precision, starting at initial_prec. The maximal number of iterations can be set using max_iter and the maximal precision can be set using max_prec.\n\nIf isolate_real is set and x is strictly real, then the real roots will be isolated from the non-real roots. Every root will have either zero, positive or negative real part.\n\nIt is assumed that x is squarefree.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"CC = ComplexField(64)\nC, y = polynomial_ring(CC, \"y\")\n\nm = y^2 + 2y + 3\nn = m + CC(\"0 +/- 0.0001\", \"0 +/- 0.0001\")\n\nr = roots(n)\n\np = y^7 - 1\n\nr = roots(n, isolate_real = true)","category":"page"},{"location":"polynomial/#Construction-from-roots","page":"Univariate polynomials","title":"Construction from roots","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"from_roots(::ArbPolyRing, ::Vector{arb})\nfrom_roots(::AcbPolyRing, ::Vector{acb})","category":"page"},{"location":"polynomial/#Nemo.from_roots-Tuple{ArbPolyRing, Vector{arb}}","page":"Univariate polynomials","title":"Nemo.from_roots","text":"from_roots(R::ArbPolyRing, b::Vector{arb})\n\nConstruct a polynomial in the given polynomial ring from a list of its roots.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.from_roots-Tuple{AcbPolyRing, Vector{acb}}","page":"Univariate polynomials","title":"Nemo.from_roots","text":"from_roots(R::AcbPolyRing, b::Vector{acb})\n\nConstruct a polynomial in the given polynomial ring from a list of its roots.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"RR = RealField(64)\nR, x = polynomial_ring(RR, \"x\")\n\nxs = arb[inv(RR(i)) for i=1:5]\nf = from_roots(R, xs)","category":"page"},{"location":"polynomial/#Bounding-absolute-values-of-roots","page":"Univariate polynomials","title":"Bounding absolute values of roots","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"roots_upper_bound(::RealPoly)\nroots_upper_bound(::ComplexPoly)","category":"page"},{"location":"polynomial/#Nemo.roots_upper_bound-Tuple{RealPoly}","page":"Univariate polynomials","title":"Nemo.roots_upper_bound","text":"roots_upper_bound(x::RealPoly) -> arb\n\nReturns an upper bound for the absolute value of all complex roots of x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.roots_upper_bound-Tuple{ComplexPoly}","page":"Univariate polynomials","title":"Nemo.roots_upper_bound","text":"roots_upper_bound(x::ComplexPoly) -> arb\n\nReturns an upper bound for the absolute value of all complex roots of x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Lifting","page":"Univariate polynomials","title":"Lifting","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"When working over a residue ring it is useful to be able to lift to the base ring of the residue ring, e.g. from mathbbZnmathbbZ to mathbbZ.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"lift(::ZZPolyRing, ::zzModPolyRingElem)\nlift(::ZZPolyRing, ::fpPolyRingElem)\nlift(::ZZPolyRing, ::ZZModPolyRingElem)\nlift(::ZZPolyRing, ::FpPolyRingElem)","category":"page"},{"location":"polynomial/#AbstractAlgebra.lift-Tuple{ZZPolyRing, zzModPolyRingElem}","page":"Univariate polynomials","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, y::zzModPolyRingElem)\n\nLift from a polynomial over mathbbZnmathbbZ to a polynomial over mathbbZ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#AbstractAlgebra.lift-Tuple{ZZPolyRing, fpPolyRingElem}","page":"Univariate polynomials","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, y::fpPolyRingElem)\n\nLift from a polynomial over mathbbZnmathbbZ to a polynomial over mathbbZ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#AbstractAlgebra.lift-Tuple{ZZPolyRing, ZZModPolyRingElem}","page":"Univariate polynomials","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, y::ZZModPolyRingElem)\n\nLift from a polynomial over mathbbZnmathbbZ to a polynomial over mathbbZ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#AbstractAlgebra.lift-Tuple{ZZPolyRing, FpPolyRingElem}","page":"Univariate polynomials","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, y::FpPolyRingElem)\n\nLift from a polynomial over mathbbZnmathbbZ to a polynomial over mathbbZ with minimal reduced nonnegative coefficients. The ring R specifies the ring to lift into.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"R = residue_ring(ZZ, 123456789012345678949)\nS, x = polynomial_ring(R, \"x\")\nT, y = polynomial_ring(ZZ, \"y\")\n\nf = x^2 + 2x + 1\n\na = lift(T, f)","category":"page"},{"location":"polynomial/#Overlapping-and-containment","page":"Univariate polynomials","title":"Overlapping and containment","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Occasionally it is useful to be able to tell when inexact polynomials overlap or contain other exact or inexact polynomials. The following functions are provided for this purpose.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"overlaps(::RealPoly, ::RealPoly)\noverlaps(::ComplexPoly, ::ComplexPoly)","category":"page"},{"location":"polynomial/#Nemo.overlaps-Tuple{RealPoly, RealPoly}","page":"Univariate polynomials","title":"Nemo.overlaps","text":"overlaps(x::RealPoly, y::RealPoly)\n\nReturn true if the coefficient balls of x overlap the coefficient balls of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.overlaps-Tuple{ComplexPoly, ComplexPoly}","page":"Univariate polynomials","title":"Nemo.overlaps","text":"overlaps(x::ComplexPoly, y::ComplexPoly)\n\nReturn true if the coefficient boxes of x overlap the coefficient boxes of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"contains(::RealPoly, ::RealPoly)\ncontains(::ComplexPoly, ::ComplexPoly)","category":"page"},{"location":"polynomial/#Base.contains-Tuple{RealPoly, RealPoly}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::RealPoly, y::RealPoly)\n\nReturn true if the coefficient balls of x contain the corresponding coefficient balls of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Base.contains-Tuple{ComplexPoly, ComplexPoly}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::ComplexPoly, y::ComplexPoly)\n\nReturn true if the coefficient boxes of x contain the corresponding coefficient boxes of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"contains(::RealPoly, ::ZZPolyRingElem)\ncontains(::RealPoly, ::QQPolyRingElem)\ncontains(::ComplexPoly, ::ZZPolyRingElem)\ncontains(::ComplexPoly, ::QQPolyRingElem)","category":"page"},{"location":"polynomial/#Base.contains-Tuple{RealPoly, ZZPolyRingElem}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::RealPoly, y::ZZPolyRingElem)\n\nReturn true if the coefficient balls of x contain the corresponding exact coefficients of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Base.contains-Tuple{RealPoly, QQPolyRingElem}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::RealPoly, y::QQPolyRingElem)\n\nReturn true if the coefficient balls of x contain the corresponding exact coefficients of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Base.contains-Tuple{ComplexPoly, ZZPolyRingElem}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::ComplexPoly, y::ZZPolyRingElem)\n\nReturn true if the coefficient boxes of x contain the corresponding exact coefficients of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Base.contains-Tuple{ComplexPoly, QQPolyRingElem}","page":"Univariate polynomials","title":"Base.contains","text":"contains(x::ComplexPoly, y::QQPolyRingElem)\n\nReturn true if the coefficient boxes of x contain the corresponding exact coefficients of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"It is sometimes also useful to be able to determine if there is a unique integer contained in the coefficient of an inexact constant polynomial.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"unique_integer(::RealPoly)\nunique_integer(::ComplexPoly)","category":"page"},{"location":"polynomial/#Nemo.unique_integer-Tuple{RealPoly}","page":"Univariate polynomials","title":"Nemo.unique_integer","text":"unique_integer(x::RealPoly)\n\nReturn a tuple (t, z) where t is true if there is a unique integer contained in each of the coefficients of x, otherwise sets t to false. In the former case, z is set to the integer polynomial.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.unique_integer-Tuple{ComplexPoly}","page":"Univariate polynomials","title":"Nemo.unique_integer","text":"unique_integer(x::ComplexPoly)\n\nReturn a tuple (t, z) where t is true if there is a unique integer contained in the (constant) polynomial x, along with that integer z in case it is, otherwise sets t to false.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"RR = RealField(64)\nCC = ComplexField(64)\nR, x = polynomial_ring(RR, \"x\")\nC, y = polynomial_ring(CC, \"y\")\nZx, zx = polynomial_ring(ZZ, \"x\")\nQx, qx = polynomial_ring(QQ, \"x\")\n\nf = x^2 + 2x + 1\nh = f + RR(\"0 +/- 0.0001\")\nk = f + RR(\"0 +/- 0.0001\") * x^4\nm = y^2 + 2y + 1\nn = m + CC(\"0 +/- 0.0001\", \"0 +/- 0.0001\")\n\ncontains(h, f)\noverlaps(f, k)\ncontains(n, m)\nt, z = unique_integer(k)\nisreal(n)","category":"page"},{"location":"polynomial/#Factorisation","page":"Univariate polynomials","title":"Factorisation","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Certain polynomials can be factored (ZZPolyRingElem',zzModPolyRingElem,fpPolyRingElem,ZZModPolyRingElem,FpPolyRingElem,FqPolyRepPolyRingElem,fqPolyRepPolyRingElem`) and the interface follows the specification in AbstractAlgebra.jl. The following additional functions are available.","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"factor_distinct_deg(::zzModPolyRingElem)\nfactor_distinct_deg(::fpPolyRingElem)\nfactor_distinct_deg(::ZZModPolyRingElem)\nfactor_distinct_deg(::FpPolyRingElem)\nfactor_distinct_deg(::FqPolyRepPolyRingElem)\nfactor_distinct_deg(::fqPolyRepPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{zzModPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::zzModPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{fpPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::fpPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{ZZModPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::ZZModPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{FpPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::ZZModPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{FqPolyRepPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::FqPolyRepPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/#Nemo.factor_distinct_deg-Tuple{fqPolyRepPolyRingElem}","page":"Univariate polynomials","title":"Nemo.factor_distinct_deg","text":"factor_distinct_deg(x::fqPolyRepPolyRingElem)\n\nReturn the distinct degree factorisation of a squarefree polynomial x.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"R = residue_ring(ZZ, 23)\nS, x = polynomial_ring(R, \"x\")\n\nf = x^2 + 2x + 1\ng = x^3 + 3x + 1\n\nR = factor(f*g)\nS = factor_squarefree(f*g)\nT = factor_distinct_deg((x + 1)*g*(x^5+x^3+x+1))","category":"page"},{"location":"polynomial/#Special-functions","page":"Univariate polynomials","title":"Special functions","text":"","category":"section"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"cyclotomic(::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.cyclotomic-Tuple{Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.cyclotomic","text":"cyclotomic(n::Int, x::ZZPolyRingElem)\n\nReturn the nth cyclotomic polynomial, defined as Phi_n(x) = prod_omega (x-omega) where omega runs over all the nth primitive roots of unity.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"swinnerton_dyer(::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.swinnerton_dyer-Tuple{Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.swinnerton_dyer","text":"swinnerton_dyer(n::Int, x::ZZPolyRingElem)\n\nReturn the Swinnerton-Dyer polynomial S_n, defined as the integer polynomial S_n = prod (x pm sqrt2 pm sqrt3 pm sqrt5 pm ldots pm sqrtp_n) where p_n denotes the n-th prime number and all combinations of signs are taken. This polynomial has degree 2^n and is irreducible over the integers (it is the minimal polynomial of sqrt2 + ldots + sqrtp_n).\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"cos_minpoly(::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.cos_minpoly-Tuple{Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.cos_minpoly","text":"cos_minpoly(n::Int, x::ZZPolyRingElem)\n\nReturn the minimal polynomial of 2 cos(2 pi n). For suitable choice of n, this gives the minimal polynomial of 2 cos(a pi) or 2 sin(a pi) for any rational a.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"theta_qexp(::Int, ::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.theta_qexp-Tuple{Int64, Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.theta_qexp","text":"theta_qexp(e::Int, n::Int, x::ZZPolyRingElem)\n\nReturn the q-expansion to length n of the Jacobi theta function raised to the power r, i.e. vartheta(q)^r where vartheta(q) = 1 + sum_k=1^infty q^k^2.\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"eta_qexp(::Int, ::Int, ::ZZPolyRingElem)","category":"page"},{"location":"polynomial/#Nemo.eta_qexp-Tuple{Int64, Int64, ZZPolyRingElem}","page":"Univariate polynomials","title":"Nemo.eta_qexp","text":"eta_qexp(e::Int, n::Int, x::ZZPolyRingElem)\n\nReturn the q-expansion to length n of the Dedekind eta function (without the leading factor q^124) raised to the power r, i.e. (q^-124 eta(q))^r = prod_k=1^infty (1 - q^k)^r. In particular, r = -1 gives the generating function of the partition function p(k), and r = 24 gives, after multiplication by q, the modular discriminant Delta(q) which generates the Ramanujan tau function tau(k).\n\n\n\n\n\n","category":"method"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"Examples","category":"page"},{"location":"polynomial/","page":"Univariate polynomials","title":"Univariate polynomials","text":"R, x = polynomial_ring(ZZ, \"x\")\nS, y = polynomial_ring(R, \"y\")\n\nh = cyclotomic(120, x)\nj = swinnerton_dyer(5, x)\nk = cos_minpoly(30, x)\nl = theta_qexp(3, 30, x)\nm = eta_qexp(24, 30, x)\no = cyclotomic(10, 1 + x + x^2)","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"real/#Arbitrary-precision-real-balls","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Arbitrary precision real ball arithmetic is supplied by Arb which provides a ball representation which tracks error bounds rigorously. Real numbers are represented in mid-rad interval form m pm r = m-r m+r.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The types of real balls in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Library Field Element type Parent type\nArb mathbbR (balls) RealFieldElem RealField","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The real field types belong to the Field abstract type and the types of elements in this field, i.e. balls in this case, belong to the FieldElem abstract type.","category":"page"},{"location":"real/#Real-ball-functionality","page":"Arbitrary precision real balls","title":"Real ball functionality","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Real balls in Nemo provide all the field functionality described in AbstractAlgebra:","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Below, we document the additional functionality provided for real balls.","category":"page"},{"location":"real/#precision_management","page":"Arbitrary precision real balls","title":"Precision management","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Precision for ball arithmetic and creation of elements can be controlled using the functions:","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"precision(::Type{Balls})\nset_precision!(::Type{Balls}, n::Int)\nset_precision!(f::Any, ::Type{Balls}, n::Int)","category":"page"},{"location":"real/#Base.precision-Tuple{Type{Balls}}","page":"Arbitrary precision real balls","title":"Base.precision","text":"precision(::Type{Balls})\n\nReturn the precision for ball arithmetic.\n\nExamples\n\njulia> set_precision!(Balls, 200); precision(Balls)\n200\n\n\n\n\n\n","category":"method"},{"location":"real/#AbstractAlgebra.set_precision!-Tuple{Type{Balls}, Int64}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.set_precision!","text":"set_precision!(::Type{Balls}, n::Int)\n\nSet the precision for all ball arithmetic to be n.\n\nExamples\n\njulia> const_pi(RealField())\n[3.141592653589793239 +/- 5.96e-19]\n\njulia> set_precision!(Balls, 200); const_pi(RealField())\n[3.14159265358979323846264338327950288419716939937510582097494 +/- 5.73e-60]\n\n\n\n\n\n","category":"method"},{"location":"real/#AbstractAlgebra.set_precision!-Tuple{Any, Type{Balls}, Int64}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.set_precision!","text":"set_precision!(f, ::Type{Balls}, n::Int)\n\nChange ball arithmetic precision to n for the duration of f..\n\nExamples\n\njulia> set_precision!(Balls, 4) do\n const_pi(RealField())\n end\n[3e+0 +/- 0.376]\n\njulia> set_precision!(Balls, 200) do\n const_pi(RealField())\n end\n[3.1415926535897932385 +/- 3.74e-20]\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"info: Info\nThis functions are not thread-safe.","category":"page"},{"location":"real/#Constructors","page":"Arbitrary precision real balls","title":"Constructors","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"In order to construct real balls in Nemo, one must first construct the Arb real field itself. This is accomplished with the following constructor.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"RealField()","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Here is an example of creating the real field and using the resulting parent object to coerce values into the resulting field.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> a = RR(\"0.25\")\n0.25000000000000000000\n\njulia> b = RR(\"0.1 +/- 0.001\")\n[0.1 +/- 1.01e-3]\n\njulia> c = RR(0.5)\n0.50000000000000000000\n\njulia> d = RR(12)\n12.000000000000000000","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Note that whilst one can coerce double precision floating point values into an Arb real field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb field.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.","category":"page"},{"location":"real/#Real-ball-constructors","page":"Arbitrary precision real balls","title":"Real ball constructors","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Using coercion into the real field, new elements can be created.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> c = RR(1)\n1.0000000000000000000\n\njulia> d = RR(1//2)\n0.50000000000000000000","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Note that for the construction, also the precision can be supplied:","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"RR = RealField()\n\nc = RR(1, precision = 100)\nd = RR(1//2, precision = 4)","category":"page"},{"location":"real/#Conversions","page":"Arbitrary precision real balls","title":"Conversions","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> convert(Float64, RR(1//3))\n0.3333333333333333","category":"page"},{"location":"real/#Basic-manipulation","page":"Arbitrary precision real balls","title":"Basic manipulation","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_nonzero(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_nonzero-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_nonzero","text":"is_nonzero(x::RealFieldElem)\n\nReturn true if x is certainly not equal to zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"isfinite(::RealFieldElem)","category":"page"},{"location":"real/#Base.isfinite-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.isfinite","text":"isfinite(x::RealFieldElem)\n\nReturn true if x is finite, i.e. having finite midpoint and radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_exact(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_exact-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_exact","text":"is_exact(x::RealFieldElem)\n\nReturn true if x is exact, i.e. has zero radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"isinteger(::RealFieldElem)","category":"page"},{"location":"real/#Base.isinteger-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.isinteger","text":"isinteger(x::RealFieldElem)\n\nReturn true if x is an exact integer, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_positive(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_positive-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_positive","text":"is_positive(x::RealFieldElem)\n\nReturn true if x is certainly positive, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_nonnegative(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_nonnegative-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_nonnegative","text":"is_nonnegative(x::RealFieldElem)\n\nReturn true if x is certainly nonnegative, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_negative(::RealFieldElem)","category":"page"},{"location":"real/#AbstractAlgebra.is_negative-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.is_negative","text":"is_negative(x::RealFieldElem)\n\nReturn true if x is certainly negative, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"is_nonpositive(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.is_nonpositive-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.is_nonpositive","text":"is_nonpositive(x::RealFieldElem)\n\nReturn true if x is certainly nonpositive, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"midpoint(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.midpoint-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.midpoint","text":"midpoint(x::RealFieldElem)\n\nReturn the midpoint of the ball x as an Arb ball.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"radius(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.radius-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.radius","text":"radius(x::RealFieldElem)\n\nReturn the radius of the ball x as an Arb ball.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"accuracy_bits(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.accuracy_bits-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.accuracy_bits","text":"accuracy_bits(x::RealFieldElem)\n\nReturn the relative accuracy of x measured in bits, capped between typemax(Int) and -typemax(Int).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> a = RR(\"1.2 +/- 0.001\")\n[1.20 +/- 1.01e-3]\n\njulia> b = RR(3)\n3.0000000000000000000\n\njulia> is_positive(a)\ntrue\n\njulia> isfinite(b)\ntrue\n\njulia> isinteger(b)\ntrue\n\njulia> is_negative(a)\nfalse\n\njulia> c = radius(a)\n[0.0010000000038417056203 +/- 1.12e-23]\n\njulia> d = midpoint(b)\n3.0000000000000000000\n\njulia> f = accuracy_bits(a)\n9","category":"page"},{"location":"real/#Printing","page":"Arbitrary precision real balls","title":"Printing","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Printing real balls can at first sight be confusing. Lets look at the following example:","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"RR = RealField()\n\na = RR(1)\nb = RR(2)\nc = RR(12)\n\nx = ball(a, b)\ny = ball(c, b)\n\nmid = midpoint(x)\nrad = radius(x)\n\nprint(x, \"\\n\", y, \"\\n\", mid, \"\\n\", rad)","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"which generates","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"[+/- 3.01]\n[1e+1 +/- 4.01]\n1.0000000000000000000\n[2.0000000037252902985 +/- 3.81e-20]","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The first reason that c is not printed as [1 +/- 2] is that the midpoint does not have a greater exponent than the radius in its scientific notation. For similar reasons y is not printed as [12 +/- 2].","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The second reason is that we get an additional error term after our addition. As we see, radius(c) is not equal to 2, which when printed rounds it up to a reasonable decimal place. This is because real balls keep track of rounding errors of basic arithmetic.","category":"page"},{"location":"real/#Containment","page":"Arbitrary precision real balls","title":"Containment","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"It is often necessary to determine whether a given exact value or ball is contained in a given real ball or whether two balls overlap. The following functions are provided for this purpose.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"overlaps(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.overlaps-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.overlaps","text":"overlaps(x::RealFieldElem, y::RealFieldElem)\n\nReturns true if any part of the ball x overlaps any part of the ball y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Base.contains-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::RealFieldElem)\n\nReturns true if the ball x contains the ball y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains(::RealFieldElem, ::Integer)\ncontains(::RealFieldElem, ::ZZRingElem)\ncontains(::RealFieldElem, ::QQFieldElem)\ncontains{T <: Integer}(::RealFieldElem, ::Rational{T})\ncontains(::RealFieldElem, ::BigFloat)","category":"page"},{"location":"real/#Base.contains-Tuple{RealFieldElem, Integer}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::Integer)\n\nReturns true if the ball x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/#Base.contains-Tuple{RealFieldElem, ZZRingElem}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::ZZRingElem)\n\nReturns true if the ball x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/#Base.contains-Tuple{RealFieldElem, QQFieldElem}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::QQFieldElem)\n\nReturns true if the ball x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/#Base.contains-Union{Tuple{T}, Tuple{RealFieldElem, Rational{T}}} where T<:Integer","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::Rational{T}) where {T <: Integer}\n\nReturns true if the ball x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/#Base.contains-Tuple{RealFieldElem, BigFloat}","page":"Arbitrary precision real balls","title":"Base.contains","text":"contains(x::RealFieldElem, y::BigFloat)\n\nReturns true if the ball x contains the given floating point value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"The following functions are also provided for determining if a ball intersects a certain part of the real number line.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_zero(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_zero-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_zero","text":"contains_zero(x::RealFieldElem)\n\nReturns true if the ball x contains zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_negative(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_negative-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_negative","text":"contains_negative(x::RealFieldElem)\n\nReturns true if the ball x contains any negative value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_positive(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_positive-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_positive","text":"contains_positive(x::RealFieldElem)\n\nReturns true if the ball x contains any positive value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_nonnegative(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_nonnegative-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_nonnegative","text":"contains_nonnegative(x::RealFieldElem)\n\nReturns true if the ball x contains any nonnegative value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"contains_nonpositive(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.contains_nonpositive-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.contains_nonpositive","text":"contains_nonpositive(x::RealFieldElem)\n\nReturns true if the ball x contains any nonpositive value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"1 +/- 0.001\")\n[1.00 +/- 1.01e-3]\n\njulia> y = RR(\"3\")\n3.0000000000000000000\n\njulia> overlaps(x, y)\nfalse\n\njulia> contains(x, y)\nfalse\n\njulia> contains(y, 3)\ntrue\n\njulia> contains(x, ZZ(1)//2)\nfalse\n\njulia> contains_zero(x)\nfalse\n\njulia> contains_positive(y)\ntrue","category":"page"},{"location":"real/#Comparison","page":"Arbitrary precision real balls","title":"Comparison","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Nemo provides a full range of comparison operations for Arb balls. Note that a ball is considered less than another ball if every value in the first ball is less than every value in the second ball, etc.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"In addition to the standard comparison operators, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"isequal(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Base.isequal-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.isequal","text":"isequal(x::RealFieldElem, y::RealFieldElem)\n\nReturn true if the balls x and y are precisely equal, i.e. have the same midpoints and radii.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"We also provide a full range of ad hoc comparison operators. These are implemented directly in Julia, but we document them as though isless and == were provided.","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Function\n==(x::RealFieldElem, y::Integer)\n==(x::Integer, y::RealFieldElem)\n==(x::RealFieldElem, y::ZZRingElem)\n==(x::ZZRingElem, y::RealFieldElem)\n==(x::RealFieldElem, y::Float64)\n==(x::Float64, y::RealFieldElem)\nisless(x::RealFieldElem, y::Integer)\nisless(x::Integer, y::RealFieldElem)\nisless(x::RealFieldElem, y::ZZRingElem)\nisless(x::ZZRingElem, y::RealFieldElem)\nisless(x::RealFieldElem, y::Float64)\nisless(x::Float64, y::RealFieldElem)\nisless(x::RealFieldElem, y::BigFloat)\nisless(x::BigFloat, y::RealFieldElem)\nisless(x::RealFieldElem, y::QQFieldElem)\nisless(x::QQFieldElem, y::RealFieldElem)","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"1 +/- 0.001\")\n[1.00 +/- 1.01e-3]\n\njulia> y = RR(\"3\")\n3.0000000000000000000\n\njulia> z = RR(\"4\")\n4.0000000000000000000\n\njulia> isequal(x, deepcopy(x))\ntrue\n\njulia> x == 3\nfalse\n\njulia> ZZ(3) < z\ntrue\n\njulia> x != 1.23\ntrue","category":"page"},{"location":"real/#Absolute-value","page":"Arbitrary precision real balls","title":"Absolute value","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"-1 +/- 0.001\")\n[-1.00 +/- 1.01e-3]\n\njulia> a = abs(x)\n[1.00 +/- 1.01e-3]","category":"page"},{"location":"real/#Shifting","page":"Arbitrary precision real balls","title":"Shifting","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"-3 +/- 0.001\")\n[-3.00 +/- 1.01e-3]\n\njulia> a = ldexp(x, 23)\n[-2.52e+7 +/- 4.26e+4]\n\njulia> b = ldexp(x, -ZZ(15))\n[-9.16e-5 +/- 7.78e-8]","category":"page"},{"location":"real/#Miscellaneous-operations","page":"Arbitrary precision real balls","title":"Miscellaneous operations","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"add_error!(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.add_error!-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.add_error!","text":"add_error!(x::RealFieldElem, y::RealFieldElem)\n\nAdds the absolute values of the midpoint and radius of y to the radius of x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"trim(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.trim-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.trim","text":"trim(x::RealFieldElem)\n\nReturn an arb interval containing x but which may be more economical, by rounding off insignificant bits from the midpoint.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"unique_integer(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.unique_integer-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.unique_integer","text":"unique_integer(x::RealFieldElem)\n\nReturn a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the interval x contains a unique integer. If this is the case, the second return value is set to this unique integer.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"setunion(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.setunion-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.setunion","text":"setunion(x::RealFieldElem, y::RealFieldElem)\n\nReturn an arb containing the union of the intervals represented by x and y.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> x = RR(\"-3 +/- 0.001\")\n[-3.00 +/- 1.01e-3]\n\njulia> y = RR(\"2 +/- 0.5\")\n[2e+0 +/- 0.501]\n\njulia> a = trim(x)\n[-3.00 +/- 1.01e-3]\n\njulia> b, c = unique_integer(x)\n(true, -3)\n\njulia> d = setunion(x, y)\n[+/- 3.01]","category":"page"},{"location":"real/#Constants","page":"Arbitrary precision real balls","title":"Constants","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_pi(::RealField)","category":"page"},{"location":"real/#Nemo.const_pi-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_pi","text":"const_pi(r::RealField)\n\nReturn pi = 314159ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_e(::RealField)","category":"page"},{"location":"real/#Nemo.const_e-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_e","text":"const_e(r::RealField)\n\nReturn e = 271828ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_log2(::RealField)","category":"page"},{"location":"real/#Nemo.const_log2-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_log2","text":"const_log2(r::RealField)\n\nReturn log(2) = 069314ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_log10(::RealField)","category":"page"},{"location":"real/#Nemo.const_log10-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_log10","text":"const_log10(r::RealField)\n\nReturn log(10) = 2302585ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_euler(::RealField)","category":"page"},{"location":"real/#Nemo.const_euler-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_euler","text":"const_euler(r::RealField)\n\nReturn Euler's constant gamma = 0577215ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_catalan(::RealField)","category":"page"},{"location":"real/#Nemo.const_catalan-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_catalan","text":"const_catalan(r::RealField)\n\nReturn Catalan's constant C = 0915965ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_khinchin(::RealField)","category":"page"},{"location":"real/#Nemo.const_khinchin-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_khinchin","text":"const_khinchin(r::RealField)\n\nReturn Khinchin's constant K = 2685452ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"const_glaisher(::RealField)","category":"page"},{"location":"real/#Nemo.const_glaisher-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.const_glaisher","text":"const_glaisher(r::RealField)\n\nReturn Glaisher's constant A = 1282427ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> a = const_pi(RR)\n[3.141592653589793239 +/- 5.96e-19]\n\njulia> b = const_e(RR)\n[2.718281828459045235 +/- 4.29e-19]\n\njulia> c = const_euler(RR)\n[0.5772156649015328606 +/- 4.35e-20]\n\njulia> d = const_glaisher(RR)\n[1.282427129100622637 +/- 3.01e-19]","category":"page"},{"location":"real/#Mathematical-and-special-functions","page":"Arbitrary precision real balls","title":"Mathematical and special functions","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rsqrt(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.rsqrt-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.rsqrt","text":"rsqrt(x::RealFieldElem)\n\nReturn the reciprocal of the square root of x, i.e. 1sqrtx.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"sqrt1pm1(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.sqrt1pm1-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.sqrt1pm1","text":"sqrt1pm1(x::RealFieldElem)\n\nReturn sqrt1+x-1, evaluated accurately for small x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"sqrtpos(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.sqrtpos-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.sqrtpos","text":"sqrtpos(x::RealFieldElem)\n\nReturn the sqrt root of x, assuming that x represents a nonnegative number. Thus any negative number in the input interval is discarded.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma","text":"gamma(x::RealFieldElem)\n\nReturn the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"lgamma(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.lgamma-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.lgamma","text":"lgamma(x::RealFieldElem)\n\nReturn the logarithm of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rgamma(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.rgamma-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.rgamma","text":"rgamma(x::RealFieldElem)\n\nReturn the reciprocal of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"digamma(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.digamma-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.digamma","text":"digamma(x::RealFieldElem)\n\nReturn the logarithmic derivative of the gamma function evaluated at x, i.e. psi(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma","text":"gamma(s::RealFieldElem, x::RealFieldElem)\n\nReturn the upper incomplete gamma function Gamma(sx).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma_regularized(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma_regularized-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma_regularized","text":"gamma_regularized(s::RealFieldElem, x::RealFieldElem)\n\nReturn the regularized upper incomplete gamma function Gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma_lower(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma_lower-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma_lower","text":"gamma_lower(s::RealFieldElem, x::RealFieldElem)\n\nReturn the lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma_lower_regularized(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.gamma_lower_regularized-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.gamma_lower_regularized","text":"gamma_lower_regularized(s::RealFieldElem, x::RealFieldElem)\n\nReturn the regularized lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"zeta(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.zeta-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.zeta","text":"zeta(x::RealFieldElem)\n\nReturn the Riemann zeta function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"atan2(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.atan2-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.atan2","text":"atan2(y::RealFieldElem, x::RealFieldElem)\n\nReturn operatornameatan2(yx) = arg(x+yi). Same as atan(y, x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"agm(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.agm-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.agm","text":"agm(x::RealFieldElem, y::RealFieldElem)\n\nReturn the arithmetic-geometric mean of x and y\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"zeta(::RealFieldElem, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.zeta-Tuple{RealFieldElem, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.zeta","text":"zeta(s::RealFieldElem, a::RealFieldElem)\n\nReturn the Hurwitz zeta function zeta(sa).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"root(::RealFieldElem, ::Int)","category":"page"},{"location":"real/#AbstractAlgebra.root-Tuple{RealFieldElem, Int64}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.root","text":"root(x::RealFieldElem, n::Int)\n\nReturn the n-th root of x. We require x geq 0.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"factorial(::RealFieldElem)","category":"page"},{"location":"real/#Base.factorial-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Base.factorial","text":"factorial(x::RealFieldElem)\n\nReturn the factorial of x.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"factorial(::Int, ::RealField)","category":"page"},{"location":"real/#Base.factorial-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Base.factorial","text":"factorial(n::Int, r::RealField)\n\nReturn the factorial of n in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"binomial(::RealFieldElem, ::UInt)","category":"page"},{"location":"real/#Base.binomial-Tuple{RealFieldElem, UInt64}","page":"Arbitrary precision real balls","title":"Base.binomial","text":"binomial(x::RealFieldElem, n::UInt)\n\nReturn the binomial coefficient x choose n.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"binomial(::UInt, ::UInt, ::RealField)","category":"page"},{"location":"real/#Base.binomial-Tuple{UInt64, UInt64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Base.binomial","text":"binomial(n::UInt, k::UInt, r::RealField)\n\nReturn the binomial coefficient n choose k in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"fibonacci(::ZZRingElem, ::RealField)","category":"page"},{"location":"real/#Nemo.fibonacci-Tuple{ZZRingElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.fibonacci","text":"fibonacci(n::ZZRingElem, r::RealField)\n\nReturn the n-th Fibonacci number in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"fibonacci(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.fibonacci-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.fibonacci","text":"fibonacci(n::Int, r::RealField)\n\nReturn the n-th Fibonacci number in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma(::ZZRingElem, ::RealField)","category":"page"},{"location":"real/#Nemo.gamma-Tuple{ZZRingElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.gamma","text":"gamma(x::ZZRingElem, r::RealField)\n\nReturn the Gamma function evaluated at x in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"gamma(::QQFieldElem, ::RealField)","category":"page"},{"location":"real/#Nemo.gamma-Tuple{QQFieldElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.gamma","text":"gamma(x::QQFieldElem, r::RealField)\n\nReturn the Gamma function evaluated at x in the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"zeta(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.zeta-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.zeta","text":"zeta(n::Int, r::RealField)\n\nReturn the Riemann zeta function zeta(n) as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"bernoulli(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.bernoulli-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.bernoulli","text":"bernoulli(n::Int, r::RealField)\n\nReturn the n-th Bernoulli number as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rising_factorial(::RealFieldElem, ::Int)","category":"page"},{"location":"real/#Nemo.rising_factorial-Tuple{RealFieldElem, Int64}","page":"Arbitrary precision real balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::RealFieldElem, n::Int)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an Arb.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rising_factorial(::QQFieldElem, ::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.rising_factorial-Tuple{QQFieldElem, Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::QQFieldElem, n::Int, r::RealField)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an element of the given Arb field.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rising_factorial2(::RealFieldElem, ::Int)","category":"page"},{"location":"real/#Nemo.rising_factorial2-Tuple{RealFieldElem, Int64}","page":"Arbitrary precision real balls","title":"Nemo.rising_factorial2","text":"rising_factorial2(x::RealFieldElem, n::Int)\n\nReturn a tuple containing the rising factorial x(x + 1)ldots (x + n - 1) and its derivative.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"polylog(::Union{RealFieldElem,Int}, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.polylog-Tuple{Union{Int64, RealFieldElem}, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.polylog","text":"polylog(s::Union{RealFieldElem,Int}, a::RealFieldElem)\n\nReturn the polylogarithm Li_s(a).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"chebyshev_t(::Int, ::RealFieldElem)","category":"page"},{"location":"real/#AbstractAlgebra.chebyshev_t-Tuple{Int64, RealFieldElem}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.chebyshev_t","text":"chebyshev_t(n::Int, x::RealFieldElem)\n\nReturn the value of the Chebyshev polynomial T_n(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"chebyshev_u(::Int, ::RealFieldElem)","category":"page"},{"location":"real/#AbstractAlgebra.chebyshev_u-Tuple{Int64, RealFieldElem}","page":"Arbitrary precision real balls","title":"AbstractAlgebra.chebyshev_u","text":"chebyshev_u(n::Int, x::RealFieldElem)\n\nReturn the value of the Chebyshev polynomial U_n(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"chebyshev_t2(::Int, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.chebyshev_t2-Tuple{Int64, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.chebyshev_t2","text":"chebyshev_t2(n::Int, x::RealFieldElem)\n\nReturn the tuple (T_n(x) T_n-1(x)).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"chebyshev_u2(::Int, ::RealFieldElem)","category":"page"},{"location":"real/#Nemo.chebyshev_u2-Tuple{Int64, RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.chebyshev_u2","text":"chebyshev_u2(n::Int, x::RealFieldElem)\n\nReturn the tuple (U_n(x) U_n-1(x))\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"bell(::ZZRingElem, ::RealField)","category":"page"},{"location":"real/#Nemo.bell-Tuple{ZZRingElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.bell","text":"bell(n::ZZRingElem, r::RealField)\n\nReturn the Bell number B_n as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"bell(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.bell-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.bell","text":"bell(n::Int, r::RealField)\n\nReturn the Bell number B_n as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"numpart(::ZZRingElem, ::RealField)","category":"page"},{"location":"real/#Nemo.numpart-Tuple{ZZRingElem, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.numpart","text":"numpart(n::ZZRingElem, r::RealField)\n\nReturn the number of partitions p(n) as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"numpart(::Int, ::RealField)","category":"page"},{"location":"real/#Nemo.numpart-Tuple{Int64, Nemo.RealField}","page":"Arbitrary precision real balls","title":"Nemo.numpart","text":"numpart(n::Int, r::RealField)\n\nReturn the number of partitions p(n) as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"airy_ai(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.airy_ai-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.airy_ai","text":"airy_ai(x::RealFieldElem)\n\nReturn the Airy function operatornameAi(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"airy_ai_prime(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.airy_ai_prime-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.airy_ai_prime","text":"airy_ai_prime(x::RealFieldElem)\n\nReturn the derivative of the Airy function operatornameAi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"airy_bi(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.airy_bi-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.airy_bi","text":"airy_bi(x::RealFieldElem)\n\nReturn the Airy function operatornameBi(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"airy_bi_prime(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.airy_bi_prime-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.airy_bi_prime","text":"airy_bi_prime(x::RealFieldElem)\n\nReturn the derivative of the Airy function operatornameBi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"julia> RR = RealField()\nReal field\n\njulia> a = floor(exp(RR(1)))\n2.0000000000000000000\n\njulia> b = sinpi(QQ(5,6), RR)\n0.50000000000000000000\n\njulia> c = gamma(QQ(1,3), RR)\n[2.678938534707747634 +/- 7.13e-19]\n\njulia> d = bernoulli(1000, RR)\n[-5.318704469415522036e+1769 +/- 6.61e+1750]\n\njulia> f = polylog(3, RR(-10))\n[-5.92106480375697 +/- 6.68e-15]","category":"page"},{"location":"real/#Linear-dependence","page":"Arbitrary precision real balls","title":"Linear dependence","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"lindep(::Vector{RealFieldElem}, n::Int)","category":"page"},{"location":"real/#Nemo.lindep-Tuple{Vector{RealFieldElem}, Int64}","page":"Arbitrary precision real balls","title":"Nemo.lindep","text":"lindep(A::Vector{RealFieldElem}, bits::Int)\n\nFind a small linear combination of the entries of the array A that is small (using LLL). The entries are first scaled by the given number of bits before truncating to integers for use in LLL. This function can be used to find linear dependence between a list of real numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.\n\nExamples\n\njulia> RR = RealField()\nReal field\n\njulia> a = RR(-0.33198902958450931620250069492231652319)\n[-0.33198902958450932088 +/- 4.15e-22]\n\njulia> V = [RR(1), a, a^2, a^3, a^4, a^5]\n6-element Vector{RealFieldElem}:\n 1.0000000000000000000\n [-0.33198902958450932088 +/- 4.15e-22]\n [0.11021671576446420510 +/- 7.87e-21]\n [-0.03659074051063616184 +/- 4.17e-21]\n [0.012147724433904692427 +/- 4.99e-22]\n [-0.004032911246472051677 +/- 6.25e-22]\n\njulia> W = lindep(V, 20)\n6-element Vector{ZZRingElem}:\n 1\n 3\n 0\n 0\n 0\n 1\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"simplest_rational_inside(::RealFieldElem)","category":"page"},{"location":"real/#Nemo.simplest_rational_inside-Tuple{RealFieldElem}","page":"Arbitrary precision real balls","title":"Nemo.simplest_rational_inside","text":" simplest_rational_inside(x::RealFieldElem)\n\nReturn the simplest fraction inside the ball x. A canonical fraction a_1b_1 is defined to be simpler than a_2b_2 iff b_1 b_2 or b_1 = b_2 and a_1 a_2.\n\nExamples\n\njulia> RR = RealField()\nReal field\n\njulia> simplest_rational_inside(const_pi(RR))\n8717442233//2774848045\n\n\n\n\n\n","category":"method"},{"location":"real/#Random-generation","page":"Arbitrary precision real balls","title":"Random generation","text":"","category":"section"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"rand(::RealField)","category":"page"},{"location":"real/#Base.rand-Tuple{Nemo.RealField}","page":"Arbitrary precision real balls","title":"Base.rand","text":"rand([rng=GLOBAL_RNG,] G::SymmetricGroup)\n\nReturn a random permutation from G.\n\n\n\n\n\nrand(r::RealField; randtype::Symbol=:urandom)\n\nReturn a random element in given Arb field.\n\nThe randtype default is :urandom which return an arb contained in 01.\n\nThe rest of the methods return non-uniformly distributed values in order to exercise corner cases. The option :randtest will return a finite number, and :randtest_exact the same but with a zero radius. The option :randtest_precise return an arb with a radius around 2^-mathrmprec the magnitude of the midpoint, while :randtest_wide return a radius that might be big relative to its midpoint. The :randtest_special-option might return a midpoint and radius whose values are NaN or inf.\n\n\n\n\n\n","category":"method"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"Examples","category":"page"},{"location":"real/","page":"Arbitrary precision real balls","title":"Arbitrary precision real balls","text":"RR = RealField()\n\na = rand(RR)\nb = rand(RR; randtype = :null_exact)\nc = rand(RR; randtype = :exact)\nd = rand(RR; randtype = :special)","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/interfaces/#Interfaces","page":"Interfaces","title":"Interfaces","text":"","category":"section"},{"location":"developer/interfaces/#Functionality-for-Generic-and-Abstract-Types","page":"Interfaces","title":"Functionality for Generic and Abstract Types","text":"","category":"section"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"As previously mentioned, Nemo provides various generic types, e.g. Poly{T} for generic univariate polynomials and Mat{T} for generic matrices over a base ring. These and other polynomial and matrix types belong in turn to abstract types or unions thereof, e.g. PolyRingElem{T} is an abstract type representing all univariate polynomial types and MatrixElem{T} is a union of all Nemo matrix types.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"When implementing generic functionality, one should usually implement it for the abstract types and unions thereof, since the new functionality will then work for all types of the specified kind, instead of just the generic types.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"In order for this to work in practice, such implementations can only use functions in the relevant official interface. These are the functions required to be implemented by all types of that kind. For example, matrix implementations make heavy use of addeq! and mul! to accumulate entries, but they cannot make use of functions such as subeq! as it is not part of the official interface.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"In addition to implementations for abstract types and their unions, one may also like to provide specialised implementations for the generic types e.g. Poly{T} and Mat{T} as one would for other specialised types. The generic types are based on Julia arrays internally, and so it makes perfect sense to implement lower level functionality for these types specifically, as this may lead to performance gains. Such specialised implementations can make use of any functions provided for the generic types, whether in the interface or not.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"For convenience we list the most important abstract types and their unions for which one should usually prefer to write generic implementations.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"PolyRingElem{T} : all univariate polynomial types\nMPolyRingElem{T} : all multivariate polynomial types (see note below)\nMatrixElem{T} : union of all matrix types including matrix algebras\nMatElem{T} : all matrix types not including matrix algebras\nAbsPowerSeriesRingElem{T} : all abstract series types\nRelPowerSeriesRingElem{T} : all relative series types\nLaurentSeriesElem{T} : union of all Laurent series over rings and fields\nPuiseuxSeriesElem{T} : union of all Puiseux series over rings and fields\nFPModule{T} : all finitely presented modules over a Euclidean domain\nFPModuleElem{T} : all elems of fin. presented modules over a Euc. domain\nFracElem{T} : all fractions\nResElem{T} : all elements of a residue ring\nResFieldElem{T} : all elements of a residue field\nMap{D, C} : all maps (see Maps developer docs for a description)","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"N.B: inside the Generic submodule of AbstractAlgebra some abstract types Blah are only accessible by writing AbstractAlgebra.Blah. The unions are directly accessible. There may be generic types and abstract types with the same name, so this is more than just a convention.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Note that multivariate polynomials tend to require very specialised implementations depending heavily on implementation details of the specific multivariate type. Therefore it is rare to write implementations for the abstract type MPolyRingElem{T}. Instead, implementations tend to be done for each concrete multivariate type separately.","category":"page"},{"location":"developer/interfaces/#Generic-interfaces","page":"Interfaces","title":"Generic interfaces","text":"","category":"section"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"As mentioned above, the generic implementations in Nemo depend on carefully written interfaces for each of the abstract types provided by the system.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"These interfaces are spelled out in the AbstractAlgebra documentation. Note that a generic implementation may depend on functions in both the required and optional interfaces as the optional functions are all implemented with generic fallbacks in terms of the required functions.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"For convenience we provide here a list of interfaces that can be relied on in generic implementations, along with a description.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Ring : all commutative rings in the system\nField : all fields in the system\nNCRing : all rings in the system (not necessarily commutative)\nEuclidean Ring : Euclidean rings (see notes below)\nUnivariate Polynomial Ring : all dense univariate polynomials\nMultivariate Polynomial Ring : all sparse distributed multivariate polys.\nSeries Ring : all series, relative and absolute\nResidue Ring : all quotients of gcd domains with gcdx by a principal ideal\nFraction Field : all fractions over a gcd domain with gcdx\nModule : all finitely presented modules over a Euclidean domain\nMatrix : all matrices over a commutative ring\nMap : all (set) maps in the system","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Although we allow Z/nZ in our definition of Euclidean ring, much of the functionality in Nemo can be expected to misbehave (impossible inverses, etc.) when working with Euclidean rings that are not domains. In some cases the algorithms just don't exist, and in other cases we simply haven't implemented the required functionality to support all Euclidean rings for which computations can be done.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Whether a ring is a Euclidean domain or not cannot be encoded in the type. Thus there is no abstract type for Euclidean domains or their elements. Instead, generic functions rely on the existence of certain functions such as gcdx to implement functionality for Euclidean domains.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"There is also currently no way to define a Euclidean function for a given ring (which is known to be Euclidean) and have the system recognise the ring as such. This kind of Euclidean interface may be provided in a future version of Nemo.","category":"page"},{"location":"developer/interfaces/#Julia-interfaces-we-support","page":"Interfaces","title":"Julia interfaces we support","text":"","category":"section"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Many Julia interfaces rely on being able to create zero and one elements given the type only. As we use the parent/element model (see developer notes on this topic) we cannot support all Julia interfaces fully.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"We do however partially implement some Julia interfaces.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Iteration : iterators are currently provided for multivariate polynomials to iterate over the coefficients, terms and monomials. Nemo matrices can also be iterated over. Iteration proceeds down each column in turn. One can also iterate over all permutations and partitions. Finally, all finite field types can be iterated over.\nViews : because C libraries cannot be expected to implement the full range of Julia view types, views of matrices in Nemo can only be constructed for submatrices consisting of contiguous blocks in the original matrix.\nmap and similar : we implement the map and similar interfaces with the caveat that we generally use parent objects where Julia would use types. See the specific documentation for the module of interest to see details.\nzero and one : these are implemented for parent types, which is not what Julia typically expects. Exceptions include the Flint ZZRingElem and QQFieldElem types, as their parents are not parameterised, which makes it possible to implement these functions for the types as well as the parents.\nrand : we have a Nemo specific rand interface, which passes the tail of a given rand invocation to the rand function for the base ring, e.g. to create random matrix elements or polynomial coefficients and so on. In addition to this custom rand interface, we also support much of the Julia rand interface, with the usual caveat that we use parent objects instead of types where necessary.\nserialisation : unfortunately this is currently NOT implemented by Nemo, but we would certainly like to see that done in the future. It's not automatic because of the C objects that underly many of our constructions.\nNumber : Nemo number types do NOT belong to Julia's Number hierarchy, as we must make all our ring element types belong to our RingElem abstract type. To make some Julia Number types cooperate with Nemo, we define the unions RingElement and FieldElement which include some Julia types, such as BigInt and Rational{BigInt}, etc. Note that fixed precision integer types cannot be expected to be well-behaved when they overflow. We recommend using Nemo integer types if one wants good performance for small machine word sized integers, but no overflow when the integer becomes large (Nemo integers are based on Flint's multiprecision ZZRingElem type).\nhash : we implement hash functions for all major element types in Nemo.\ngetindex/setindex!/typed_hvcat : we implement these to access elements of Nemo matrices, however see the note below on row major representation. In addition, we allow creation of matrices using the notation R[a b; c d] etc. This is done by overloading typed_hvcat for the parent object R instead of a type as Julia would normally expect. This produces a Nemo matrix rather than a Julia one. Note that when passed a type, Julia's typed_hvcat can only construct Julia matrices for Nemo types such as ZZRingElem and QQFieldElem where elements can be constructed from types alone.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Many other Julia interfaces are either not yet implemented or only very partially implemented.","category":"page"},{"location":"developer/interfaces/#Column-major-vs-row-major-matrices","page":"Interfaces","title":"Column major vs row major matrices","text":"","category":"section"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"Whereas Julia uses column major representation for its matrices, Nemo follows the convention of the C libraries it wraps and uses row major representation. Although Julia 2-D arrays are used internally in Nemo's generic matrix type, the interface from the perspective of the user is still the Nemo row major convention, not the Julia column major convention.","category":"page"},{"location":"developer/interfaces/","page":"Interfaces","title":"Interfaces","text":"In row major representation, some row operations may be able to be performed more cheaply than similar column operations. In column major representation the converse is true. This may mean that some Julia matrix implementations may perform more slowly if naively ported to Nemo matrices, unless suitably modified.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"residue/#Residue-rings","page":"Residue rings","title":"Residue rings","text":"","category":"section"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"Nemo allows the creation of residue rings of the form R(a) for an element a of a ring R.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"We don't require (a) to be a prime or maximal ideal. Instead, we allow the creation of the residue ring R(a) for any nonzero a and simply raise an exception if an impossible inverse is encountered during computations involving elements of R(a). Of course, a GCD function must be available for the base ring R.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"There is a generic implementation of residue rings of this form in AbstractAlgebra.jl, which accepts any ring R as base ring.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"The associated types of parent object and elements for each kind of residue rings in Nemo are given in the following table.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.ResidueRingElem{T} Generic.ResidueRing{T}\nmathbbZ (Int modulus) Flint zzModRingElem zzModRing\nmathbbZ (ZZ modulus) Flint ZZModRingElem ZZModRing","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"The modulus a of a residue ring is stored in its parent object.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"All residue element types belong to the abstract type ResElem and all the residue ring parent object types belong to the abstract type ResidueRing. This enables one to write generic functions that accept any Nemo residue type.","category":"page"},{"location":"residue/#Residue-functionality","page":"Residue rings","title":"Residue functionality","text":"","category":"section"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"All the residue rings in Nemo provide the functionality described in AbstractAlgebra for residue rings:","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/residue","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"In addition, generic residue rings are available.","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"We describe Nemo specific residue ring functionality below.","category":"page"},{"location":"residue/#GCD","page":"Residue rings","title":"GCD","text":"","category":"section"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"gcdx(::zzModRingElem, ::zzModRingElem)\ngcdx(::ZZModRingElem, ::ZZModRingElem)","category":"page"},{"location":"residue/#Base.gcdx-Tuple{zzModRingElem, zzModRingElem}","page":"Residue rings","title":"Base.gcdx","text":"gcdx(a::zzModRingElem, b::zzModRingElem)\n\nCompute the extended gcd with the Euclidean structure inherited from mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"residue/#Base.gcdx-Tuple{ZZModRingElem, ZZModRingElem}","page":"Residue rings","title":"Base.gcdx","text":"gcdx(a::ZZModRingElem, b::ZZModRingElem)\n\nCompute the extended gcd with the Euclidean structure inherited from mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"Examples","category":"page"},{"location":"residue/","page":"Residue rings","title":"Residue rings","text":"julia> R = residue_ring(ZZ, 123456789012345678949)\nIntegers modulo 123456789012345678949\n\njulia> g, s, t = gcdx(R(123), R(456))\n(1, 123456789012345678928, 41152263004115226322)","category":"page"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"factor/#Factorisation","page":"Factorisation","title":"Factorisation","text":"","category":"section"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"Nemo provides a unified interface to handle factorisations using the Fact objects. These can only be constructed using the factor function for the respective ring elements. This is best illustrated by an example.","category":"page"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"julia> fac = factor(ZZ(-6000361807272228723606))\n-1 * 2 * 229^3 * 43669^3 * 3\n\njulia> unit(fac)\n-1\n\njulia> -6000361807272228723606 == unit(fac) * prod([ p^e for (p, e) in fac])\ntrue\n\njulia> for (p, e) in fac; println(\"$p $e\"); end\n2 1\n229 3\n43669 3\n3 1\n\njulia> 229 in fac\ntrue\n\njulia> fac[229]\n3","category":"page"},{"location":"factor/#Basic-functionality","page":"Factorisation","title":"Basic functionality","text":"","category":"section"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"Objects of type Fac are iterable, that is, if a is an object of type Fac, then for (p, e) in a will iterate through all pairs (p, e), where p is a factor and e the corresponding exponent.","category":"page"},{"location":"factor/","page":"Factorisation","title":"Factorisation","text":"in(::ZZRingElem, ::Fac{ZZRingElem})\ngetindex(::Fac{ZZRingElem}, ::ZZRingElem)\nlength(::Fac{ZZRingElem})\nunit(::Fac{ZZRingElem})","category":"page"},{"location":"factor/#Base.in-Tuple{ZZRingElem, Fac{ZZRingElem}}","page":"Factorisation","title":"Base.in","text":"in(a, b::Fac)\n\nTest whether a is a factor of b.\n\n\n\n\n\n","category":"method"},{"location":"factor/#Base.getindex-Tuple{Fac{ZZRingElem}, ZZRingElem}","page":"Factorisation","title":"Base.getindex","text":"getindex(a::Fac, b) -> Int\n\nIf b is a factor of a, the corresponding exponent is returned. Otherwise an error is thrown.\n\n\n\n\n\n","category":"method"},{"location":"factor/#Base.length-Tuple{Fac{ZZRingElem}}","page":"Factorisation","title":"Base.length","text":"length(a::Fac) -> Int\n\nReturn the number of factors of a, not including the unit.\n\n\n\n\n\n","category":"method"},{"location":"factor/#AbstractAlgebra.Generic.unit-Tuple{Fac{ZZRingElem}}","page":"Factorisation","title":"AbstractAlgebra.Generic.unit","text":"unit(a::Fac{T}) -> T\n\nReturn the unit of the factorization.\n\n\n\n\n\n","category":"method"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/future/#Future-plans","page":"Future plans","title":"Future plans","text":"","category":"section"},{"location":"developer/future/#Ring-and-CommRing","page":"Future plans","title":"Ring and CommRing","text":"","category":"section"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"Currently all commutative ring types belong to Ring and their elements to RingElem (and RingElement) and we have separate types for noncommutative rings and elements thereof, i.e. NCRing and NCRingElem etc.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"However, it would be more logical to use Ring for not necessarily commutative rings and CommRing, CRing or CommutativeRing (the name has not been decided on yet) for commutative rings.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"This is a big change and should happen with plenty of warning for the community. It would be convenient if a script could be made available to automate this.","category":"page"},{"location":"developer/future/#Mono-repository","page":"Future plans","title":"Mono repository","text":"","category":"section"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"There is currently a proposal to place all Oscar related repositories, or some subset of them in a single repository called OscarMono.jl. The details are not finalised and it is not known what impact this will have on Nemo. However, Nemo developers should be aware that this may happen at some point in the fairly near future.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"Users of Nemo should be unaffected, as Nemo will continue to exist as a separate package in the OscarMono.jl repository, even if it does become part of this repository. Julia supports multiple packages in the same repository nowadays.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"The possibility will always exist to separate the repositories again if the experiment is unsuccessful or serves its purpose and is no longer needed.","category":"page"},{"location":"developer/future/#Moving-implementations-from-Hecke","page":"Future plans","title":"Moving implementations from Hecke","text":"","category":"section"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"In the Hecke.jl project there are a vast number of implementations that were intended for AbstractAlgebra.jl and Nemo.jl. They exist in the src/Misc directory of that project.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"These implementations will eventually all be moved over to the correct repositories. Code, documentation and performance improvements will be added.","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"A number of things must be taken into account when making such moves:","category":"page"},{"location":"developer/future/","page":"Future plans","title":"Future plans","text":"Substantial chunks of code should be moved at a time. The code can be initially placed in a src/Misc directory in AbstractAlgebra or Nemo until it can finally be integrated fully into the correct place in those projects.\nSome of the code calls full parent object constructors in generic code. Such calls should be removed where possible.\nSome functions such as exp and the like require Base to be prepended, as we do not import these functions from Base into Generic.\nSome of the code calls back into convenience functions found only in Hecke. These have to be rewritten in terms of AbstractAlgebra/Nemo functions.\nSome of the code relies on ZZRingElem being available, but would otherwise be suitable for AbstractAlgebra. This code can hopefully be rewritten to be agnostic about the integer type.\nTodos, questions and so on should be moved to tickets.\nSometimes exception types differ between Hecke and Nemo, meaning that tests will fail due to the wrong type of exception being raised. Either the tests will have to be adjusted, or the Nemo exception types changed.\nRingElem is often used where RingElement is intended, etc. Also types are often unconstrained where Nemo would constrain them to RingElement.\nSome Hecke functions try to support generic types and specific concrete Nemo types in the same implementation. These will unfortunately have to either be split between AbstractAlgebra and Nemo or a completely generic implementation for abstract types will have to be made.\nSome Hecke implementations assume sub! and friends are available in generic code. These will have to be rewritten, usually by adding a single unary minus outside of a loop and switching to add! and friends inside the loops.\nTest code, docstrings and documentation will have to be added where they do not already exist.\nExports of the new functionality will have to be added.\nSome functions should be accompanied by similar functions that don't yet exist. For example if there is a blah_rows there probably should be a blah_cols function as well, etc.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"exact/#Exact-real-and-complex-numbers","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Exact real and complex numbers are provided by Calcium. Internally, a number z is represented as an element of an extension field of the rational numbers. That is,","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"z in mathbbQ(a_1ldotsa_n)","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"where a_1 ldots a_n are symbolically defined algebraic or transcendental real or complex numbers such as pi, sqrt2 or e^sqrt2 pi i. The user does not normally need to worry about the details of the internal representation; Calcium constructs extension numbers and fields automatically as needed to perform operations.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The user must create a CalciumField instance which represents the mathematical domain mathbbC. This parent object holds a cache of extension numbers and fields used to represent individual elements. It also stores various options for evaluation (documented further below).","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Library Element type Parent type\nCalcium ca CalciumField","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Please note the following:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"It is in the nature of exact complex arithmetic that some operations must be implemented using incomplete heuristics. For example, testing whether an element is zero will not always succeed. When Calcium is unable to perform a task, Nemo will throw an exception. This ensures that Calcium fields behave exactly and never silently return wrong results.\nCalcium elements can optionally hold special non-numerical values:\nUnsigned infinity hat infty\nSigned infinities (pm infty, pm i infty, and more generally e^i theta cdot infty)\nUndefined\nUnknown\nBy default, such special values are disallowed so that a CalciumField represents the mathematical field mathbbC, and any operation that would result in a special value (for example, 1 0 = hat infty) will throw an exception. To allow special values, pass extended=true to the CalciumField constructor.\nCalciumField instances only support single-threaded use. You must create a separate parent object for each thread to do parallel computation.\nWhen performing an operation involving two ca operands with different parent objects, Nemo will arbitrarily coerce the operands (and hence the result) to one of the parents.","category":"page"},{"location":"exact/#Calcium-field-options","page":"Exact real and complex numbers","title":"Calcium field options","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The CalciumField parent stores various options that affect simplification power, performance, or appearance. The user can override any of the default values using C = CalciumField(options=dict) where dict is a dictionary with Symbol => Int pairs. To retrieve the option values as a dictionary (including any default values not set by the user), call options(C).","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The following options are supported:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Option Explanation\n:verbose Enable debug output\n:print_flags Flags controlling print style\n:mpoly_ord Monomial order for polynomials\n:prec_limit Precision limit for numerical evaluation\n:qqbar_deg_limit Degree limit for algebraic numbers\n:low_prec Initial precision for numerical evaluation\n:smooth_limit Factor size limit for smooth integer factorization\n:lll_prec Precision for integer relation detection\n:pow_limit Maximum exponent for in-field powering\n:use_gb Enable Gröbner basis computation\n:gb_length_limit Maximum ideal basis length during Gröbner basis computation\n:gb_poly_length_limit Maximum polynomial length during Gröbner basis computation\n:gb_poly_bits_limit Maximum bit size during Gröbner basis computation\n:gb_vieta_limit Maximum degree to use Vieta's formulas\n:trig_form Default form of trigonometric functions","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"An important function of these options is to control how hard Calcium will try to find an answer before it gives up. For example:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Setting :prec_limit => 65536 will allow Calcium to use up to 65536 bits of precision (instead of the default 4096) to prove inequalities.\nSetting :qqbar_deg_limit => typemax(Int) (instead of the default 120) will force most calculations involving algebraic numbers to run to completion, no matter how long this will take.\nSetting :use_gb => 0 (instead of the default 1) disables use of Gröbner bases. In general, this will negatively impact Calcium's ability to simplify field elements and prove equalities, but it can speed up calculations where Gröbner bases are unnecessary.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"For a detailed explanation, refer to the following section in the Calcium documentation: https://fredrikj.net/calcium/ca.html#context-options","category":"page"},{"location":"exact/#Basic-examples","page":"Exact real and complex numbers","title":"Basic examples","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> C = CalciumField()\nExact Complex Field\n\njulia> exp(C(pi) * C(1im)) + 1\n0\n\njulia> log(C(-1))\n3.14159*I {a*b where a = 3.14159 [Pi], b = I [b^2+1=0]}\n\njulia> log(C(-1)) ^ 2\n-9.86960 {-a^2 where a = 3.14159 [Pi], b = I [b^2+1=0]}\n\njulia> log(C(10)^23) // log(C(100))\n11.5000 {23/2}\n\njulia> 4*atan(C(1)//5) - atan(C(1)//239) == C(pi)//4\ntrue\n\njulia> Cx, x = polynomial_ring(C, \"x\")\n(Univariate Polynomial Ring in x over Exact Complex Field, x)\n\njulia> (a, b) = (sqrt(C(2)), sqrt(C(3)))\n(1.41421 {a where a = 1.41421 [a^2-2=0]}, 1.73205 {a where a = 1.73205 [a^2-3=0]})\n\njulia> (x-a-b)*(x-a+b)*(x+a-b)*(x+a+b)\nx^4 + (-10)*x^2 + 1","category":"page"},{"location":"exact/#Conversions-and-numerical-evaluation","page":"Exact real and complex numbers","title":"Conversions and numerical evaluation","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Calcium numbers can created from integers (ZZ), rationals (QQ) and algebraic numbers (QQbar), and through the application of arithmetic operations and transcendental functions.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Calcium numbers can be converted to integers, rational and algebraic fields provided that the values are integer, rational or algebraic. An exception is thrown if the value does not belong to the target domain, if Calcium is unable to prove that the value belongs to the target domain, or if Calcium is unable to compute the explicit value because of evaluation limits.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> QQ(C(1))\n1\n\njulia> QQBar(sqrt(C(2)) // 2)\nRoot 0.707107 of 2x^2 - 1\n\njulia> QQ(C(pi))\nERROR: unable to convert to a rational number\n\njulia> QQ(C(10) ^ C(10^9))\nERROR: unable to convert to a rational number","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"To compute arbitrary-precision numerical enclosures, convert to ArbField or AcbField:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> CC = AcbField(64);\n\njulia> CC(exp(C(1im)))\n[0.54030230586813971740 +/- 9.37e-22] + [0.84147098480789650665 +/- 2.51e-21]*im","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The constructor","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"(R::AcbField)(a::ca; parts::Bool=false)","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"returns an enclosure of the complex number a. It attempts to obtain a relative accuracy of prec bits where prec is the precision of the target field, but it is not guaranteed that this goal is achieved.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"If parts is set to true, it attempts to achieve the target accuracy for both real and imaginary parts. This can be significantly more expensive if one part is smaller than the other, or if the number is nontrivially purely real or purely imaginary (in which case an exact proof attempt is made).","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> x = sin(C(1), form=:exponential)\n0.841471 + 0e-24*I {(-a^2*b+b)/(2*a) where a = 0.540302 + 0.841471*I [Exp(1.00000*I {b})], b = I [b^2+1=0]}\n\njulia> AcbField(64)(x)\n[0.84147098480789650665 +/- 2.51e-21] + [+/- 4.77e-29]*im\n\njulia> AcbField(64)(x, parts=true)\n[0.84147098480789650665 +/- 2.51e-21]","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The constructor","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"(R::ArbField)(a::ca; check::Bool=true)","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"returns a real enclosure. If check is set to true (default), the number a is verified to be real, and an exception is thrown if this cannot be determined. With check set to false, this function returns an enclosure of the real part of a without checking that the imaginary part is zero. This can be significantly faster.","category":"page"},{"location":"exact/#Comparisons-and-properties","page":"Exact real and complex numbers","title":"Comparisons and properties","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Except where otherwise noted, predicate functions such as iszero, ==, < and isreal act on the mathematical values of Calcium field elements. For example, although evaluating x = sqrt2 sqrt3 and y = sqrt6 results in different internal representations (x in mathbbQ(sqrt3 sqrt2) and y in mathbbQ(sqrt6)), the numbers compare as equal:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> x = sqrt(C(2)) * sqrt(C(3))\n2.44949 {a*b where a = 1.73205 [a^2-3=0], b = 1.41421 [b^2-2=0]}\n\njulia> y = sqrt(C(6))\n2.44949 {a where a = 2.44949 [a^2-6=0]}\n\njulia> x == y\ntrue\n\njulia> iszero(x - y)\ntrue\n\njulia> isinteger(x - y)\ntrue","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Predicate functions return true if the property is provably true and false if the property if provably false. If Calcium is unable to prove the truth value, an exception is thrown. For example, with default settings, Calcium is currently able to prove that e^e^-1000 ne 1, but it fails to prove e^e^-3000 ne 1:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> x = exp(exp(C(-1000)))\n1.00000 {a where a = 1.00000 [Exp(5.07596e-435 {b})], b = 5.07596e-435 [Exp(-1000)]}\n\njulia> x == 1\nfalse\n\njulia> x = exp(exp(C(-3000)))\n1.00000 {a where a = 1.00000 [Exp(1.30784e-1303 {b})], b = 1.30784e-1303 [Exp(-3000)]}\n\njulia> x == 1\nERROR: Unable to perform operation (failed deciding truth of a predicate): isequal\n...","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"In this case, we can get an answer by allowing a higher working precision:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> C2 = CalciumField(options=Dict(:prec_limit => 10^5));\n\njulia> exp(exp(C2(-3000))) == 1\nfalse","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Real numbers can be ordered and sorted the usual way. We illustrate finding square roots that are well-approximated by integers:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> sort([sqrt(C(n)) for n=0:10], by=x -> abs(x - floor(x + C(1)//2)))\n11-element Vector{ca}:\n 0\n 1\n 2\n 3\n 3.16228 {a where a = 3.16228 [a^2-10=0]}\n 2.82843 {2*a where a = 1.41421 [a^2-2=0]}\n 2.23607 {a where a = 2.23607 [a^2-5=0]}\n 1.73205 {a where a = 1.73205 [a^2-3=0]}\n 2.64575 {a where a = 2.64575 [a^2-7=0]}\n 1.41421 {a where a = 1.41421 [a^2-2=0]}\n 2.44949 {a where a = 2.44949 [a^2-6=0]}","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"As currently implemented, order comparisons involving nonreal numbers yield false (in both directions) rather than throwing an exception:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> C(1im) < C(1im)\nfalse\n\njulia> C(1im) > C(1im)\nfalse","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"This behavior may be changed or may become configurable in the future.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Interface","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"iszero(a::ca)\nisone(a::ca)\nis_algebraic(a::ca)\nis_rational(a::ca)\nisinteger(a::ca)\nisreal(a::ca)\nis_imaginary(a::ca)","category":"page"},{"location":"exact/#Base.iszero-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.iszero","text":"iszero(a::ca)\n\nReturn whether a is the number 0.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.isone-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.isone","text":"isone(a::ca)\n\nReturn whether a is the number 1.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_algebraic-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_algebraic","text":"is_algebraic(a::ca)\n\nReturn whether a is an algebraic number.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_rational-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_rational","text":"is_rational(a::ca)\n\nReturn whether a is a rational number.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.isinteger-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.isinteger","text":"isinteger(a::ca)\n\nReturn whether a is an integer.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.isreal-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.isreal","text":"isreal(a::ca)\n\nReturn whether a is a real number. This returns false if a is a pure real infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_imaginary-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_imaginary","text":"is_imaginary(a::ca)\n\nReturn whether a is an imaginary number. This returns false if a is a pure imaginary infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Infinities-and-special-values","page":"Exact real and complex numbers","title":"Infinities and special values","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"By default, CalciumField does not permit creating values that are not numbers, and any non-number value (unsigned infinity, signed infinity, Undefined) will result in an exception. This also applies to the special value Unknown, used in situations where Calcium is unable to prove that a value is a number. To enable special values, use extended=true.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> C = CalciumField()\nExact Complex Field\n\njulia> 1 // C(0)\nERROR: DomainError with UnsignedInfinity:\nNon-number result\n...\n\njulia> Cext = CalciumField(extended=true)\nExact Complex Field (Extended)\n\njulia> 1 // Cext(0)\nUnsignedInfinity","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Note that special values do not satisfy the properties of a mathematical ring or field. You will likely get meaningless results if you put infinities in matrices or polynomials.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"unsigned_infinity(C::CalciumField)\ninfinity(C::CalciumField)\ninfinity(a::ca)\nundefined(C::CalciumField)\nunknown(C::CalciumField)\nis_number(a::ca)\nis_undefined(a::ca)\nisinf(a::ca)\nis_uinf(a::ca)\nis_signed_inf(a::ca)\nis_unknown(a::ca)","category":"page"},{"location":"exact/#Nemo.unsigned_infinity-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.unsigned_infinity","text":"unsigned_infinity(C::CalciumField)\n\nReturn unsigned infinity (hat infty) as an element of C. This throws an exception if C does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.infinity-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.infinity","text":"infinity(C::CalciumField)\n\nReturn positive infinity (+infty) as an element of C. This throws an exception if C does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.infinity-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.infinity","text":"infinity(a::ca)\n\nReturn the signed infinity (a cdot infty). This throws an exception if the parent of a does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.undefined-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.undefined","text":"undefined(C::CalciumField)\n\nReturn the special value Undefined as an element of C. This throws an exception if C does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.unknown-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.unknown","text":"unknown(C::CalciumField)\n\nReturn the special meta-value Unknown as an element of C. This throws an exception if C does not allow special values.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_number-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_number","text":"is_number(a::ca)\n\nReturn whether a is a number, i.e. not an infinity or undefined.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_undefined-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_undefined","text":"is_undefined(a::ca)\n\nReturn whether a is the special value Undefined.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.isinf-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.isinf","text":"isinf(a::ca)\n\nReturn whether a is any infinity (signed or unsigned).\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_uinf-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_uinf","text":"is_uinf(a::ca)\n\nReturn whether a is unsigned infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_signed_inf-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_signed_inf","text":"is_signed_inf(a::ca)\n\nReturn whether a is any signed infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.is_unknown-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.is_unknown","text":"is_unknown(a::ca)\n\nReturn whether a is the special value Unknown. This is a representation property and not a mathematical predicate.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Complex-parts","page":"Exact real and complex numbers","title":"Complex parts","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Functions for computing components of real and complex numbers will perform automatic symbolic simplifications in special cases. In general, such operations will introduce new extension numbers.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> real(C(2+3im))\n2\n\njulia> sign(C(2im))\n1.00000*I {a where a = I [a^2+1=0]}\n\njulia> sign(C(2+3im))\n0.554700 + 0.832050*I {a where a = 0.554700 + 0.832050*I [13*a^4+10*a^2+13=0]}\n\njulia> angle(C(2+2im))\n0.785398 {(a)/4 where a = 3.14159 [Pi]}\n\njulia> angle(C(2+3im))\n0.982794 {a where a = 0.982794 [Arg(2.00000 + 3.00000*I {3*b+2})], b = I [b^2+1=0]}\n\njulia> angle(C(2+3im)) == atan(C(3)//2)\ntrue\n\njulia> floor(C(pi) ^ 100)\n5.18785e+49 {51878483143196131920862615246303013562686760680405}\n\njulia> ZZ(floor(C(pi) ^ 100))\n51878483143196131920862615246303013562686760680405","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Interface","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"real(a::ca)\nimag(a::ca)\nangle(a::ca)\ncsgn(a::ca)\nsign(a::ca)\nabs(a::ca)\nconj(a::ca; form::Symbol=:default)\nfloor(a::ca)\nceil(a::ca)","category":"page"},{"location":"exact/#Base.real-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.real","text":"real(a::ca)\n\nReturn the real part of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.imag-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.imag","text":"imag(a::ca)\n\nReturn the imaginary part of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.angle-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.angle","text":"angle(a::ca)\n\nReturn the complex argument of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.csgn-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.csgn","text":"csgn(a::ca)\n\nReturn the extension of the real sign function taking the value 1 strictly in the right half plane, -1 strictly in the left half plane, and the sign of the imaginary part when on the imaginary axis. Equivalently, operatornamecsgn(x) = x sqrtx^2 except that the value is 0 at zero.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.sign-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.sign","text":"sign(a::ca)\n\nReturn the complex sign of a, defined as zero if a is zero and as a a for any other complex number. This function also extracts the sign when a is a signed infinity.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.abs-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.abs","text":"abs(a::ca)\n\nReturn the absolute value of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.conj-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.conj","text":"conj(a::ca; form::Symbol=:default)\n\nReturn the complex conjugate of a. The optional form argument allows specifying the representation. In :shallow form, overlinea is introduced as a new extension number if it no straightforward simplifications are possible. In :deep form, complex conjugation is performed recursively.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.floor-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.floor","text":"floor(a::ca)\n\nReturn the floor function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.ceil-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.ceil","text":"ceil(a::ca)\n\nReturn the ceiling function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Elementary-and-special-functions","page":"Exact real and complex numbers","title":"Elementary and special functions","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Elementary and special functions generally create new extension numbers. In special cases, simplifications occur automatically.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> exp(C(1))\n2.71828 {a where a = 2.71828 [Exp(1)]}\n\njulia> exp(C(0))\n1\n\njulia> atan(C(1))\n0.785398 {(a)/4 where a = 3.14159 [Pi]}\n\njulia> cos(C(1))^2 + sin(C(1))^2\n1\n\njulia> log(1 // exp(sqrt(C(2))+1)) == -sqrt(C(2)) - 1\ntrue\n\njulia> gamma(C(2+3im))\n-0.0823953 + 0.0917743*I {a where a = -0.0823953 + 0.0917743*I [Gamma(2.00000 + 3.00000*I {3*b+2})], b = I [b^2+1=0]}\n\njulia> gamma(C(5) // 2)\n1.32934 {(3*a)/4 where a = 1.77245 [Sqrt(3.14159 {b})], b = 3.14159 [Pi]}\n\njulia> erf(C(1))\n0.842701 {a where a = 0.842701 [Erf(1)]}\n\njulia> erf(C(1)) + erfc(C(1))\n1","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Some functions allow representing the result in different forms:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> s1 = sin(C(1))\n0.841471 - 0e-24*I {(-a^2*b+b)/(2*a) where a = 0.540302 + 0.841471*I [Exp(1.00000*I {b})], b = I [b^2+1=0]}\n\njulia> s2 = sin(C(1), form=:direct)\n0.841471 {a where a = 0.841471 [Sin(1)]}\n\njulia> s3 = sin(C(1), form=:exponential)\n0.841471 - 0e-24*I {(-a^2*b+b)/(2*a) where a = 0.540302 + 0.841471*I [Exp(1.00000*I {b})], b = I [b^2+1=0]}\n\njulia> s4 = sin(C(1), form=:tangent)\n0.841471 {(2*a)/(a^2+1) where a = 0.546302 [Tan(0.500000 {1/2})]}\n\njulia> s1 == s2 == s3 == s4\ntrue\n\njulia> isreal(s1) && isreal(s2) && isreal(s3) && isreal(s4)\ntrue","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"The exponential form is currently used by default since it tends to be the most useful for symbolic simplification. The :direct and :tangent forms are likely to be better for numerical evaluation. The default behavior of trigonometric functions can be changed using the :trig_form option of CalciumField.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Proving equalities involving transcendental function values is a difficult problem in general. Calcium will sometimes fail even in elementary cases. Here is an example of two constant trigonometric identities where the first succeeds and the second fails:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> a = sqrt(C(2)) + 1;\n\njulia> cos(a) + cos(2*a) + cos(3*a) == sin(7*a//2)//(2*sin(a//2)) - C(1)//2\ntrue\n\njulia> sin(3*a) == 4 * sin(a) * sin(C(pi)//3 - a) * sin(C(pi)//3 + a)\nERROR: Unable to perform operation (failed deciding truth of a predicate): isequal","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"A possible workaround is to fall back on a numerical comparison:","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"julia> abs(cos(a) + cos(2*a) + cos(3*a) - (sin(7*a//2)//(2*sin(a//2)) - C(1)//2)) <= C(10)^-100\ntrue","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Of course, this is not a rigorous proof that the numbers are equal, and CalciumField is overkill here; it would be far more efficient to use ArbField directly to check that the numbers are approximately equal.","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"Interface","category":"page"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"const_pi(C::CalciumField)\nconst_euler(C::CalciumField)\nonei(C::CalciumField)\nsqrt(a::ca)\nexp(a::ca)\nlog(a::ca)\npow(a::ca, b::Int; form::Symbol=:default)\nsin(a::ca; form::Symbol=:default)\ncos(a::ca; form::Symbol=:default)\ntan(a::ca; form::Symbol=:default)\natan(a::ca; form::Symbol=:default)\nasin(a::ca; form::Symbol=:default)\nacos(a::ca; form::Symbol=:default)\ngamma(a::ca)\nerf(a::ca)\nerfi(a::ca)\nerfc(a::ca)","category":"page"},{"location":"exact/#Nemo.const_pi-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.const_pi","text":"const_pi(C::CalciumField)\n\nReturn the constant pi as an element of C.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.const_euler-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.const_euler","text":"const_euler(C::CalciumField)\n\nReturn Euler's constant gamma as an element of C.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.onei-Tuple{CalciumField}","page":"Exact real and complex numbers","title":"Nemo.onei","text":"onei(C::CalciumField)\n\nReturn the imaginary unit i as an element of C.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.sqrt-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.sqrt","text":"Base.sqrt(a::ca; check::Bool=true)\n\nReturn the principal square root of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.exp-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.exp","text":"exp(a::ca)\n\nReturn the exponential function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.log-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.log","text":"log(a::ca)\n\nReturn the natural logarithm of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.pow-Tuple{ca, Int64}","page":"Exact real and complex numbers","title":"Nemo.pow","text":"pow(a::ca, b::Int; form::Symbol=:default)\n\nReturn a raised to the integer power b. The optional form argument allows specifying the representation. In :default form, this is equivalent to a ^ b, which may create a new extension number a^b if the exponent b is too large (as determined by the parent option :pow_limit or :prec_limit depending on the case). In :arithmetic form, the exponentiation is performed arithmetically in the field of a, regardless of the size of the exponent b.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.sin-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.sin","text":"sin(a::ca; form::Symbol=:default)\n\nReturn the sine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :tangent form, the value is represented using tangents. In :direct form, the value is represented directly using a sine or cosine.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.cos-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.cos","text":"cos(a::ca; form::Symbol=:default)\n\nReturn the cosine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :tangent form, the value is represented using tangents. In :direct form, the value is represented directly using a sine or cosine.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.tan-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.tan","text":"tan(a::ca; form::Symbol=:default)\n\nReturn the tangent of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :exponential form, the value is represented using complex exponentials. In :direct or :tangent form, the value is represented directly using tangents. In :sine_cosine form, the value is represented using sines or cosines.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.atan-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.atan","text":"atan(a::ca; form::Symbol=:default)\n\nReturn the inverse tangent of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct or :arctangent form, the value is represented directly using arctangents.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.asin-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.asin","text":"asin(a::ca; form::Symbol=:default)\n\nReturn the inverse sine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct form, the value is represented directly using an inverse sine or cosine.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Base.acos-Tuple{ca}","page":"Exact real and complex numbers","title":"Base.acos","text":"acos(a::ca; form::Symbol=:default)\n\nReturn the inverse cosine of a. The optional form argument allows specifying the representation. In :default form, the result is determined by the :trig_form option of the parent object. In :logarithm form, the value is represented using complex logarithms. In :direct form, the value is represented directly using an inverse sine or cosine.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.gamma-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.gamma","text":"gamma(a::ca)\n\nReturn the gamma function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.erf-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.erf","text":"erf(a::ca)\n\nReturn the error function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.erfi-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.erfi","text":"erfi(a::ca)\n\nReturn the imaginary error function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Nemo.erfc-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.erfc","text":"erfc(a::ca)\n\nReturn the complementary error function of a.\n\n\n\n\n\n","category":"method"},{"location":"exact/#Rewriting-and-simplification","page":"Exact real and complex numbers","title":"Rewriting and simplification","text":"","category":"section"},{"location":"exact/","page":"Exact real and complex numbers","title":"Exact real and complex numbers","text":"complex_normal_form(a::ca; deep::Bool=true)","category":"page"},{"location":"exact/#Nemo.complex_normal_form-Tuple{ca}","page":"Exact real and complex numbers","title":"Nemo.complex_normal_form","text":"complex_normal_form(a::ca, deep::Bool=true)\n\nReturns the input rewritten using standardizing transformations over the complex numbers:\n\nElementary functions are rewritten in terms of exponentials, roots and logarithms.\nComplex parts are rewritten using logarithms, square roots, and (deep) complex conjugates.\nAlgebraic numbers are rewritten in terms of cyclotomic fields where applicable.\n\nIf deep is set, the rewriting is applied recursively to the tower of extension numbers; otherwise, the rewriting is only applied to the top-level extension numbers.\n\nThe result is not a normal form in the strong sense (the same number can have many possible representations even after applying this transformation), but this transformation can nevertheless be a useful heuristic for simplification.\n\n\n\n\n\n","category":"method"},{"location":"rational/","page":"Rationals","title":"Rationals","text":"CurrentModule = Nemo","category":"page"},{"location":"rational/#Rationals","page":"Rationals","title":"Rationals","text":"","category":"section"},{"location":"rational/","page":"Rationals","title":"Rationals","text":"Nemo provides much functionality for the rational numbers. See the section on Fraction Fields where all the basic functionality is documented, along with the extra functionality only available for the rational numbers themselves.","category":"page"},{"location":"constructors/#Constructing-mathematical-objects-in-Nemo","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"","category":"section"},{"location":"constructors/#Constructing-objects-in-Julia","page":"Constructing mathematical objects in Nemo","title":"Constructing objects in Julia","text":"","category":"section"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"In Julia, one constructs objects of a given type by calling a type constructor. This is simply a function with the same name as the type itself. For example, to construct a BigInt object in Julia, we simply call the BigInt constructor:","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"n = BigInt(\"1234567898765434567898765434567876543456787654567890\")","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Julia also uses constructors to convert between types. For example, to convert an Int to a BigInt:","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"m = BigInt(123)","category":"page"},{"location":"constructors/#How-we-construct-objects-in-Nemo","page":"Constructing mathematical objects in Nemo","title":"How we construct objects in Nemo","text":"","category":"section"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Julia types don't contain enough information to properly model groups, rings and fields, especially if they are parameterised by values. For example, the ring of integers modulo n for a multiprecision modulus n cannot be modeled using types alone.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Instead of using types to construct objects in Nemo, we use special objects that we refer to as parent objects. They behave a lot like Julia types.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Consider the following simple example, to create a Flint multiprecision integer:","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"n = ZZ(\"12345678765456787654567890987654567898765678909876567890\")","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Here ZZ is not a Julia type, but a callable object. However, for most purposes one can think of such a parent object ZZ as though it were a type.","category":"page"},{"location":"constructors/#Constructing-parent-objects","page":"Constructing mathematical objects in Nemo","title":"Constructing parent objects","text":"","category":"section"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"For more complicated groups, rings, fields, etc., one first needs to construct the parent object before one can use it to construct element objects.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Nemo provides a set of functions for constructing such parent objects. For example, to create a parent object for polynomials over the integers, we use the polynomial_ring parent object constructor.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"R, x = polynomial_ring(ZZ, \"x\")\nf = x^3 + 3x + 1\ng = R(12)","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"In this example, R is the parent object and we use it to convert the Int value 12 to an element of the polynomial ring mathbbZx.","category":"page"},{"location":"constructors/#List-of-parent-object-constructors","page":"Constructing mathematical objects in Nemo","title":"List of parent object constructors","text":"","category":"section"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"For convenience, we provide a list of all the parent object constructors in Nemo and explain what domains they represent.","category":"page"},{"location":"constructors/","page":"Constructing mathematical objects in Nemo","title":"Constructing mathematical objects in Nemo","text":"Mathematics Nemo constructor\nR = mathbbZ R = ZZ\nR = mathbbQ R = QQ\nR = mathbbF_p^n R, a = FiniteField(p, n, \"a\")\nR = mathbbZnmathbbZ R = residue_ring(ZZ, n)\nS = Rx S, x = polynomial_ring(R, \"x\")\nS = Rx y S, (x, y) = polynomial_ring(R, [\"x\", \"y\"])\nS = Rx (to precision n) S, x = power_series_ring(R, n, \"x\")\nS = R((x)) (to precision n) S, x = laurent_series_ring(R, n, \"x\")\nS = mathrmFrac_R S = fraction_field(R)\nS = R(f) S = residue_ring(R, f)\nS = mathrmMat_mtimes n(R) S = matrix_space(R, m, n)\nS = mathbbQx(f) S, a = number_field(f, \"a\")\nS = mathbbQ_p (to precision N) S = PadicField(p, n)\nS = mathbbR (to precision n) S = RealField(n)\nS = mathbbC (to precision n) S = ComplexField(n)","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"matrix/#Matrices","page":"Matrices","title":"Matrices","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Nemo allow the creation of dense matrices over any computable ring R. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of matrices over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"The following table shows each of the matrix types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of matrix (the type information is mainly of concern to developers).","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.Mat{T} Generic.MatSpace{T}\nmathbbZ Flint ZZMatrix ZZMatrixSpace\nmathbbZnmathbbZ (small n) Flint zzModMatrix zzModMatrixSpace\nmathbbZnmathbbZ (large n) Flint ZZModMatrix ZZModMatrixSpace\nmathbbQ Flint QQMatrix QQMatrixSpace\nmathbbZpmathbbZ (small p) Flint fpMatrix fpMatrixSpace\nmathbbF_p^n (small p) Flint fqPolyRepMatrix fqPolyRepMatrixSpace\nmathbbF_p^n (large p) Flint FqPolyRepMatrix `FqPolyRepMatrixSpace\nmathbbR (arbitrary precision) Arb RealMat RealMatSpace\nmathbbC (arbitrary precision) Arb ComplexMat ComplexMatSpace\nmathbbR (fixed precision) Arb arb_mat ArbMatSpace\nmathbbC (fixed precision) Arb acb_mat AcbMatSpace","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"The dimensions and base ring R of a generic matrix are stored in its parent object.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"All matrix element types belong to the abstract type MatElem and all of the matrix space types belong to the abstract type MatSpace. This enables one to write generic functions that can accept any Nemo matrix type.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Note that the preferred way to create matrices is not to use the type constructors but to use the matrix function, see also the Matrix element constructors section of the AbstractAlgebra manual.","category":"page"},{"location":"matrix/#Matrix-functionality","page":"Matrices","title":"Matrix functionality","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"All matrix spaces in Nemo provide the matrix functionality of AbstractAlgebra:","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/matrix","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Some of this functionality is provided in Nemo by C libraries, such as Flint, for various specific rings.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"In the following, we list the functionality which is provided in addition to the generic matrix functionality, for specific rings in Nemo.","category":"page"},{"location":"matrix/#Comparison-operators","page":"Matrices","title":"Comparison operators","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"overlaps(::RealMat, ::RealMat)","category":"page"},{"location":"matrix/#Nemo.overlaps-Tuple{RealMat, RealMat}","page":"Matrices","title":"Nemo.overlaps","text":"overlaps(x::RealMat, y::RealMat)\n\nReturns true if all entries of x overlap with the corresponding entry of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"overlaps(::ComplexMat, ::ComplexMat)","category":"page"},{"location":"matrix/#Nemo.overlaps-Tuple{ComplexMat, ComplexMat}","page":"Matrices","title":"Nemo.overlaps","text":"overlaps(x::ComplexMat, y::ComplexMat)\n\nReturns true if all entries of x overlap with the corresponding entry of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"contains(::RealMat, ::RealMat)","category":"page"},{"location":"matrix/#Base.contains-Tuple{RealMat, RealMat}","page":"Matrices","title":"Base.contains","text":"contains(x::RealMat, y::RealMat)\n\nReturns true if all entries of x contain the corresponding entry of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"contains(::ComplexMat, ::ComplexMat)","category":"page"},{"location":"matrix/#Base.contains-Tuple{ComplexMat, ComplexMat}","page":"Matrices","title":"Base.contains","text":"contains(x::ComplexMat, y::ComplexMat)\n\nReturns true if all entries of x contain the corresponding entry of y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"In addition we have the following ad hoc comparison operators.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"C = RR[1 2; 3 4]\nD = RR[\"1 +/- 0.1\" \"2 +/- 0.1\"; \"3 +/- 0.1\" \"4 +/- 0.1\"]\noverlaps(C, D)\ncontains(D, C)","category":"page"},{"location":"matrix/#Scaling","page":"Matrices","title":"Scaling","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"<<(::ZZMatrix, ::Int)","category":"page"},{"location":"matrix/#Base.:<<-Tuple{ZZMatrix, Int64}","page":"Matrices","title":"Base.:<<","text":"<<(x::ZZMatrix, y::Int)\n\nReturn 2^yx.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":">>(::ZZMatrix, ::Int)","category":"page"},{"location":"matrix/#Base.:>>-Tuple{ZZMatrix, Int64}","page":"Matrices","title":"Base.:>>","text":">>(x::ZZMatrix, y::Int)\n\nReturn x2^y where rounding is towards zero.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 9 6 3])\n\nB = A<<5\nC = B>>2","category":"page"},{"location":"matrix/#Determinant","page":"Matrices","title":"Determinant","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"det_divisor(::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.det_divisor-Tuple{ZZMatrix}","page":"Matrices","title":"Nemo.det_divisor","text":"det_divisor(x::ZZMatrix)\n\nReturn some positive divisor of the determinant of x, if the determinant is nonzero, otherwise return zero.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"det_given_divisor(::ZZMatrix, ::Integer, ::Bool)\ndet_given_divisor(::ZZMatrix, ::ZZRingElem, ::Bool)","category":"page"},{"location":"matrix/#Nemo.det_given_divisor-Tuple{ZZMatrix, Integer, Bool}","page":"Matrices","title":"Nemo.det_given_divisor","text":"det_given_divisor(x::ZZMatrix, d::Integer, proved=true)\n\nReturn the determinant of x given a positive divisor of its determinant. If proved == true (the default), the output is guaranteed to be correct, otherwise a heuristic algorithm is used.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.det_given_divisor-Tuple{ZZMatrix, ZZRingElem, Bool}","page":"Matrices","title":"Nemo.det_given_divisor","text":"det_given_divisor(x::ZZMatrix, d::ZZRingElem, proved=true)\n\nReturn the determinant of x given a positive divisor of its determinant. If proved == true (the default), the output is guaranteed to be correct, otherwise a heuristic algorithm is used.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 9 6 3])\n\nc = det_divisor(A)\nd = det_given_divisor(A, c)","category":"page"},{"location":"matrix/#Linear-solving","page":"Matrices","title":"Linear solving","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"cansolve(::ZZMatrix, ::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.cansolve-Tuple{ZZMatrix, ZZMatrix}","page":"Matrices","title":"Nemo.cansolve","text":"cansolve(a::ZZMatrix, b::ZZMatrix) -> Bool, ZZMatrix\n\nReturn true and a matrix x such that ax = b, or false and some matrix in case x does not exist.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"solve_dixon(::ZZMatrix, ::ZZMatrix)\nsolve_dixon(::QQMatrix, ::QQMatrix)","category":"page"},{"location":"matrix/#Nemo.solve_dixon-Tuple{ZZMatrix, ZZMatrix}","page":"Matrices","title":"Nemo.solve_dixon","text":"solve_dixon(a::ZZMatrix, b::ZZMatrix)\n\nReturn a tuple (x m) consisting of a column vector x such that ax = b pmodm. The element b must be a column vector with the same number > of rows as a and a must be a square matrix. If these conditions are not met or (x d) does not exist, an exception is raised.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.solve_dixon-Tuple{QQMatrix, QQMatrix}","page":"Matrices","title":"Nemo.solve_dixon","text":"solve_dixon(a::QQMatrix, b::QQMatrix)\n\nSolve ax = b by clearing denominators and using Dixon's algorithm. This is usually faster for large systems.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\nT = matrix_space(ZZ, 3, 1)\n\nA = S([ZZ(2) 3 5; 1 4 7; 9 2 2])\nB = T([ZZ(4), 5, 7])\n\nX, m = solve_dixon(A, B)","category":"page"},{"location":"matrix/#Pseudo-inverse","page":"Matrices","title":"Pseudo inverse","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"pseudo_inv(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.pseudo_inv-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.pseudo_inv","text":"pseudo_inv(x::ZZMatrix)\n\nReturn a tuple (z d) consisting of a matrix z and denominator d such that zd is the inverse of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([1 0 1; 2 3 1; 5 6 7])\n\nB, d = pseudo_inv(A)","category":"page"},{"location":"matrix/#Nullspace","page":"Matrices","title":"Nullspace","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"nullspace_right_rational(x::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.nullspace_right_rational-Tuple{ZZMatrix}","page":"Matrices","title":"Nemo.nullspace_right_rational","text":"nullspace_right_rational(x::ZZMatrix)\n\nReturn a tuple (r U) consisting of a matrix U such that the first r columns form the right rational nullspace of x, i.e. a set of vectors over mathbbZ giving a mathbbQ-basis for the nullspace of x considered as a matrix over mathbbQ.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Modular-reduction","page":"Matrices","title":"Modular reduction","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"reduce_mod(::ZZMatrix, ::Integer)\nreduce_mod(::ZZMatrix, ::ZZRingElem)","category":"page"},{"location":"matrix/#Nemo.reduce_mod-Tuple{ZZMatrix, Integer}","page":"Matrices","title":"Nemo.reduce_mod","text":"reduce_mod(x::ZZMatrix, y::Integer)\n\nReduce the entries of x modulo y and return the result.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.reduce_mod-Tuple{ZZMatrix, ZZRingElem}","page":"Matrices","title":"Nemo.reduce_mod","text":"reduce_mod(x::ZZMatrix, y::ZZRingElem)\n\nReduce the entries of x modulo y and return the result.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 9 2 2])\n\nreduce_mod(A, ZZ(5))\nreduce_mod(A, 2)","category":"page"},{"location":"matrix/#Lifting","page":"Matrices","title":"Lifting","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lift(::zzModMatrix)\nlift(::fpMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.lift-Tuple{zzModMatrix}","page":"Matrices","title":"AbstractAlgebra.lift","text":"lift(a::T) where {T <: Zmodn_mat}\n\nReturn a lift of the matrix a to a matrix over mathbbZ, i.e. where the entries of the returned matrix are those of a lifted to mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#AbstractAlgebra.lift-Tuple{fpMatrix}","page":"Matrices","title":"AbstractAlgebra.lift","text":"lift(a::fpMatrix)\n\nReturn a lift of the matrix a to a matrix over mathbbZ, i.e. where the entries of the returned matrix are those of a lifted to mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"R = residue_ring(ZZ, 7)\nS = matrix_space(R, 3, 3)\n\na = S([4 5 6; 7 3 2; 1 4 5])\n\n b = lift(a)","category":"page"},{"location":"matrix/#Special-matrices","page":"Matrices","title":"Special matrices","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hadamard(::ZZMatrixSpace)","category":"page"},{"location":"matrix/#Nemo.hadamard-Tuple{ZZMatrixSpace}","page":"Matrices","title":"Nemo.hadamard","text":"hadamard(R::ZZMatrixSpace)\n\nReturn the Hadamard matrix for the given matrix space. The number of rows and columns must be equal.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"is_hadamard(::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.is_hadamard-Tuple{ZZMatrix}","page":"Matrices","title":"Nemo.is_hadamard","text":"is_hadamard(x::ZZMatrix)\n\nReturn true if the given matrix is Hadamard, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hilbert(::QQMatrixSpace)","category":"page"},{"location":"matrix/#Nemo.hilbert-Tuple{QQMatrixSpace}","page":"Matrices","title":"Nemo.hilbert","text":"hilbert(R::QQMatrixSpace)\n\nReturn the Hilbert matrix in the given matrix space. This is the matrix with entries H_ij = 1(i + j - 1).\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"R = matrix_space(ZZ, 3, 3)\nS = matrix_space(QQ, 3, 3)\n\nA = hadamard(R)\nis_hadamard(A)\nB = hilbert(R)","category":"page"},{"location":"matrix/#Hermite-Normal-Form","page":"Matrices","title":"Hermite Normal Form","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hnf(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.hnf-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.hnf","text":"hnf(x::ZZMatrix)\n\nReturn the Hermite Normal Form of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hnf_with_transform(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.hnf_with_transform-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.hnf_with_transform","text":"hnf_with_transform(x::ZZMatrix)\n\nCompute a tuple (H T) where H is the Hermite normal form of x and T is a transformation matrix so that H = Tx.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hnf_modular(::ZZMatrix, ::ZZRingElem)","category":"page"},{"location":"matrix/#Nemo.hnf_modular-Tuple{ZZMatrix, ZZRingElem}","page":"Matrices","title":"Nemo.hnf_modular","text":"hnf_modular(x::ZZMatrix, d::ZZRingElem)\n\nCompute the Hermite normal form of x given that d is a multiple of the determinant of the nonzero rows of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"hnf_modular_eldiv(::ZZMatrix, ::ZZRingElem)","category":"page"},{"location":"matrix/#Nemo.hnf_modular_eldiv-Tuple{ZZMatrix, ZZRingElem}","page":"Matrices","title":"Nemo.hnf_modular_eldiv","text":"hnf_modular_eldiv(x::ZZMatrix, d::ZZRingElem)\n\nCompute the Hermite normal form of x given that d is a multiple of the largest elementary divisor of x. The matrix x must have full rank.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"is_hnf(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.is_hnf-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.is_hnf","text":"is_hnf(x::ZZMatrix)\n\nReturn true if the given matrix is in Hermite Normal Form, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 19 3 7])\n\nB = hnf(A)\nH, T = hnf_with_transform(A)\nM = hnf_modular(A, ZZ(27))\nN = hnf_modular_eldiv(A, ZZ(27))\nis_hnf(M)","category":"page"},{"location":"matrix/#Lattice-basis-reduction","page":"Matrices","title":"Lattice basis reduction","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Nemo provides LLL lattice basis reduction. Optionally one can specify the setup using a context object created by the following function.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_ctx(delta::Float64, eta::Float64, rep=:zbasis, gram=:approx)","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Return a LLL context object specifying LLL parameters delta and eta and specifying the representation as either :zbasis or :gram and the Gram type as either :approx or :exact.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll","text":"lll(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nReturn the LLL reduction of the matrix x. By default the matrix x is a mathbbZ-basis and the Gram matrix is maintained throughout in approximate form. The LLL is performed with reduction parameters delta = 099 and eta = 051. All of these defaults can be overridden by specifying an optional context object.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_with_transform(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_with_transform-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll_with_transform","text":"lll_with_transform(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nCompute a tuple (L T) where L is the LLL reduction of a and T is a transformation matrix so that L = Ta. All the default parameters can be overridden by supplying an optional context object.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_gram(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_gram-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll_gram","text":"lll_gram(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))\n\nGiven the Gram matrix x of a matrix, compute the Gram matrix of its LLL reduction.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_gram_with_transform(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_gram_with_transform-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll_gram_with_transform","text":"lll_gram_with_transform(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))\n\nGiven the Gram matrix x of a matrix M, compute a tuple (L T) where L is the gram matrix of the LLL reduction of the matrix and T is a transformation matrix so that L = TM.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_with_removal(::ZZMatrix, ::ZZRingElem, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_with_removal-Tuple{ZZMatrix, ZZRingElem, lll_ctx}","page":"Matrices","title":"Nemo.lll_with_removal","text":"lll_with_removal(x::ZZMatrix, b::ZZRingElem, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nCompute the LLL reduction of x and throw away rows whose norm exceeds the given bound b. Return a tuple (r L) where the first r rows of L are the rows remaining after removal.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_with_removal_transform(::ZZMatrix, ::ZZRingElem, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_with_removal_transform-Tuple{ZZMatrix, ZZRingElem, lll_ctx}","page":"Matrices","title":"Nemo.lll_with_removal_transform","text":"lll_with_removal_transform(x::ZZMatrix, b::ZZRingElem, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nCompute a tuple (r L T) where the first r rows of L are those remaining from the LLL reduction after removal of vectors with norm exceeding the bound b and T is a transformation matrix so that L = Tx.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll!(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll!-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll!","text":"lll!(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51))\n\nPerform the LLL reduction of the matrix x inplace. By default the matrix x is a > mathbbZ-basis and the Gram matrix is maintained throughout in approximate form. The LLL is performed with reduction parameters delta = 099 and eta = 051. All of these defaults can be overridden by specifying an optional context object.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"lll_gram!(::ZZMatrix, ::lll_ctx)","category":"page"},{"location":"matrix/#Nemo.lll_gram!-Tuple{ZZMatrix, lll_ctx}","page":"Matrices","title":"Nemo.lll_gram!","text":"lll_gram!(x::ZZMatrix, ctx::lll_ctx = lll_ctx(0.99, 0.51, :gram))\n\nGiven the Gram matrix x of a matrix, compute the Gram matrix of its LLL reduction inplace.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 19 3 7])\n\nL = lll(A, lll_ctx(0.95, 0.55, :zbasis, :approx)\nL, T = lll_with_transform(A)\n\nG == lll_gram(gram(A))\nG, T = lll_gram_with_transform(gram(A))\n\nr, L = lll_with_removal(A, ZZ(100))\nr, L, T = lll_with_removal_transform(A, ZZ(100))","category":"page"},{"location":"matrix/#Smith-Normal-Form","page":"Matrices","title":"Smith Normal Form","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"snf(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.snf-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.snf","text":"snf(x::ZZMatrix)\n\nCompute the Smith normal form of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"snf_diagonal(::ZZMatrix)","category":"page"},{"location":"matrix/#Nemo.snf_diagonal-Tuple{ZZMatrix}","page":"Matrices","title":"Nemo.snf_diagonal","text":"snf_diagonal(x::ZZMatrix)\n\nGiven a diagonal matrix x compute the Smith normal form of x.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"is_snf(::ZZMatrix)","category":"page"},{"location":"matrix/#AbstractAlgebra.is_snf-Tuple{ZZMatrix}","page":"Matrices","title":"AbstractAlgebra.is_snf","text":"is_snf(x::ZZMatrix)\n\nReturn true if x is in Smith normal form, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"S = matrix_space(ZZ, 3, 3)\n\nA = S([ZZ(2) 3 5; 1 4 7; 19 3 7])\n\nB = snf(A)\nis_snf(B) == true\n\nB = S([ZZ(2) 0 0; 0 4 0; 0 0 7])\n\nC = snf_diagonal(B)","category":"page"},{"location":"matrix/#Strong-Echelon-Form","page":"Matrices","title":"Strong Echelon Form","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"strong_echelon_form(::zzModMatrix)\nstrong_echelon_form(::fpMatrix)","category":"page"},{"location":"matrix/#Nemo.strong_echelon_form-Tuple{zzModMatrix}","page":"Matrices","title":"Nemo.strong_echelon_form","text":"strong_echelon_form(a::zzModMatrix)\n\nReturn the strong echeleon form of a. The matrix a must have at least as many rows as columns.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.strong_echelon_form-Tuple{fpMatrix}","page":"Matrices","title":"Nemo.strong_echelon_form","text":"strong_echelon_form(a::fpMatrix)\n\nReturn the strong echeleon form of a. The matrix a must have at least as many rows as columns.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"R = residue_ring(ZZ, 12)\nS = matrix_space(R, 3, 3)\n\nA = S([4 1 0; 0 0 5; 0 0 0 ])\n\nB = strong_echelon_form(A)","category":"page"},{"location":"matrix/#Howell-Form","page":"Matrices","title":"Howell Form","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"howell_form(::zzModMatrix)\nhowell_form(::fpMatrix)","category":"page"},{"location":"matrix/#Nemo.howell_form-Tuple{zzModMatrix}","page":"Matrices","title":"Nemo.howell_form","text":"howell_form(a::zzModMatrix)\n\nReturn the Howell normal form of a. The matrix a must have at least as many rows as columns.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.howell_form-Tuple{fpMatrix}","page":"Matrices","title":"Nemo.howell_form","text":"howell_form(a::fpMatrix)\n\nReturn the Howell normal form of a. The matrix a must have at least as many rows as columns.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"R = residue_ring(ZZ, 12)\nS = matrix_space(R, 3, 3)\n\nA = S([4 1 0; 0 0 5; 0 0 0 ])\n\nB = howell_form(A)","category":"page"},{"location":"matrix/#Gram-Schmidt-Orthogonalisation","page":"Matrices","title":"Gram-Schmidt Orthogonalisation","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"gram_schmidt_orthogonalisation(::QQMatrix)","category":"page"},{"location":"matrix/#Nemo.gram_schmidt_orthogonalisation-Tuple{QQMatrix}","page":"Matrices","title":"Nemo.gram_schmidt_orthogonalisation","text":"gram_schmidt_orthogonalisation(x::QQMatrix)\n\nTakes the columns of x as the generators of a subset of mathbbQ^m and returns a matrix whose columns are an orthogonal generating set for the same subspace.\n\nExamples\n\njulia> S = matrix_space(QQ, 3, 3);\n\njulia> A = S([4 7 3; 2 9 1; 0 5 3])\n[4 7 3]\n[2 9 1]\n[0 5 3]\n\njulia> B = gram_schmidt_orthogonalisation(A)\n[4 -11//5 95//123]\n[2 22//5 -190//123]\n[0 5 209//123]\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Exponential","page":"Matrices","title":"Exponential","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = RR[2 0 0; 0 3 0; 0 0 1]\n\nB = exp(A)","category":"page"},{"location":"matrix/#Norm","page":"Matrices","title":"Norm","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"bound_inf_norm(::RealMat)","category":"page"},{"location":"matrix/#Nemo.bound_inf_norm-Tuple{RealMat}","page":"Matrices","title":"Nemo.bound_inf_norm","text":"bound_inf_norm(x::RealMat)\n\nReturns a nonnegative element z of type arb, such that z is an upper bound for the infinity norm for every matrix in x\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"bound_inf_norm(::ComplexMat)","category":"page"},{"location":"matrix/#Nemo.bound_inf_norm-Tuple{ComplexMat}","page":"Matrices","title":"Nemo.bound_inf_norm","text":"bound_inf_norm(x::ComplexMat)\n\nReturns a nonnegative element z of type acb, such that z is an upper bound for the infinity norm for every matrix in x\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = RR[1 2 3; 4 5 6; 7 8 9]\n\nd = bound_inf_norm(A)","category":"page"},{"location":"matrix/#Shifting","page":"Matrices","title":"Shifting","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = RR[1 2 3; 4 5 6; 7 8 9]\n\nB = ldexp(A, 4)\n\noverlaps(16*A, B)","category":"page"},{"location":"matrix/#Predicates","page":"Matrices","title":"Predicates","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Examples","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = CC[1 2 3; 4 5 6; 7 8 9]\n\nisreal(A)\n\nisreal(onei(CC)*A)","category":"page"},{"location":"matrix/#Conversion-to-Julia-matrices","page":"Matrices","title":"Conversion to Julia matrices","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Julia matrices use a different data structure than Nemo matrices. Conversion to Julia matrices is usually only required for interfacing with other packages. It isn't necessary to convert Nemo matrices to Julia matrices in order to manipulate them.","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"This conversion can be performed with standard Julia syntax, such as the following, where A is an ZZMatrix:","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"Matrix{Int}(A)\nMatrix{BigInt}(A)","category":"page"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"In case the matrix cannot be converted without loss, an InexactError is thrown: in this case, cast to a matrix of BigInts rather than Ints.","category":"page"},{"location":"matrix/#Eigenvalues-and-Eigenvectors-(experimental)","page":"Matrices","title":"Eigenvalues and Eigenvectors (experimental)","text":"","category":"section"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"eigvals(::ComplexMat)\neigvals_simple(a::ComplexMat)","category":"page"},{"location":"matrix/#LinearAlgebra.eigvals-Tuple{ComplexMat}","page":"Matrices","title":"LinearAlgebra.eigvals","text":"eigvals(A::ComplexMat)\n\nReturns the eigenvalues of A as a vector of tuples (ComplexFieldElem, Int). Each tuple (z, k) corresponds to a cluster of k eigenvalues of A.\n\nThis function is experimental.\n\n\n\n\n\n","category":"method"},{"location":"matrix/#Nemo.eigvals_simple-Tuple{ComplexMat}","page":"Matrices","title":"Nemo.eigvals_simple","text":"eigvals_simple(A::ComplexMat, algorithm::Symbol = :default)\n\nReturns the eigenvalues of A as a vector of acb. It is assumed that A has only simple eigenvalues.\n\nThe algorithm used can be changed by setting the algorithm keyword to :vdhoeven_mourrain or :rump.\n\nThis function is experimental.\n\n\n\n\n\n","category":"method"},{"location":"matrix/","page":"Matrices","title":"Matrices","text":"A = CC[1 2 3; 0 4 5; 0 0 6]\neigvals_simple(A)\nA = CC[2 2 3; 0 2 5; 0 0 2])\neigvals(A)","category":"page"},{"location":"about/#About-Nemo","page":"About Nemo","title":"About Nemo","text":"","category":"section"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Nemo is a library for fast basic arithmetic in various commonly used rings, for the Julia programming language. Our aim is to provide a highly performant package covering","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Commutative Algebra\nNumber Theory\nGroup Theory","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Nemo consists of wrappers of specialised C/C++ libraries:","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Flint http://flintlib.org/\nArb https://arblib.org/\nAntic https://github.com/wbhart/antic/\nCalcium https://fredrikj.net/calcium/","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Nemo also uses AbstractAlgebra.jl to provide generic constructions over the basic rings provided by the above packages.","category":"page"},{"location":"about/#Why-Julia?","page":"About Nemo","title":"Why Julia?","text":"","category":"section"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Julia is a sophisticated, modern programming language which is designed to be both performant and flexible. It was written by mathematicians, for mathematicians.","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"The benefits of Julia include","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"Familiar imperative syntax\nJIT compilation (provides near native performance, even for highly generic code)\nREPL console (cuts down on development time)\nParametric types (allows for fast generic constructions over other data types)\nPowerful metaprogramming facilities\nOperator overloading\nMultiple dispatch (dispatch on every argument of a function)\nEfficient native C interface (little or no wrapper overhead)\nExperimental C++ interface\nDynamic type inference\nBuilt-in bignums\nAble to be embedded in C programs\nHigh performance collection types (dictionaries, iterators, arrays, etc.)\nJupyter support (for web based notebooks)","category":"page"},{"location":"about/","page":"About Nemo","title":"About Nemo","text":"The main benefits for Nemo are the parametric type system and JIT compilation. The former allows us to model many mathematical types, e.g. generic polynomial rings over an arbitrary base ring. The latter speeds up the runtime performance, even of highly generic mathematical procedures.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"acb/#Fixed-precisioncomplex-balls","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Arbitrary precision complex ball arithmetic is supplied by Arb which provides a ball representation which tracks error bounds rigorously. Complex numbers are represented in rectangular form a+bi where ab are arb balls.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The Arb complex field is constructed using the AcbField constructor. This constructs the parent object for the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The types of complex boxes in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Library Field Element type Parent type\nArb mathbbC (boxes) acb AcbField","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"All the complex field types belong to the Field abstract type and the types of elements in this field, i.e. complex boxes in this case, belong to the FieldElem abstract type.","category":"page"},{"location":"acb/#Complex-ball-functionality","page":"Fixed precisioncomplex balls","title":"Complex ball functionality","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The complex balls in Nemo provide all the field functionality defined by AbstractAlgebra:.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Below, we document the additional functionality provided for complex balls.","category":"page"},{"location":"acb/#Complex-field-constructors","page":"Fixed precisioncomplex balls","title":"Complex field constructors","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"In order to construct complex boxes in Nemo, one must first construct the Arb complex field itself. This is accomplished with the following constructor.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"AcbField(prec::Int)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Return the Arb complex field with precision in bits prec used for operations on interval midpoints. The precision used for interval radii is a fixed implementation-defined constant (30 bits).","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Here is an example of creating an Arb complex field and using the resulting parent object to coerce values into the resulting field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> a = CC(\"0.25\")\n0.25000000000000000000\n\njulia> b = CC(\"0.1\")\n[0.100000000000000000 +/- 1.22e-20]\n\njulia> c = CC(0.5)\n0.50000000000000000000\n\njulia> d = CC(12)\n12.000000000000000000","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.","category":"page"},{"location":"acb/#Constructors","page":"Fixed precisioncomplex balls","title":"Constructors","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"onei(::AcbField)","category":"page"},{"location":"acb/#Nemo.onei-Tuple{AcbField}","page":"Fixed precisioncomplex balls","title":"Nemo.onei","text":"onei(r::AcbField)\n\nReturn exact one times i in the given Arb complex field.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> c = onei(CC)\n1.0000000000000000000*im","category":"page"},{"location":"acb/#Basic-functionality","page":"Fixed precisioncomplex balls","title":"Basic functionality","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The following basic functionality is provided by the default Arb complex field implementation in Nemo, to support construction of generic rings over complex fields. Any custom complex field implementation in Nemo should provide analogues of these functions along with the usual arithmetic operations.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"parent_type(::Type{acb})","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Gives the type of the parent object of an Arb complex field element.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"elem_type(R::AcbField)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Given the parent object for an Arb complex field, return the type of elements of the field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"mul!(c::acb, a::acb, b::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Multiply a by b and set the existing Arb complex field element c to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"addeq!(c::acb, a::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"In-place addition adds a to c and sets c to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"deepcopy(a::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Return a copy of the Arb complex field element a, recursively copying the internal data. Arb complex field elements are mutable in Nemo so a shallow copy is not sufficient.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Given the parent object R for an Arb complex field, the following coercion functions are provided to coerce various elements into the Arb complex field. Developers provide these by overloading the call operator for the complex field parent objects.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R()","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce zero into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(n::Integer)\nR(f::ZZRingElem)\nR(q::QQFieldElem)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce an integer or rational value into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(f::Float64)\nR(f::BigFloat)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce the given floating point number into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(f::AbstractString)\nR(f::AbstractString, g::AbstractString)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce the decimal number, given as a string, into the Arb complex field. In each case f is the real part and g is the imaginary part.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(f::arb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Coerce the given Arb real ball into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"R(f::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Take an Arb complex field element that is already in an Arb field and simply return it. A copy of the original is not made.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Here are some examples of coercing elements into the Arb complex field.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> RR = ArbField(64)\nReal Field with 64 bits of precision and error bounds\n\njulia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> a = CC(3)\n3.0000000000000000000\n\njulia> b = CC(QQ(2,3))\n[0.6666666666666666666 +/- 8.48e-20]\n\njulia> c = CC(\"3 +/- 0.0001\")\n[3.000 +/- 1.01e-4]\n\njulia> d = CC(\"-1.24e+12345\")\n[-1.240000000000000000e+12345 +/- 1.16e+12326]\n\njulia> f = CC(\"nan +/- inf\")\nnan\n\njulia> g = CC(RR(3))\n3.0000000000000000000","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::AcbField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::acb) to return the parent object of a complex field element.","category":"page"},{"location":"acb/#Basic-manipulation","page":"Fixed precisioncomplex balls","title":"Basic manipulation","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"isfinite(::acb)","category":"page"},{"location":"acb/#Base.isfinite-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Base.isfinite","text":"isfinite(x::acb)\n\nReturn true if x is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"is_exact(::acb)","category":"page"},{"location":"acb/#Nemo.is_exact-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.is_exact","text":"is_exact(x::acb)\n\nReturn true if x is exact, i.e. has its real and imaginary parts have zero radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"isinteger(::acb)","category":"page"},{"location":"acb/#Base.isinteger-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Base.isinteger","text":"isinteger(x::acb)\n\nReturn true if x is an exact integer, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"accuracy_bits(::acb)","category":"page"},{"location":"acb/#Nemo.accuracy_bits-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.accuracy_bits","text":"accuracy_bits(x::acb)\n\nReturn the relative accuracy of x measured in bits, capped between typemax(Int) and -typemax(Int).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> a = CC(\"1.2 +/- 0.001\")\n[1.20 +/- 1.01e-3]\n\njulia> b = CC(3)\n3.0000000000000000000\n\njulia> isreal(a)\ntrue\n\njulia> isfinite(b)\ntrue\n\njulia> isinteger(b)\ntrue\n\njulia> c = real(a)\n[1.20 +/- 1.01e-3]\n\njulia> d = imag(b)\n0\n\njulia> f = accuracy_bits(a)\n9\n","category":"page"},{"location":"acb/#Containment","page":"Fixed precisioncomplex balls","title":"Containment","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"overlaps(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.overlaps-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.overlaps","text":"overlaps(x::acb, y::acb)\n\nReturns true if any part of the box x overlaps any part of the box y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"contains(::acb, ::acb)","category":"page"},{"location":"acb/#Base.contains-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Base.contains","text":"contains(x::acb, y::acb)\n\nReturns true if the box x contains the box y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"contains(::acb, ::Integer)\ncontains(::acb, ::ZZRingElem)\ncontains(::acb, ::QQFieldElem)","category":"page"},{"location":"acb/#Base.contains-Tuple{acb, Integer}","page":"Fixed precisioncomplex balls","title":"Base.contains","text":"contains(x::acb, y::Integer)\n\nReturns true if the box x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/#Base.contains-Tuple{acb, ZZRingElem}","page":"Fixed precisioncomplex balls","title":"Base.contains","text":"contains(x::acb, y::ZZRingElem)\n\nReturns true if the box x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/#Base.contains-Tuple{acb, QQFieldElem}","page":"Fixed precisioncomplex balls","title":"Base.contains","text":"contains(x::acb, y::QQFieldElem)\n\nReturns true if the box x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"The following functions are also provided for determining if a box intersects a certain part of the complex number plane.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"contains_zero(::acb)","category":"page"},{"location":"acb/#Nemo.contains_zero-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.contains_zero","text":"contains_zero(x::acb)\n\nReturns true if the box x contains zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"1 +/- 0.001\")\n[1.00 +/- 1.01e-3]\n\njulia> y = CC(\"3\")\n3.0000000000000000000\n\njulia> overlaps(x, y)\nfalse\n\njulia> contains(x, y)\nfalse\n\njulia> contains(y, 3)\ntrue\n\njulia> contains(x, ZZ(1)//2)\nfalse\n\njulia> contains_zero(x)\nfalse","category":"page"},{"location":"acb/#Comparison","page":"Fixed precisioncomplex balls","title":"Comparison","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Nemo provides a full range of comparison operations for Arb complex boxes. ","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"isequal(::acb, ::acb)","category":"page"},{"location":"acb/#Base.isequal-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Base.isequal","text":"isequal(x::acb, y::acb)\n\nReturn true if the boxes x and y are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Function\n==(x::acb, y::Integer)\n==(x::Integer, y::acb)\n==(x::acb, y::ZZRingElem)\n==(x::ZZRingElem, y::acb)\n==(x::arb, y::ZZRingElem)\n==(x::ZZRingElem, y::arb)\n==(x::acb, y::Float64)\n==(x::Float64, y::acb)","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"1 +/- 0.001\")\n[1.00 +/- 1.01e-3]\n\njulia> y = CC(\"3\")\n3.0000000000000000000\n\njulia> z = CC(\"4\")\n4.0000000000000000000\n\njulia> isequal(x, deepcopy(x))\ntrue\n\njulia> x == 3\nfalse\n\njulia> ZZ(3) == z\nfalse\n\njulia> x != 1.23\ntrue","category":"page"},{"location":"acb/#Absolute-value","page":"Fixed precisioncomplex balls","title":"Absolute value","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"-1 +/- 0.001\")\n[-1.00 +/- 1.01e-3]\n\njulia> a = abs(x)\n[1.00 +/- 1.01e-3]","category":"page"},{"location":"acb/#Shifting","page":"Fixed precisioncomplex balls","title":"Shifting","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"-3 +/- 0.001\")\n[-3.00 +/- 1.01e-3]\n\njulia> a = ldexp(x, 23)\n[-2.52e+7 +/- 4.26e+4]\n\njulia> b = ldexp(x, -ZZ(15))\n[-9.16e-5 +/- 7.78e-8]","category":"page"},{"location":"acb/#Miscellaneous-operations","page":"Fixed precisioncomplex balls","title":"Miscellaneous operations","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"trim(::acb)","category":"page"},{"location":"acb/#Nemo.trim-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.trim","text":"trim(x::acb)\n\nReturn an acb box containing x but which may be more economical, by rounding off insignificant bits from midpoints.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"unique_integer(::acb)","category":"page"},{"location":"acb/#Nemo.unique_integer-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.unique_integer","text":"unique_integer(x::acb)\n\nReturn a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box x contains a unique integer. If this is the case, the second return value is set to this unique integer.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> x = CC(\"-3 +/- 0.001\", \"0.1\")\n[-3.00 +/- 1.01e-3] + [0.100000000000000000 +/- 1.22e-20]*im\n\njulia> a = trim(x)\n[-3.00 +/- 1.01e-3] + [0.100000000000000000 +/- 1.22e-20]*im\n\njulia> b, c = unique_integer(x)\n(false, 0)\n\njulia> d = conj(x)\n[-3.00 +/- 1.01e-3] + [-0.100000000000000000 +/- 1.22e-20]*im\n\njulia> f = angle(x)\n[3.1083 +/- 3.95e-5]","category":"page"},{"location":"acb/#Constants","page":"Fixed precisioncomplex balls","title":"Constants","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"const_pi(::AcbField)","category":"page"},{"location":"acb/#Nemo.const_pi-Tuple{AcbField}","page":"Fixed precisioncomplex balls","title":"Nemo.const_pi","text":"const_pi(r::AcbField)\n\nReturn pi = 314159ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(200)\nComplex Field with 200 bits of precision and error bounds\n\njulia> a = const_pi(CC)\n[3.14159265358979323846264338327950288419716939937510582097494 +/- 5.73e-60]","category":"page"},{"location":"acb/#Mathematical-and-special-functions","page":"Fixed precisioncomplex balls","title":"Mathematical and special functions","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"rsqrt(::acb)","category":"page"},{"location":"acb/#Nemo.rsqrt-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.rsqrt","text":"rsqrt(x::acb)\n\nReturn the reciprocal of the square root of x, i.e. 1sqrtx.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"cispi(::acb)","category":"page"},{"location":"acb/#Base.cispi-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Base.cispi","text":"cispi(x::acb)\n\nReturn the exponential of pi i x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"root_of_unity(::AcbField, k::Int)","category":"page"},{"location":"acb/#Nemo.root_of_unity-Tuple{AcbField, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.root_of_unity","text":"root_of_unity(C::AcbField, k::Int)\n\nReturn exp(2pi ik).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"log_sinpi(::acb)","category":"page"},{"location":"acb/#Nemo.log_sinpi-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.log_sinpi","text":"log_sinpi(x::acb)\n\nReturn logsin(pi x), constructed without branch cuts off the real line.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma(::acb)","category":"page"},{"location":"acb/#Nemo.gamma-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma","text":"gamma(x::acb)\n\nReturn the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"lgamma(::acb)","category":"page"},{"location":"acb/#Nemo.lgamma-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.lgamma","text":"lgamma(x::acb)\n\nReturn the logarithm of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"rgamma(::acb)","category":"page"},{"location":"acb/#Nemo.rgamma-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.rgamma","text":"rgamma(x::acb)\n\nReturn the reciprocal of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"digamma(::acb)","category":"page"},{"location":"acb/#Nemo.digamma-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.digamma","text":"digamma(x::acb)\n\nReturn the logarithmic derivative of the gamma function evaluated at x, i.e. psi(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"zeta(::acb)","category":"page"},{"location":"acb/#Nemo.zeta-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.zeta","text":"zeta(x::acb)\n\nReturn the Riemann zeta function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"barnes_g(::acb)","category":"page"},{"location":"acb/#Nemo.barnes_g-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.barnes_g","text":"barnes_g(x::acb)\n\nReturn the Barnes G-function, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"log_barnes_g(::acb)","category":"page"},{"location":"acb/#Nemo.log_barnes_g-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.log_barnes_g","text":"log_barnes_g(x::acb)\n\nReturn the logarithm of the Barnes G-function, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"erf(::acb)","category":"page"},{"location":"acb/#Nemo.erf-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.erf","text":"erf(x::acb)\n\nReturn the error function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"erfi(::acb)","category":"page"},{"location":"acb/#Nemo.erfi-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.erfi","text":"erfi(x::acb)\n\nReturn the imaginary error function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"exp_integral_ei(::acb)","category":"page"},{"location":"acb/#Nemo.exp_integral_ei-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.exp_integral_ei","text":"exp_integral_ei(x::acb)\n\nReturn the exponential integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"sin_integral(::acb)","category":"page"},{"location":"acb/#Nemo.sin_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.sin_integral","text":"sin_integral(x::acb)\n\nReturn the sine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"cos_integral(::acb)","category":"page"},{"location":"acb/#Nemo.cos_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.cos_integral","text":"cos_integral(x::acb)\n\nReturn the exponential cosine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"sinh_integral(::acb)","category":"page"},{"location":"acb/#Nemo.sinh_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.sinh_integral","text":"sinh_integral(x::acb)\n\nReturn the hyperbolic sine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"cosh_integral(::acb)","category":"page"},{"location":"acb/#Nemo.cosh_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.cosh_integral","text":"cosh_integral(x::acb)\n\nReturn the hyperbolic cosine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"dedekind_eta(::acb)","category":"page"},{"location":"acb/#Nemo.dedekind_eta-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.dedekind_eta","text":"dedekind_eta(x::acb)\n\nReturn the Dedekind eta function eta(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_weber_f(::acb)","category":"page"},{"location":"acb/#Nemo.modular_weber_f-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_weber_f","text":"modular_weber_f(x::acb)\n\nReturn the modular Weber function mathfrakf(tau) = fraceta^2(tau)eta(tau2)eta(2tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_weber_f1(::acb)","category":"page"},{"location":"acb/#Nemo.modular_weber_f1-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_weber_f1","text":"modular_weber_f1(x::acb)\n\nReturn the modular Weber function mathfrakf_1(tau) = fraceta(tau2)eta(tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_weber_f2(::acb)","category":"page"},{"location":"acb/#Nemo.modular_weber_f2-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_weber_f2","text":"modular_weber_f2(x::acb)\n\nReturn the modular Weber function mathfrakf_2(tau) = fracsqrt2eta(2tau)eta(tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"j_invariant(::acb)","category":"page"},{"location":"acb/#Nemo.j_invariant-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.j_invariant","text":"j_invariant(x::acb)\n\nReturn the j-invariant j(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_lambda(::acb)","category":"page"},{"location":"acb/#Nemo.modular_lambda-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_lambda","text":"modular_lambda(x::acb)\n\nReturn the modular lambda function lambda(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"modular_delta(::acb)","category":"page"},{"location":"acb/#Nemo.modular_delta-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.modular_delta","text":"modular_delta(x::acb)\n\nReturn the modular delta function Delta(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"eisenstein_g(::Int, ::acb)","category":"page"},{"location":"acb/#Nemo.eisenstein_g-Tuple{Int64, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.eisenstein_g","text":"eisenstein_g(k::Int, x::acb)\n\nReturn the non-normalized Eisenstein series G_k(tau) of mathrmSL_2(mathbbZ). Also defined for tau = i infty.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"elliptic_k(::acb)","category":"page"},{"location":"acb/#Nemo.elliptic_k-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.elliptic_k","text":"elliptic_k(x::acb)\n\nReturn the complete elliptic integral K(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"elliptic_e(::acb)","category":"page"},{"location":"acb/#Nemo.elliptic_e-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.elliptic_e","text":"elliptic_e(x::acb)\n\nReturn the complete elliptic integral E(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"agm(::acb)\nagm(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.agm-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.agm","text":"agm(x::acb)\n\nReturn the arithmetic-geometric mean of 1 and x.\n\n\n\n\n\n","category":"method"},{"location":"acb/#Nemo.agm-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.agm","text":"agm(x::acb, y::acb)\n\nReturn the arithmetic-geometric mean of x and y.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"polygamma(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.polygamma-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.polygamma","text":"polygamma(s::acb, a::acb)\n\nReturn the generalised polygamma function psi(sz).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"zeta(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.zeta-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.zeta","text":"zeta(s::acb, a::acb)\n\nReturn the Hurwitz zeta function zeta(sa).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"rising_factorial(::acb, ::Int)","category":"page"},{"location":"acb/#Nemo.rising_factorial-Tuple{acb, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::acb, n::Int)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an Acb.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"rising_factorial2(::acb, ::Int)","category":"page"},{"location":"acb/#Nemo.rising_factorial2-Tuple{acb, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.rising_factorial2","text":"rising_factorial2(x::acb, n::Int)\n\nReturn a tuple containing the rising factorial x(x + 1)ldots (x + n - 1) and its derivative.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"polylog(::Union{acb,Int}, ::acb)","category":"page"},{"location":"acb/#Nemo.polylog-Tuple{Union{Int64, acb}, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.polylog","text":"polylog(s::Union{acb,Int}, a::acb)\n\nReturn the polylogarithm Li_s(a).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"log_integral(::acb)","category":"page"},{"location":"acb/#Nemo.log_integral-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.log_integral","text":"log_integral(x::acb)\n\nReturn the logarithmic integral, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"log_integral_offset(::acb)","category":"page"},{"location":"acb/#Nemo.log_integral_offset-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.log_integral_offset","text":"log_integral_offset(x::acb)\n\nReturn the offset logarithmic integral, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"exp_integral_e(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.exp_integral_e-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.exp_integral_e","text":"exp_integral_e(s::acb, x::acb)\n\nReturn the generalised exponential integral E_s(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.gamma-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma","text":"gamma(s::acb, x::acb)\n\nReturn the upper incomplete gamma function Gamma(sx).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma_regularized(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.gamma_regularized-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma_regularized","text":"gamma_regularized(s::acb, x::acb)\n\nReturn the regularized upper incomplete gamma function Gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma_lower(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.gamma_lower-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma_lower","text":"gamma_lower(s::acb, x::acb)\n\nReturn the lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"gamma_lower_regularized(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.gamma_lower_regularized-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.gamma_lower_regularized","text":"gamma_lower_regularized(s::acb, x::acb)\n\nReturn the regularized lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"airy_ai(::acb)","category":"page"},{"location":"acb/#Nemo.airy_ai-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.airy_ai","text":"airy_ai(x::acb)\n\nReturn the Airy function operatornameAi(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"airy_ai_prime(::acb)","category":"page"},{"location":"acb/#Nemo.airy_ai_prime-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.airy_ai_prime","text":"airy_ai_prime(x::acb)\n\nReturn the derivative of the Airy function operatornameAi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"airy_bi(::acb)","category":"page"},{"location":"acb/#Nemo.airy_bi-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.airy_bi","text":"airy_bi(x::acb)\n\nReturn the Airy function operatornameBi(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"airy_bi_prime(::acb)","category":"page"},{"location":"acb/#Nemo.airy_bi_prime-Tuple{acb}","page":"Fixed precisioncomplex balls","title":"Nemo.airy_bi_prime","text":"airy_bi_prime(x::acb)\n\nReturn the derivative of the Airy function operatornameBi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"bessel_j(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.bessel_j-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.bessel_j","text":"bessel_j(nu::acb, x::acb)\n\nReturn the Bessel function J_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"bessel_y(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.bessel_y-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.bessel_y","text":"bessel_y(nu::acb, x::acb)\n\nReturn the Bessel function Y_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"bessel_i(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.bessel_i-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.bessel_i","text":"bessel_i(nu::acb, x::acb)\n\nReturn the Bessel function I_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"bessel_k(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.bessel_k-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.bessel_k","text":"bessel_k(nu::acb, x::acb)\n\nReturn the Bessel function K_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"hypergeometric_1f1(::acb, ::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.hypergeometric_1f1-Tuple{acb, acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.hypergeometric_1f1","text":"hypergeometric_1f1(a::acb, b::acb, x::acb)\n\nReturn the confluent hypergeometric function _1F_1(abx).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"hypergeometric_1f1_regularized(::acb, ::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.hypergeometric_1f1_regularized-Tuple{acb, acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.hypergeometric_1f1_regularized","text":"hypergeometric_1f1_regularized(a::acb, b::acb, x::acb)\n\nReturn the regularized confluent hypergeometric function _1F_1(abx) Gamma(b).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"hypergeometric_u(::acb, ::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.hypergeometric_u-Tuple{acb, acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.hypergeometric_u","text":"hypergeometric_u(a::acb, b::acb, x::acb)\n\nReturn the confluent hypergeometric function U(abx).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"hypergeometric_2f1(::acb, ::acb, ::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.hypergeometric_2f1-NTuple{4, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.hypergeometric_2f1","text":"hypergeometric_2f1(a::acb, b::acb, c::acb, x::acb; flags=0)\n\nReturn the Gauss hypergeometric function _2F_1(abcx).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"jacobi_theta(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.jacobi_theta-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.jacobi_theta","text":"jacobi_theta(z::acb, tau::acb)\n\nReturn a tuple of four elements containing the Jacobi theta function values theta_1 theta_2 theta_3 theta_4 evaluated at z tau.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"weierstrass_p(::acb, ::acb)","category":"page"},{"location":"acb/#Nemo.weierstrass_p-Tuple{acb, acb}","page":"Fixed precisioncomplex balls","title":"Nemo.weierstrass_p","text":"weierstrass_p(z::acb, tau::acb)\n\nReturn the Weierstrass elliptic function wp(ztau).\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"julia> CC = AcbField(64)\nComplex Field with 64 bits of precision and error bounds\n\njulia> s = CC(1, 2)\n1.0000000000000000000 + 2.0000000000000000000*im\n\njulia> z = CC(\"1.23\", \"3.45\")\n[1.230000000000000000 +/- 2.00e-19] + [3.450000000000000000 +/- 3.91e-19]*im\n\njulia> a = sin(z)^2 + cos(z)^2\n[1.000000000000000 +/- 4.92e-16] + [+/- 4.12e-16]*im\n\njulia> b = zeta(z)\n[0.685803329024164062 +/- 6.30e-19] + [-0.038574782404586856 +/- 7.54e-19]*im\n\njulia> c = bessel_j(s, z)\n[0.63189634741402481 +/- 4.85e-18] + [0.00970090757446076 +/- 4.66e-18]*im\n\njulia> d = hypergeometric_1f1(s, s+1, z)\n[-1.3355297330012291 +/- 5.83e-17] + [-0.1715020340928697 +/- 4.97e-17]*im","category":"page"},{"location":"acb/#Linear-dependence","page":"Fixed precisioncomplex balls","title":"Linear dependence","text":"","category":"section"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"lindep(::Vector{acb}, n::Int)","category":"page"},{"location":"acb/#Nemo.lindep-Tuple{Vector{acb}, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.lindep","text":"lindep(A::Vector{acb}, bits::Int)\n\nFind a small linear combination of the entries of the array A that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"lindep(A::Matrix{acb}, bits::Int)","category":"page"},{"location":"acb/#Nemo.lindep-Tuple{Matrix{acb}, Int64}","page":"Fixed precisioncomplex balls","title":"Nemo.lindep","text":"lindep(A::Matrix{acb}, bits::Int)\n\nFind a (common) small linear combination of the entries in each row of the array A, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.\n\n\n\n\n\n","category":"method"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"Examples","category":"page"},{"location":"acb/","page":"Fixed precisioncomplex balls","title":"Fixed precisioncomplex balls","text":"CC = AcbField(128)\n\n# These are two of the roots of x^5 + 3x + 1\na = CC(1.0050669478588622428791051888364775253, - 0.93725915669289182697903585868761513585)\nb = CC(-0.33198902958450931620250069492231652319)\n\n# We recover the polynomial from one root....\nV1 = [CC(1), a, a^2, a^3, a^4, a^5];\nW = lindep(V1, 20)\n\n# ...or from two\nV2 = [CC(1), b, b^2, b^3, b^4, b^5];\nVs = [V1 V2]\nX = lindep(Vs, 20)","category":"page"},{"location":"misc/#Miscellaneous","page":"Miscellaneous","title":"Miscellaneous","text":"","category":"section"},{"location":"misc/#Global-variables-and-precompilation","page":"Miscellaneous","title":"Global variables and precompilation","text":"","category":"section"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"Due to limitations of the precompilation of modules in julia, global variables referring to certain Nemo types require special attention when used inside modules. As a simple example, the following code for a module called A will not work as expected:","category":"page"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"module A\n\nusing Nemo\nQx, x = QQ[\"x\"]\nf(n) = x^n\nend","category":"page"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"When running julia and loading the module via using/import A, calling f will lead to segmentation faults. The preferred workaround is to put the definitions of the global variables into the __init__() function of the module as follows:","category":"page"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"module A\n\nusing Nemo\n\nfunction __init__()\n global (Qx, x) = QQ[\"x\"]\nend\n\nf(n) = x^n\nend","category":"page"},{"location":"misc/","page":"Miscellaneous","title":"Miscellaneous","text":"Alternatively, one can disable precompilation by adding __precompile__(false) inside A. Note that this might have other unwanted side effects.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"qadic/#Qadics","page":"Qadics","title":"Qadics","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Q-adic fields, that is, unramified extensions of p-adic fields, are provided in Nemo by Flint. This allows construction of q-adic fields for any prime power q.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Q-adic fields are constructed using the FlintQadicField function. However, for convenience we define","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"QadicField = FlintQadicField","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"so that q-adic fields can be constructed using QadicField rather than FlintQadicField. Note that this is the name of the constructor, but not of qadic field type.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"The types of q-adic fields in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Library Field Element type Parent type\nFlint mathbbQ_q qadic QadicField","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"All the q-adic field types belong to the Field abstract type and the q-adic field element types belong to the FieldElem abstract type.","category":"page"},{"location":"qadic/#P-adic-functionality","page":"Qadics","title":"P-adic functionality","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Q-adic fields in Nemo provide all the functionality described in AbstractAlgebra for fields:.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Below, we document all the additional function that is provide by Nemo for q-adic fields.","category":"page"},{"location":"qadic/#Constructors","page":"Qadics","title":"Constructors","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"In order to construct q-adic field elements in Nemo, one must first construct the q-adic field itself. This is accomplished with one of the following constructors.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"FlintQadicField(::Integer, ::Int, ::Int)","category":"page"},{"location":"qadic/#Nemo.FlintQadicField-Tuple{Integer, Int64, Int64}","page":"Qadics","title":"Nemo.FlintQadicField","text":"FlintQadicField(p::Integer, d::Int, prec::Int, var::String = \"a\")\n\nReturns the parent object for the q-adic field for given prime p and degree d, where the default absolute precision of elements of the field is given by prec and the generator is printed as var.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"It is also possible to call the inner constructor directly. It has the following form.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"FlintQadicField(p::ZZRingElem, d::Int, prec::Int)","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Returns the parent object for the q-adic field for given prime p and degree d, where the default absolute precision of elements of the field is given by prec. It also return the uniformizer p with the default precision.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Here are some examples of creating q-adic fields and making use of the resulting parent objects to coerce various elements into those fields.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"julia> R, p = QadicField(7, 1, 30);\n\njulia> S, _ = QadicField(ZZ(65537), 1, 30);\n\njulia> a = R()\n0\n\njulia> b = S(1)\n65537^0 + O(65537^30)\n\njulia> c = S(ZZ(123))\n123*65537^0 + O(65537^30)\n\njulia> d = R(ZZ(1)//7^2)\n7^-2 + O(7^28)","category":"page"},{"location":"qadic/#Big-oh-notation","page":"Qadics","title":"Big-oh notation","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Elements of p-adic fields can be constructed using the big-oh notation. For this purpose we define the following functions.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"O(::FlintQadicField, ::Integer)\nO(::FlintQadicField, ::ZZRingElem)\nO(::FlintQadicField, ::QQFieldElem)","category":"page"},{"location":"qadic/#AbstractAlgebra.O-Tuple{FlintQadicField, Integer}","page":"Qadics","title":"AbstractAlgebra.O","text":"O(R::FlintQadicField, m::Integer)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"qadic/#AbstractAlgebra.O-Tuple{FlintQadicField, ZZRingElem}","page":"Qadics","title":"AbstractAlgebra.O","text":"O(R::FlintQadicField, m::ZZRingElem)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"qadic/#AbstractAlgebra.O-Tuple{FlintQadicField, QQFieldElem}","page":"Qadics","title":"AbstractAlgebra.O","text":"O(R::FlintQadicField, m::QQFieldElem)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"The O(p^n) construction can be used to construct q-adic values of precision n by adding it to integer values representing the q-adic value modulo p^n as in the examples.","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"julia> R, _ = QadicField(7, 1, 30);\n\njulia> S, _ = QadicField(ZZ(65537), 1, 30);\n\njulia> c = 1 + 2*7 + 4*7^2 + O(R, 7^3)\n7^0 + 2*7^1 + 4*7^2 + O(7^3)\n\njulia> d = 13 + 357*ZZ(65537) + O(S, ZZ(65537)^12)\n13*65537^0 + 357*65537^1 + O(65537^12)\n\njulia> f = ZZ(1)//7^2 + ZZ(2)//7 + 3 + 4*7 + O(R, 7^2)\n7^-2 + 2*7^-1 + 3*7^0 + 4*7^1 + O(7^2)","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Beware that the expression 1 + 2*p + 3*p^2 + O(R, p^n) is actually computed as a normal Julia expression. Therefore if {Int} values are used instead of Flint integers or Julia bignums, overflow may result in evaluating the value.","category":"page"},{"location":"qadic/#Basic-manipulation","page":"Qadics","title":"Basic manipulation","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"prime(::FlintQadicField)","category":"page"},{"location":"qadic/#AbstractAlgebra.Generic.prime-Tuple{FlintQadicField}","page":"Qadics","title":"AbstractAlgebra.Generic.prime","text":"prime(R::FlintQadicField)\n\nReturn the prime p for the given q-adic field.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"precision(::qadic)","category":"page"},{"location":"qadic/#Base.precision-Tuple{qadic}","page":"Qadics","title":"Base.precision","text":"precision(a::qadic)\n\nReturn the precision of the given q-adic field element, i.e. if the element is known to O(p^n) this function will return n.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"valuation(::qadic)","category":"page"},{"location":"qadic/#AbstractAlgebra.valuation-Tuple{qadic}","page":"Qadics","title":"AbstractAlgebra.valuation","text":"valuation(a::qadic)\n\nReturn the valuation of the given q-adic field element, i.e. if the given element is divisible by p^n but not a higher power of q then the function will return n.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"lift(::QQPolyRing, ::qadic)\nlift(::ZZPolyRing, ::qadic)","category":"page"},{"location":"qadic/#AbstractAlgebra.lift-Tuple{QQPolyRing, qadic}","page":"Qadics","title":"AbstractAlgebra.lift","text":"lift(R::QQPolyRing, a::qadic)\n\nReturn a lift of the given q-adic field element to mathbbQx.\n\n\n\n\n\n","category":"method"},{"location":"qadic/#AbstractAlgebra.lift-Tuple{ZZPolyRing, qadic}","page":"Qadics","title":"AbstractAlgebra.lift","text":"lift(R::ZZPolyRing, a::qadic)\n\nReturn a lift of the given q-adic field element to mathbbZx if possible.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"R, _ = QadicField(7, 1, 30);\n\na = 1 + 2*7 + 4*7^2 + O(R, 7^3)\nb = 7^2 + 3*7^3 + O(R, 7^5)\nc = R(2)\n\nk = precision(a)\nm = prime(R)\nn = valuation(b)\nQx, x = FlintQQ[\"x\"]\np = lift(Qx, a)\nZy, y = FlintZZ[\"y\"]\nq = lift(Zy, divexact(a, b))","category":"page"},{"location":"qadic/#Square-root","page":"Qadics","title":"Square root","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Base.sqrt(::qadic)","category":"page"},{"location":"qadic/#Base.sqrt-Tuple{qadic}","page":"Qadics","title":"Base.sqrt","text":"Base.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of f. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.\n\n\n\n\n\nBase.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem\n\nReturn the square root of a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nsqrt(a::FieldElem)\n\nReturn the square root of the element a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nsqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of the given Puiseux series a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"julia> R, _ = QadicField(7, 1, 30);\n\njulia> a = 1 + 7 + 2*7^2 + O(R, 7^3)\n7^0 + 7^1 + 2*7^2 + O(7^3)\n\njulia> b = 2 + 3*7 + O(R, 7^5)\n2*7^0 + 3*7^1 + O(7^5)\n\njulia> c = 7^2 + 2*7^3 + O(R, 7^4)\n7^2 + 2*7^3 + O(7^4)\n\njulia> d = sqrt(a)\n7^0 + 4*7^1 + 3*7^2 + O(7^3)\n\njulia> f = sqrt(b)\n4*7^0 + 7^1 + 5*7^2 + 5*7^3 + 6*7^4 + O(7^5)\n\njulia> f = sqrt(c)\n7^1 + 7^2 + O(7^3)\n\njulia> g = sqrt(R(121))\n4*7^0 + 7^1 + O(7^30)","category":"page"},{"location":"qadic/#Special-functions","page":"Qadics","title":"Special functions","text":"","category":"section"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Base.exp(::qadic)","category":"page"},{"location":"qadic/#Base.exp-Tuple{qadic}","page":"Qadics","title":"Base.exp","text":"exp(a::AbsPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::RelPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::Generic.LaurentSeriesElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the exponential of the given Puiseux series a.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"log(::qadic)","category":"page"},{"location":"qadic/#Base.log-Tuple{qadic}","page":"Qadics","title":"Base.log","text":"log(a::SeriesElem{T}) where T <: FieldElement\n\nReturn the logarithm of the power series a.\n\n\n\n\n\nlog(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the logarithm of the given Puiseux series a.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"teichmuller(::qadic)","category":"page"},{"location":"qadic/#Nemo.teichmuller-Tuple{qadic}","page":"Qadics","title":"Nemo.teichmuller","text":"teichmuller(a::qadic)\n\nReturn the Teichmuller lift of the q-adic value a. We require the valuation of a to be nonnegative. The precision of the output will be the same as the precision of the input. For convenience, if a is congruent to zero modulo q we return zero. If the input is not valid an exception is thrown.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"frobenius(::qadic, ::Int)","category":"page"},{"location":"qadic/#Nemo.frobenius-Tuple{qadic, Int64}","page":"Qadics","title":"Nemo.frobenius","text":"frobenius(a::qadic, e::Int = 1)\n\nReturn the image of the e-th power of Frobenius on the q-adic value a. The precision of the output will be the same as the precision of the input.\n\n\n\n\n\n","category":"method"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"Examples","category":"page"},{"location":"qadic/","page":"Qadics","title":"Qadics","text":"julia> R, _ = QadicField(7, 1, 30);\n\njulia> a = 1 + 7 + 2*7^2 + O(R, 7^3)\n7^0 + 7^1 + 2*7^2 + O(7^3)\n\njulia> b = 2 + 5*7 + 3*7^2 + O(R, 7^3)\n2*7^0 + 5*7^1 + 3*7^2 + O(7^3)\n\njulia> c = 3*7 + 2*7^2 + O(R, 7^5)\n3*7^1 + 2*7^2 + O(7^5)\n\njulia> c = exp(c)\n7^0 + 3*7^1 + 3*7^2 + 4*7^3 + 4*7^4 + O(7^5)\n\njulia> d = log(a)\n7^1 + 5*7^2 + O(7^3)\n\njulia> c = exp(R(0))\n7^0 + O(7^30)\n\njulia> d = log(R(1))\n0\n\njulia> f = teichmuller(b)\n2*7^0 + 4*7^1 + 6*7^2 + O(7^3)\n\njulia> g = frobenius(a, 2)\n7^0 + 7^1 + 2*7^2 + O(7^3)","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"developer/parents/#Parent-objects","page":"Parent objects","title":"Parent objects","text":"","category":"section"},{"location":"developer/parents/#The-use-of-parent-objects-in-Nemo","page":"Parent objects","title":"The use of parent objects in Nemo","text":"","category":"section"},{"location":"developer/parents/#The-parent/element-model","page":"Parent objects","title":"The parent/element model","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"As for other major computer algebra projects such as Sage and Magma, Nemo uses the parent/element model to manage its mathematical objects.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"As explained in the appendix to the AbstractAlgebra documentation, the standard type/object model used in most programming languages is insufficient for much of mathematics which often requires mathematical structures parameterised by other objects.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For example a quotient ring by an ideal would be parameterised by the ideal. The ideal is an object in the system and not a type and so parameterised types are not sufficient to represent such quotient rings.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"This means that each mathematical \"domain\" in the system (set, group, ring, field, module, etc.) must be represented by an object in the system, rather than a type. Such objects are called parent objects.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Just as one would write typeof(a) to get the type of an object a in an object/type system of a standard programming language, we write parent(a) to return the parent of the object a.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"When talked about with reference to a parent in this way, the object a is referred to as an element of the parent. Thus the system is divided into elements and parents. For example a polynomial would be an element of a polynomial ring, the latter being the parent of the former.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Naturally the parent/element system leads to some issues in a programming language not built around this model. We discuss some of these issues below.","category":"page"},{"location":"developer/parents/#Types-in-the-parent/element-model","page":"Parent objects","title":"Types in the parent/element model","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"As all elements and parents in Nemo are objects, those objects have types which we refer to as the element type and parent type respectively.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For example, Flint integers have type ZZRingElem and the parent object they all belong to, FlintZZ has type ZZRing.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"More complex parents and elements are parameterised. For example, generic univariate polynomials over a base ring R are parameterised by R. The base ring of a ring S can be obtained by the call base_ring(S).","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"We have found it extremely useful to parameterise the type of both the parent and element objects of such a ring by the type of the elements of the base ring. Thus for example, a generic polynomial with Flint integer coefficients would have type Poly{ZZRingElem}.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"In practice Flint already implements univariate polynomials over Flint integers, and these have type ZZPolyRingElem. But both ZZPolyRingElem and the generic polynomials Poly{ZZRingElem} belong to the abstract type PolyRingElem{ZZRingElem} making it possible to write functions for all univariate polynomials over Flint integers.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Given a specific element type or parent type it is possible to compute one from the other with the functions elem_type and parent_type. For example parent_type(ZZPolyRingElem) returns ZZPolyRing and elem_type(ZZPolyRing) returns ZZPolyRingElem. Similarly parent_type(Generic.Poly{ZZRingElem}) returns Generic.PolyRing{ZZRingElem} and so on.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"These functions are especially useful when writing type assertions or constructing arrays of elements insides function where only the parent object was passed.","category":"page"},{"location":"developer/parents/#Other-functions-for-computing-types","page":"Parent objects","title":"Other functions for computing types","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Sometimes one needs to know the type of a polynomial or matrix one would obtain if it were constructed over a given ring or with coefficients/entries of a given element type.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"This is especially important in generic code where it may not even be known which Julia package is being used. The user may be expecting an AbstractAlgebra object, a Nemo object or even some other kind of object to be constructed, depending on which package they are using.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"The function for returning the correct type for a dense matrix is dense_matrix_type to which one can pass either a base ring or an element type. For example, if AbstractAlgebra is being used, dense_matrix_type(ZZ) will return Mat{BigInt} whereas if Nemo is being used it will return ZZMatrix.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"We also have dense_poly_type for univariate polynomials, abs_series_type for absolute series and rel_series_type for relative series.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"In theory such functions should exist for all major object types, however they have in most cases not been implemented yet.","category":"page"},{"location":"developer/parents/#Functions-for-creating-objects-of-a-similar-type","page":"Parent objects","title":"Functions for creating objects of a similar type","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"A slightly more consistent interface for creating objects of a type that is suitable for the package currently in use is the similar interface.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For example, given a matrix M one can create one with the same dimensions but over a different ring R by calling similar(M, R). Likewise one can create one over the same ring with different dimensions r x c by calling similar(M, r, c).","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"The similar system is sophisticated enough to know that there is no native type provided by Flint/Antic for matrices and polynomials over a number field. The system knows that in such cases it must create a generic matrix or polynomial over the given number field.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"A great deal of thought went into the design of the similar system so that developers would not be required to implement similar for every pair of types in the package.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Again this interface should exist for all major Nemo domains, but the functionality is still being implemented in some cases.","category":"page"},{"location":"developer/parents/#Changing-base-rings-and-map","page":"Parent objects","title":"Changing base rings and map","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Given a polynomial, matrix or other composite object over a base ring, it is often convenient to create a similar object but with all the entries or coefficients coerced into a different ring.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For this purpose the function change_base_ring is provided.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Similarly it may be useful to create the matrix or polynomial that results by applying a given map/function/lambda to each of the entries or coefficients.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For this purpose Julia's map function is overloaded. There are also functions specific to polynomials and matrices called map_coefficients and map_entries respectively, which essentially do the same thing.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Note that the implementation of such functions must make use of the functions discussed above to ensure that a matrix/polynomial of the right type is output.","category":"page"},{"location":"developer/parents/#Parent-checking","page":"Parent objects","title":"Parent checking","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"When applying binary operations to a pair of elements of a given ring, it is useful to check that they are in fact elements of the same ring. This is not possible by checking the types alone. For example elements of Z7Z and Z3Z would have the same type but different parents (one parameterised by the integer 7, the other by the integer 3).","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"In order to perform such a check in a function one uses check_parent(a, b) where a and b are the objects one wishes to assert must have the same parent. If not, an exception is raised by check_parent.","category":"page"},{"location":"developer/parents/#Parent-object-constructors","page":"Parent objects","title":"Parent object constructors","text":"","category":"section"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Various functions are provided for constructing parent objects. For example a polynomial ring is constructed by calling a polynomial_ring function. Such functions are called parent object constructors.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"In general parent object constructors are intended for the user and should not be used in library code. There are a number of reasons for this.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Firstly, inside the Generic submodule of AbstractAlgebra the only parent object constructors that are directly accessible are the ones inside Generic. Thus if a Nemo function calls a function inside Generic and it creates a parent object using one of the parent object constructors, it will create a parent object for a generic ring rather than a Nemo one.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"One can work around this by calling AbstractAlgebra.polynomial_ring instead of simply polynomial_ring inside Generic, but even safer would be to find another way to construct the polynomials required.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"A second issue is that parent objects are allowed to be as large as one likes and they are cached by the system. They can also perform arbitrary precomputations for the ring/field/module etc. that is being constructed. Over time they tend to accumulate such precomputations, slowing down all generic code which made use of them. Both memory usage and performance may blow out in previously working code.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Thirdly, parent objects must be unique across the system for a given set of parameters. This means they must be cached globally. This is problematic for any future attempts to parallelise library code and in the worst case memory usage can balloon due to swelling caches.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Most parent object constructors take a cached keyword which specifies whether the parent object should be cached or not, but again it is better overall to simply eschew the use of parent object constructors in library code.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Instead, it is recommended to use functions such as similar, zero, zero_matrix, identity_matrix, change_base_ring, map, etc. for constructing polynomials and matrices directly.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"There are also functions that provide alternative ways of constructing objects, e.g. matrix provides a means of creating a matrix over a given ring with given dimensions. The constructor polynomial allows creation of a polynomial over a given base ring with given coefficients and abs_series and rel_series do similar things for absolute and relative series. These should be used in preference to parent object constructors where possible. Additional functions of this type should be added in future.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"However even when using these functions in library code, it is important to remember to pass cached=false so that the cache is not filled up by calls to the library code. But this creates an additional problem, namely that if one uses polynomial say, to construct two polynomials over the same base ring, they will not be compatible in the sense that they will have different parents.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"When one wishes to construct multiple elements in the same group/ring/field, it is convenient to be able to construct a parent just as a user would. For this purpose various light-weight and very safe parent constructors are provided for use in library code.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"For example there are the constructors PolyRing, AbsPowerSeriesRing and RelPowerSeriesRing. These functions return the parent ring R only and no generator (it can be obtained by calling gen(R)). They also set the variable for printing to a default (usually x). Moreover, these parents are not cached, so they are completely safe to use in library code. They can be thousands of times faster than the full parent constructors intended for users.","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Here is an example of their use:","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"julia> R = PolyRing(ZZ)\nUnivariate polynomial ring in x over ZZ\n\njulia> p = R([1, 2, 3])\n3*x^2 + 2*x + 1\n\njulia> q = R([2, 3, 4])\n4*x^2 + 3*x + 2\n\njulia> s = p + q\n7*x^2 + 5*x + 3","category":"page"},{"location":"developer/parents/","page":"Parent objects","title":"Parent objects","text":"Naturally functions like polynomial and matrix and the light-weight parent constructors are missing for other modules in Nemo at present and it is hoped that developers will fill in such infrastructure rather than simply push the can down the road for someone else to fix. Forcing the creating of full parent objects into as few bottlenecks as possible will make it much easier for developers to remove problems associated with such calls when they arise in future.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/topics/#Specific-topics","page":"Specific topics","title":"Specific topics","text":"","category":"section"},{"location":"developer/topics/#Julia-arithmetic","page":"Specific topics","title":"Julia arithmetic","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"At the console, Julia arithmetic is often defined in a way that a numerical person would expect. For example, 3/1 returns a floating point number 3.0, sqrt(4) returns the floating point number 2.0 and exp(0) returns the floating point number 1.0.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In each case the ring is changed from the input to the output of the function. Whilst this is often what one expects to happen in a computer algebra system, these are not the definitions one would want for algebraic operations.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In this section we describe the alternatives we have implemented to allow algebraic computations, particularly for rings and fields.","category":"page"},{"location":"developer/topics/#divexact-and-divides","page":"Specific topics","title":"divexact and divides","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Nemo implements numerous kinds of division:","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"floating point division using the / operator as per Julia\nexact division in a ring using divexact and divides\nquotient field element construction using // as per Julia\nEuclidean division using div, rem, divrem, mod and %","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The expression divexact(a, b) for a and b in a ring R returns a value c in R such that a = bc. If such an element of R does not exist, an exception is raised.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"To instead test whether such an element exists, divides(a, b) returns a tuple (flag, q) where flag is a boolean saying whether such an exact quotient exists in the ring and if so q is such a quotient.","category":"page"},{"location":"developer/topics/#Euclidean-division","page":"Specific topics","title":"Euclidean division","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Nemo must provide Euclidean division, i.e. given a and b in a Euclidean ring R it must be able to find q and r such that a = bq + r with r smaller than a with respect to some fixed Euclidean function on R. There are some restrictions imposed by Julia however.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Firstly, % is a constant alias of rem in Julia, so these are not actually two independent functions but the same function.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Julia defines div, rem and divrem for integers as a triple of functions that return Euclidean quotient and remainder, where the remainder has the same sign as the dividend, e.g. rem(1, 3) == 1 but rem(-2, 3) == -2. In other words, this triple of functions gives Euclidean division, but without a consistent set of representatives.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"When using Nemo at the console (or indeed inside any other package without importing the internal Nemo definitions) div, rem and divrem return the same values as Julia and these functions follows the Julia convention of making the sign of the remainder the same as the dividend over ZZ, e.g. rem(ZZ(1), ZZ(3)) == 1 but rem(ZZ(-2), ZZ(3)) == -2.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Internally to Nemo however, this is not convenient. For example, Hermite normal form over ZZ will only return a unique result if there is a consistent choice of representatives for the Euclidean division. This applies to the generic HNF code in AbstractAlgebra, but similar problems exist for the generic finitely presented module code in AbstractAlgebra, even when used over Nemo integers. Thus the Julia definition of rem will not suffice.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Furthermore, as Nemo wraps Flint, it is convenient that Euclidean division inside Nemo should operate the way Flint operates. This is critical if for example one wants the result of a Hermite normal form coming from Flint to be reduced using the same definition of Euclidean remainder as used elsewhere throughout the Nemo module and to return the same answers as the generic HNF code in AbstractAlgebra for example.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In particular, Flint defines Euclidean remainder over the integers in line with the Julia function mod, namely by returning the smallest remainder with the same sign as the divisor, i.e. mod(1, 3) == 1 but mod(1, -3) == -2.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Therefore internally, Nemo chooses div, mod and divrem to be a consistent triple of functions for Euclidean division, with mod defined as per Julia. Thus in particular, div and divrem behave differently to Julia inside of Nemo itself, viz. Nemo.divrem(-1, 3) == (-1, 2).","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The same definitions for div, mod and divrem are used internally to AbstractAlgebra as well, even for Julia integers, so that AbstractAlgebra and Nemo are both consistent internally. However, both AbstractAlgebra and Nemo export definitions in line with Julia so that behaviour at the console is consistent.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The Nemo developers have given considerable thought to this compromise and the current situation has evolved over many iterations to the current state. We do not consider this to be a situation that needs 'fixing', though we are acutely aware that many tickets will be opened complaining about some inconsistency.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"When reflecting on the choice we have made, one must consider the following:","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Nemo must internally behave as Flint does for consistency\nThere are also functions such as powmod, invmod that reduce as per mod\nHNF requires a consistent set of representatives for uniqueness over ZZ","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Also note that Julia's rem does not provide symmetric mod, a misconception that often arises. The issues here are independent of the decision to use positive remainder (for positive modulus) in Flint, rather than symmetric mod.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"We are aware that the conventions we have chosen have inconsistencies with Julia and do not have the nice property that div, rem and divrem are a triple of Euclidean functions inside Nemo. However, we are sure that the convention we have chosen is one of only two sensible possibilities, and switching to the other convention (apart from being a huge amount of effort) would only succeed in replacing one kind of inconsistency with another.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"As a consequence of these choices, div, mod and divrem are a triple of functions for all Euclidean division across Nemo, not just for the integers. As generic code must use a consistent set of functions, we ask that developers respect this choice by using these three functions in all generic code. The functions rem and % should only be used for Julia integers, and only when one specifically wants the Julia definition.","category":"page"},{"location":"developer/topics/#sqrt,-inv-and-exp","page":"Specific topics","title":"sqrt, inv and exp","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"As mentioned above, Julia does not perform computations within a given ring, but often returns a numerical result when given an exact input.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Whilst this is often what a user expects, it makes operations such as power series square root, inversion or exponentiation more tricky over an exact ring.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Therefore, AbstractAlgebra defines sqrt, inv and exp internally in a strictly algebraic way, returning a result only if it exists in the ring of the input and otherwise raising an exception.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"For example, AbstractAlgebra.sqrt(4) == 2, AbstractAlgebra.inv(-1) == -1 and AbstractAlgebra.exp(0) == 1.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Naturally these definitions are not so terribly useful to a user and are only needed for internal consistency. Therefore, of course these definitions are not exported by AbstractAlgebra so that the behaviour at the console is not affected by these definitions.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"There is currently some inconsistency in that Nemo follows the Julia numerical definitions internally rather than following the algebraic definitions provided internally in AbstractAlgebra. This may or may not change in future.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"It is worth recalling that Julia provides isqrt for integer square root. This is not sufficient to solve our problem as we require square root for all rings, not just integers. We don't feel that developers will want to type isqrt rather than sqrt internally for all rings.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"A number of changes are expected to be made with regard to the behaviour of root taking and division functions, including the ability to specify high performance alternatives that do not check the exactness of the computation. These changes are being discussed on the Nemo ticket https://github.com/Nemocas/Nemo.jl/issues/862 In particular, the table given there by thofma represents the current consensus on the changes that will be made in the future.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that many of the above issues with exact computations in rings exist for all the Julia transcendental functions, sin, cos, log, etc., of which there are many. If we ever add some kind of generic power series functions for these, we may extend the internal definitions to include exact algebraic versions of all these functions. At least for now this is not a pressing issue.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The way that AbstractAlgebra deals with functions which must have a different definition inside the module than what it exports is as follows. Firstly, we do not import the functions from Base or export the functions at all. Internally we make our definitions as we want them, but then we overload the Base version explicitly to do what the console version of the function should do. This is done by explicitly defining Base.sqrt(::ZZRingElem) for example without explicitly importing sqrt from Base, etc.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the Generic module discussed below, we import the definitions from AbstractAlgebra rather than Base.","category":"page"},{"location":"developer/topics/#Determinant","page":"Specific topics","title":"Determinant","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Another function which Nemo handles differently to Julia is det for determinant of matrices. If the input is an integer matrix, Nemo outputs an integer rather than a floating point number for the determinant.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"However, this is not such an acute problem as Julia's det has now been placed in LinearAlgebra rather than Base. Moreover, Nemo has its own matrices and so does not conflict with the definition of det for Julia matrices.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"It is important for developers to understand this difference however. It is not generally wise to use the Julia linear algebra functionality on the Julia matrices underlying generic Nemo matrices for this reason.","category":"page"},{"location":"developer/topics/#The-Generic-submodule","page":"Specific topics","title":"The Generic submodule","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In AbstractAlgebra we define a submodule called Generic. The purpose of this module is to allow generic constructions over a given base ring. For example in Nemo, R, x = Generic.polynomial_ring(ZZ, \"x\") will construct a generic polynomial ring over Nemo integers instead of constructing a Flint polynomial ring.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In other words x will have the type Generic.Poly{ZZRingElem} instead of the usual ZZPolyRingElem.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The ability to construct generic polynomials and matrices and the like is useful for test code and for tracking down bugs in basic arithmetic. It is also useful for performance comparison of arithmetic defined for generic ring constructions vs the specialised implementations provided by C libraries like Flint.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Whilst most developers will not need to use the Generic module specifically, unless they have such needs, all Nemo developers need to understand how to define new generic ring constructions and functions for them. They also need to understand some subtleties that arise because of this mechanism.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Firstly, a generic construction like polynomial_ring must be defined inside the Generic submodule of AbstractAlgebra. All files inside the src/generic directory of AbstractAlgebra exist for this purpose. However, exporting from that submodule will not export the functionality to the Nemo user.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"To do this, one must add a function polynomial_ring for example, in src/Poly.jl, say, which calls Generic.polynomial_ring. Then one needs to export polynomial_ring from AbstractAlgebra (also in that file).","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Similarly, all functions provided for generic polynomial rings are not automatically available, even when exported from the Generic submodule. Two additional things are required, namely an import from Generic into AbstractAlgebra and then an export from AbstractAlgebra to the user.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"An exception to this is if there is a function with the same name in AbstractAlgebra (i.e. in the top level src directory). In this case it is sufficient to simply import that function into Generic in the file src/Generic.jl.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the former case, two large lists exist in src/AbstractAlgebra.jl with these imports and exports. These are kept in alphabetical order to prevent duplicate imports/exports being added over time.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"If one wishes to extend a definition provided by Base, one can simply overload Base.blah inside the Generic submodule directly. Exceptions to this include the div, mod, divrem, sqrt, inv and exp functions mentioned above.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"For AbstractAlgebra types, one still defines these exceptions blah by overloading Base.blah directly inside Generic. However, for the versions that would conflict with the Julia definition (e.g. the definition for Int), we instead define AbstractAlgebra.blah for that specific type and a fallback AbstractAlgebra.blah(a) = Base.blah(a) which calls the Base version of the function for all other types. Of course we do not export blah from AbstractAlgebra.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In order to make the AbstractAlgebra version available in Generic (rather than the Base version), we do not import blah from Base inside Generic, but instead import it from AbstractAlgebra. One can see these imports for the exceptional functions blah in the file src/Generic.jl.","category":"page"},{"location":"developer/topics/#Unsafe-operations-and-aliasing","page":"Specific topics","title":"Unsafe operations and aliasing","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"As with most object oriented languages that overload arithmetic operators, Julia creates new objects when doing an arithmetic operation. For example, BigInt(3) + BigInt(5) creates a new BigInt object to return the value BigInt(8). This can be problematic when accumulating many such operations in a single coefficient of a polynomial or entry of a matrix due to the large number of temporary objects the garbage collector must allocate and clean up.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"To speed up such accumulations, Nemo provides numerous unsafe operators, which mutate the existing elements of the polynomial, matrix, etc. These include functions such as add!, addeq!, mul!, zero! and addmul!.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"These functions take as their first argument the object that should be modified with the return value.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that functions such as sub!, submul! and subeq! are not in the official interface and not provided consistently, thus generic code cannot rely on them existing. So far it has always been the case that when doing accumulation where subtraction is needed rather than addition, that a single negation can be performed outside the accumulation loop and then the additive versions of the functions can be called inside the loop where the performance matters.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"If we encounter cases in future where this is not the case, it may be necessary to add the versions that do subtraction to the interface. However, this can only be done if all rings in Nemo support it. One cannot define a fallback which turns a subtraction into a negation and an addition, as then the old performance characteristics of a new object being created per operation will result, meaning that the developer will not be able to reason about the likely performance of unsafe operators.","category":"page"},{"location":"developer/topics/#Interaction-of-unsafe-operators-and-immutable-types","page":"Specific topics","title":"Interaction of unsafe operators and immutable types","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Because not all objects in Nemo are mutable, the unsafe operators somehow have to support immutable objects. This is done by also returning the \"modified\" return value from the unsafe operators. Naturally, this return value is not a mutated version of the original value, as that is not possible. However, it does allow the unsafe operators to accept immutable values in their first argument. Instead of modifying this value, the old value is replaced with the return value of the unsafe operator.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In order to make this work correctly, every single call to an unsafe operator must assign the return value to the original location. This requires discipline on the part of the developer using unsafe operators.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"For example, to set the existing value a to a + b one must write","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"a = addeq!(a, b)","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"i.e. one must have an explicit assignment to the left of the addeq! call and indeed all the unsafe operator calls.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the case of a mutable type, addeq! will simply modify the original a. The modified object will be returned and assigned to the exact same variable, which has no effect.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the case of an immutable type, addeq! does not modify the original object a as this is impossible, but it still returns the new value and assigns it to a which is what one wants.","category":"page"},{"location":"developer/topics/#Aliasing-rules-and-mutation","page":"Specific topics","title":"Aliasing rules and mutation","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"One must be incredibly careful when mutating an existing value that one owns the value. If the user passes an object to a generic function for example and it changes the object without the user knowing, this can result in incorrect results in user code due to the value of their objects changing from under them.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In the first instance, functions should never modify their inputs. But further problems can also occur if the output of an unsafe operator happens to alias one of the other inputs. Such cases need to be handled exceptionally carefully.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"A second issue arises as Nemo is based on Flint, which has its own aliasing rules which are distinct from the default expectation in Julia. This leads to some interesting corner cases.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In particularly, Flint always allows aliasing of inputs and outputs in its polynomial functions but expects matrix functions to have output matrices that are distinct from their inputs, except in a handful of functions that are specially documented to be inplace operations.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Moreover, when assigning an element to a coefficient of a polynomial or entry of a matrix Flint always makes a copy of the element being assigned to that location. In Julia however, if one assigns an element to some index of an array, the existing object at that location is replaced with the new object. This means that inplace modification of Julia array elements is not safe as it would modify the original object that was assigned to that location, whereas in Flint inplace modification is highly desirable for performance reasons and is completely safe due to the fact that a copy was made when the value was assigned to that location.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"We have developed over a period of many years a set of rules that maximise the performance benefit we get from our unsafe operators, whilst keeping the burden imposed on the programmer to a minimum. It has been a very difficult task to arrive at the set of rules we have whilst respecting correctness of our code, and it would be extremely hard to change any of them.","category":"page"},{"location":"developer/topics/#Arithmetic-operations-return-a-new-object","page":"Specific topics","title":"Arithmetic operations return a new object","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In order to make it easy for the Nemo developer to create a completely new object when one is needed, e.g. for accumulating values using unsafe operators, we developed the following rules.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Whenever an arithmetic operation is used, i.e. +, -, *, unary minus and ^, Nemo always returns a new object, in line with Julia. Naturally, deepcopy also makes a copy of an object which can be used in unsafe functions.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that if R is a type and an element a of that type is passed to it, e.g. R(a) then, the Julia convention is that the original object a will be returned rather than a copy of a. This convention ensures there is not an additional cost when coercing values that are already of the right type, e.g in generic code where coercion may or may not be needed depending on the type.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"We extend this convention to parent objects R and elements a of that parent. In particular, R(a) cannot be used to make a copy of a for use in an unsafe function if R is the parent of a.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"All other functions may also return the input object if they wish. In other words, the return value of all other functions is not suitable for use in an unsafe function. Only return values of arithmetic operations and deepcopy or objects freshly created using inner constructors will be suitable for such use.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"This convention has been chosen to maximise performance of Nemo. Low level operations (where performance matters) make a new object, even if the result is the same arithmetically as one of the inputs. But higher level functions will not necessarily make a new object, meaning that they cannot be used with unsafe functions.","category":"page"},{"location":"developer/topics/#Aliasing-rules","page":"Specific topics","title":"Aliasing rules","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"We now summarise the aliasing rules used by Nemo and AbstractAlgebra. We are relatively confident by now that following these rules will result in correct code given the constraints mentioned above.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"matrices are viewed as containers which may contain elements that alias one another. Other objects, e.g. polynomials, series, etc., are constructed from objects that do not alias one another, even in part\nstandard unsafe operators, addeq!, mul!, addmul!, zero!, add! which mutate their outputs are allow to be used iff that output is entirely under the control of the caller, i.e. it was created for the purpose of accumulation, but otherwise must not be used\nall arithmetic functions i.e. unary minus, +, -, *, ^, and deepcopy must return new objects and cannot return one of their inputs\nall other functions are allowed to return their inputs as outputs\nmatrix functions with an exclamation mark should not mutate the objects that occur as entries of the output matrix, though should be allowed to arbitrarily replace/swap the entries that appear in the matrix. In other words, these functions should be interpreted as inplace operations, rather than operations that are allowed to mutate the actual entries themselves\nR(a) where R is the parent of a, always just returns a and not a copy\nsetcoeff! and setindex! and getcoeff and getindex should not make copies. Note that this implies that setcoeff! should not be passed an element that aliases another somewhere else, even in part\nConstructors for polynomials, series and similar ring element objects (that are not matrices) that take an array as input, must ensure that the coefficients being placed into the object do not alias, even in part","category":"page"},{"location":"developer/topics/#The-SparsePoly-module","page":"Specific topics","title":"The SparsePoly module","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The SparsePoly module in AbstractAlgebra is a generic module for sparse univariate polynomials over a given base ring.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"This module is used internally, e.g. in the generic multivariate gcd code, however it is not particularly suitable for general use.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Firstly, whilst the representation is sparse (recursive) the algorithms used generally are not. This is because the amount of time taken by the Jit in Julia is simply too large (upwards of 6s for the first multivariate gcd).","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Secondly, the order of terms in that representation is not the one which a developer would expect for a sparse univariate format.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"If the Julia Jit is ever made orders of magnitude faster, it may be worth cleaning up this module and making it generally available. But for now, it should be considered internal and heavily incomplete.","category":"page"},{"location":"developer/topics/#Parent-object-caching","page":"Specific topics","title":"Parent object caching","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Parent objects in Nemo must be unique given the data that is used to create them. For this purpose most parent objects are cached globally and looked up upon creation. If a parent object with that data already exists, it is returned from the cache instead of creating a new one.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"There are two situations where this can be problematic however.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The first situation is if one is doing some parallel programming. Here global objects are a blight and it may be necessary to turn off caching and simply ensure that that same data is only ever used once when creating parent objects.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"The second situation is when doing multimodular algorithms, where many similar parent objects with different moduli are created. The cache can become overwhelmed slowing the code down or even grinding to a halt.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"In both these situations one can pass false as an additional argument to a parent constructor to avoid caching the parent object it creates. This parameter normally has a default value of true and under normal circumstances doesn't need to be supplied.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that special light-weight parent constructors, PolyRing, AbsPowerSeriesRing, RelPowerSeriesRing, etc. are also provided which do not cache.","category":"page"},{"location":"developer/topics/#Throw/nothrow-for-check_parent","page":"Specific topics","title":"Throw/nothrow for check_parent","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"By default the check_parent functions throw an exception if parents do not match. However sometimes one would like to know if they match without throwing.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"For this purpose one can pass an additional false argument to check_parent. This suppresses the exception that would be thrown if the parent objects didn't match. Instead the function simply returns true or false to indicate whether they matched or not.","category":"page"},{"location":"developer/topics/#Delayed-reduction","page":"Specific topics","title":"Delayed reduction","text":"","category":"section"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"When working in residue rings, various functions will perform an arithmetic operation followed by a reduction modulo the modulus of the residue ring.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Some accumulations, e.g. in linear algebra or polynomial arithmetic, can be dramatically sped up if one can delay the reductions that would happen after each operation in the accumulation.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Some of the Generic code in Nemo is designed to allow such delayed reduction if the ring supports it and to simply use fallbacks that do the reduction after every intermediate operation if they don't.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"To support delayed reduction, a ring must support the delayed reduction interface which we describe here.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Two additional functions must be supplied for the element type. We give examples for the Nemo nf_elem type:","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"mul_red!(z::nf_elem, x::nf_elem, y::nf_elem, red::Bool)","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"This function behaves as per mul! but only performs reduction if the additional boolean argument red is set to true. This function can assume that both the inputs are reduced.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"reduce!(x::nf_elem)","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"This function must perform reduction on an unreduced element (mutating it). Note that it must return the mutated value as per all unsafe operators.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Finally, the add! and addeq! operators must be able to add nonreduced values.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"If one wishes to speed up generic code for rings that provide delayed reduction, one makes use of the function addmul_delayed_reduction! in the accumulation loop. Here is an example for accumulation into a two dimensional matrix element in Generic in a matrix multiplication routine:","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"A[i, j] = base_ring(X)()\nfor k = 1:ncols(X)\n A[i, j] = addmul_delayed_reduction!(A[i, j], x[i, k], y[k, j], C)\nend\nA[i, j] = reduce!(A[i, j])","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Here C is a temporary element of the same type as the other inputs which is used internally in addmul_delayed_reduction! if needed.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Notice the final call to reduce! to reduce the accumulated value after the accumulation loop has finished.","category":"page"},{"location":"developer/topics/","page":"Specific topics","title":"Specific topics","text":"Note that mul_red! is never called directly but is called inside the generic implementation of addmul_delayed_reduction! for rings that support delayed reduction. That generic code falls back to a call to addmul! which in turn falls back to mul! and addeq! where delayed reduction or addmul! are not available.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"padic/#Padics","page":"Padics","title":"Padics","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"P-adic fields are provided in Nemo by Flint. This allows construction of p-adic fields for any prime p.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"P-adic fields are constructed using the FlintPadicField function. However, for convenience we define","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"PadicField = FlintPadicField","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"so that p-adic fields can be constructed using PadicField rather than FlintPadicField. Note that this is the name of the constructor, but not of padic field type.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"The types of p-adic fields in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Library Field Element type Parent type\nFlint mathbbQ_p padic PadicField","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"All the p-adic field types belong to the Field abstract type and the p-adic field element types belong to the FieldElem abstract type.","category":"page"},{"location":"padic/#P-adic-functionality","page":"Padics","title":"P-adic functionality","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"P-adic fields in Nemo implement all the AbstractAlgebra field functionality:.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Below, we document all the additional function that is provide by Nemo for p-adic fields.","category":"page"},{"location":"padic/#Constructors","page":"Padics","title":"Constructors","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"In order to construct p-adic field elements in Nemo, one must first construct the p-adic field itself. This is accomplished with one of the following constructors.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"FlintPadicField(::Integer, ::Int)","category":"page"},{"location":"padic/#Nemo.FlintPadicField-Tuple{Integer, Int64}","page":"Padics","title":"Nemo.FlintPadicField","text":"FlintPadicField(p::Integer, prec::Int; kw...)\n\nReturns the parent object for the p-adic field for given prime p, where the default absolute precision of elements of the field is given by prec.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"It is also possible to call the inner constructor directly. It has the following form.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"FlintPadicField(p::ZZRingElem, prec::Int)","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Returns the parent object for the p-adic field for given prime p, where the default absolute precision of elements of the field is given by prec.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Here are some examples of creating p-adic fields and making use of the resulting parent objects to coerce various elements into those fields.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\nS = PadicField(ZZ(65537), 30)\n\na = R()\nb = S(1)\nc = S(ZZ(123))\nd = R(ZZ(1)//7^2)","category":"page"},{"location":"padic/#Big-oh-notation","page":"Padics","title":"Big-oh notation","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"Elements of p-adic fields can be constructed using the big-oh notation. For this purpose we define the following functions.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"O(::FlintPadicField, ::Integer)\nO(::FlintPadicField, ::ZZRingElem)\nO(::FlintPadicField, ::QQFieldElem)","category":"page"},{"location":"padic/#AbstractAlgebra.O-Tuple{FlintPadicField, Integer}","page":"Padics","title":"AbstractAlgebra.O","text":"O(R::FlintPadicField, m::Integer)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"padic/#AbstractAlgebra.O-Tuple{FlintPadicField, ZZRingElem}","page":"Padics","title":"AbstractAlgebra.O","text":"O(R::FlintPadicField, m::ZZRingElem)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"padic/#AbstractAlgebra.O-Tuple{FlintPadicField, QQFieldElem}","page":"Padics","title":"AbstractAlgebra.O","text":"O(R::FlintPadicField, m::QQFieldElem)\n\nConstruct the value 0 + O(p^n) given m = p^n. An exception results if m is not found to be a power of p = prime(R).\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"The O(p^n) construction can be used to construct p-adic values of precision n by adding it to integer values representing the p-adic value modulo p^n as in the examples.","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\nS = PadicField(ZZ(65537), 30)\n\nc = 1 + 2*7 + 4*7^2 + O(R, 7^3)\nd = 13 + 357*ZZ(65537) + O(S, ZZ(65537)^12)\nf = ZZ(1)//7^2 + ZZ(2)//7 + 3 + 4*7 + O(R, 7^2)","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"Beware that the expression 1 + 2*p + 3*p^2 + O(R, p^n) is actually computed as a normal Julia expression. Therefore if {Int} values are used instead of Flint integers or Julia bignums, overflow may result in evaluating the value.","category":"page"},{"location":"padic/#Basic-manipulation","page":"Padics","title":"Basic manipulation","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"prime(::FlintPadicField)","category":"page"},{"location":"padic/#AbstractAlgebra.Generic.prime-Tuple{FlintPadicField}","page":"Padics","title":"AbstractAlgebra.Generic.prime","text":"prime(R::FlintPadicField)\n\nReturn the prime p for the given p-adic field.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"precision(::padic)","category":"page"},{"location":"padic/#Base.precision-Tuple{padic}","page":"Padics","title":"Base.precision","text":"precision(a::padic)\n\nReturn the precision of the given p-adic field element, i.e. if the element is known to O(p^n) this function will return n.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"valuation(::padic)","category":"page"},{"location":"padic/#AbstractAlgebra.valuation-Tuple{padic}","page":"Padics","title":"AbstractAlgebra.valuation","text":"valuation(a::padic)\n\nReturn the valuation of the given p-adic field element, i.e. if the given element is divisible by p^n but not a higher power of p then the function will return n.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"lift(::ZZRing, ::padic)\nlift(::QQField, ::padic)","category":"page"},{"location":"padic/#AbstractAlgebra.lift-Tuple{ZZRing, padic}","page":"Padics","title":"AbstractAlgebra.lift","text":"lift(R::ZZRing, a::padic)\n\nReturn a lift of the given p-adic field element to mathbbZ.\n\n\n\n\n\n","category":"method"},{"location":"padic/#AbstractAlgebra.lift-Tuple{QQField, padic}","page":"Padics","title":"AbstractAlgebra.lift","text":"lift(R::QQField, a::padic)\n\nReturn a lift of the given p-adic field element to mathbbQ.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\n\na = 1 + 2*7 + 4*7^2 + O(R, 7^3)\nb = 7^2 + 3*7^3 + O(R, 7^5)\nc = R(2)\n\nk = precision(a)\nm = prime(R)\nn = valuation(b)\np = lift(FlintZZ, a)\nq = lift(FlintQQ, divexact(a, b))","category":"page"},{"location":"padic/#Square-root","page":"Padics","title":"Square root","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"Base.sqrt(::padic)","category":"page"},{"location":"padic/#Base.sqrt-Tuple{padic}","page":"Padics","title":"Base.sqrt","text":"Base.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of f. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.\n\n\n\n\n\nBase.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem\n\nReturn the square root of a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nsqrt(a::FieldElem)\n\nReturn the square root of the element a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nsqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of the given Puiseux series a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\n\na = 1 + 7 + 2*7^2 + O(R, 7^3)\nb = 2 + 3*7 + O(R, 7^5)\nc = 7^2 + 2*7^3 + O(R, 7^4)\n\nd = sqrt(a)\nf = sqrt(b)\nf = sqrt(c)\ng = sqrt(R(121))","category":"page"},{"location":"padic/#Special-functions","page":"Padics","title":"Special functions","text":"","category":"section"},{"location":"padic/","page":"Padics","title":"Padics","text":"Base.exp(::padic)","category":"page"},{"location":"padic/#Base.exp-Tuple{padic}","page":"Padics","title":"Base.exp","text":"exp(a::AbsPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::RelPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::Generic.LaurentSeriesElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the exponential of the given Puiseux series a.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"log(::padic)","category":"page"},{"location":"padic/#Base.log-Tuple{padic}","page":"Padics","title":"Base.log","text":"log(a::SeriesElem{T}) where T <: FieldElement\n\nReturn the logarithm of the power series a.\n\n\n\n\n\nlog(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the logarithm of the given Puiseux series a.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"teichmuller(::padic)","category":"page"},{"location":"padic/#Nemo.teichmuller-Tuple{padic}","page":"Padics","title":"Nemo.teichmuller","text":"teichmuller(a::padic)\n\nReturn the Teichmuller lift of the p-adic value a. We require the valuation of a to be nonnegative. The precision of the output will be the same as the precision of the input. For convenience, if a is congruent to zero modulo p we return zero. If the input is not valid an exception is thrown.\n\n\n\n\n\n","category":"method"},{"location":"padic/","page":"Padics","title":"Padics","text":"Examples","category":"page"},{"location":"padic/","page":"Padics","title":"Padics","text":"R = PadicField(7, 30)\n\na = 1 + 7 + 2*7^2 + O(R, 7^3)\nb = 2 + 5*7 + 3*7^2 + O(R, 7^3)\nc = 3*7 + 2*7^2 + O(R, 7^5)\n\nc = exp(c)\nd = log(a)\nc = exp(R(0))\nd = log(R(1))\nf = teichmuller(b)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"complex/#Arbitrary-precision-complex-balls","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Arbitrary precision complex ball arithmetic is supplied by Arb which provides a ball representation which tracks error bounds rigorously. Complex numbers are represented in rectangular form a+bi where ab are arb balls.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The corresponding field is constructed using the ComplexField constructor. This constructs the parent object for the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The types of complex boxes in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Library Field Element type Parent type\nArb mathbbC (boxes) ComplexFieldElem ComplexField","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"All the complex field types belong to the Field abstract type and the types of elements in this field, i.e. complex boxes in this case, belong to the FieldElem abstract type.","category":"page"},{"location":"complex/#Complex-ball-functionality","page":"Arbitrary precision complex balls","title":"Complex ball functionality","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The complex balls in Nemo provide all the field functionality defined by AbstractAlgebra:.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Below, we document the additional functionality provided for complex balls.","category":"page"},{"location":"complex/#Precision-management","page":"Arbitrary precision complex balls","title":"Precision management","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"See Precision management.","category":"page"},{"location":"complex/#Complex-field-constructors","page":"Arbitrary precision complex balls","title":"Complex field constructors","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"In order to construct complex boxes in Nemo, one must first construct the Arb complex field itself. This is accomplished with the following constructor.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"ComplexField(prec::Int)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Here is an example of creating an Arb complex field and using the resulting parent object to coerce values into the resulting field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\n\na = CC(\"0.25\")\nb = CC(\"0.1\")\nc = CC(0.5)\nd = CC(12)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Note that whilst one can coerce double precision floating point values into an Arb complex field, unless those values can be represented exactly in double precision the resulting ball can't be any more precise than the double precision supplied.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"If instead, values can be represented precisely using decimal arithmetic then one can supply them to Arb using a string. In this case, Arb will store them to the precision specified when creating the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"If the values can be stored precisely as a binary floating point number, Arb will store the values exactly. See the function is_exact below for more information.","category":"page"},{"location":"complex/#Constructors","page":"Arbitrary precision complex balls","title":"Constructors","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"onei(::ComplexField)","category":"page"},{"location":"complex/#Nemo.onei-Tuple{ComplexField}","page":"Arbitrary precision complex balls","title":"Nemo.onei","text":"onei(r::ComplexField)\n\nReturn exact one times i in the given Arb complex field.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\n\nc = onei(CC)","category":"page"},{"location":"complex/#Basic-functionality","page":"Arbitrary precision complex balls","title":"Basic functionality","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The following basic functionality is provided by the default Arb complex field implementation in Nemo, to support construction of generic rings over complex fields. Any custom complex field implementation in Nemo should provide analogues of these functions along with the usual arithmetic operations.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"parent_type(::Type{ComplexFieldElem})","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Gives the type of the parent object of an Arb complex field element.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"elem_type(R::ComplexField)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Given the parent object for an Arb complex field, return the type of elements of the field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"mul!(c::ComplexFieldElem, a::ComplexFieldElem, b::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Multiply a by b and set the existing Arb complex field element c to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"addeq!(c::ComplexFieldElem, a::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"In-place addition adds a to c and sets c to the result. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"deepcopy(a::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Return a copy of the Arb complex field element a, recursively copying the internal data. Arb complex field elements are mutable in Nemo so a shallow copy is not sufficient.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Given the parent object R for an Arb complex field, the following coercion functions are provided to coerce various elements into the Arb complex field. Developers provide these by overloading the call operator for the complex field parent objects.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R()","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce zero into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(n::Integer)\nR(f::ZZRingElem)\nR(q::QQFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce an integer or rational value into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(f::Float64)\nR(f::BigFloat)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce the given floating point number into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(f::AbstractString)\nR(f::AbstractString, g::AbstractString)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce the decimal number, given as a string, into the Arb complex field. In each case f is the real part and g is the imaginary part.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(f::arb)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Coerce the given Arb real ball into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"R(f::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Take an Arb complex field element that is already in an Arb field and simply return it. A copy of the original is not made.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Here are some examples of coercing elements into the Arb complex field.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"RR = RealField(64)\nCC = ComplexField(64)\n\na = CC(3)\nb = CC(QQ(2,3))\nc = CC(\"3 +/- 0.0001\")\nd = CC(\"-1.24e+12345\")\nf = CC(\"nan +/- inf\")\ng = CC(RR(3))","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"In addition to the above, developers of custom complex field types must ensure that they provide the equivalent of the function base_ring(R::ComplexField) which should return Union{}. In addition to this they should ensure that each complex field element contains a field parent specifying the parent object of the complex field element, or at least supply the equivalent of the function parent(a::ComplexFieldElem) to return the parent object of a complex field element.","category":"page"},{"location":"complex/#Basic-manipulation","page":"Arbitrary precision complex balls","title":"Basic manipulation","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"isfinite(::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.isfinite-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.isfinite","text":"isfinite(x::ComplexFieldElem)\n\nReturn true if x is finite, i.e. its real and imaginary parts have finite midpoint and radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"is_exact(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.is_exact-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.is_exact","text":"is_exact(x::ComplexFieldElem)\n\nReturn true if x is exact, i.e. has its real and imaginary parts have zero radius, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"isinteger(::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.isinteger-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.isinteger","text":"isinteger(x::ComplexFieldElem)\n\nReturn true if x is an exact integer, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"accuracy_bits(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.accuracy_bits-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.accuracy_bits","text":"accuracy_bits(x::ComplexFieldElem)\n\nReturn the relative accuracy of x measured in bits, capped between typemax(Int) and -typemax(Int).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\n\na = CC(\"1.2 +/- 0.001\")\nb = CC(3)\n\nisreal(a)\nisfinite(b)\nisinteger(b)\nc = real(a)\nd = imag(b)\nf = accuracy_bits(a)","category":"page"},{"location":"complex/#Containment","page":"Arbitrary precision complex balls","title":"Containment","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"It is often necessary to determine whether a given exact value or box is contained in a given complex box or whether two boxes overlap. The following functions are provided for this purpose.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"overlaps(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.overlaps-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.overlaps","text":"overlaps(x::ComplexFieldElem, y::ComplexFieldElem)\n\nReturns true if any part of the box x overlaps any part of the box y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"contains(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.contains-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.contains","text":"contains(x::ComplexFieldElem, y::ComplexFieldElem)\n\nReturns true if the box x contains the box y, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"contains(::ComplexFieldElem, ::Integer)\ncontains(::ComplexFieldElem, ::ZZRingElem)\ncontains(::ComplexFieldElem, ::QQFieldElem)","category":"page"},{"location":"complex/#Base.contains-Tuple{ComplexFieldElem, Integer}","page":"Arbitrary precision complex balls","title":"Base.contains","text":"contains(x::ComplexFieldElem, y::Integer)\n\nReturns true if the box x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/#Base.contains-Tuple{ComplexFieldElem, ZZRingElem}","page":"Arbitrary precision complex balls","title":"Base.contains","text":"contains(x::ComplexFieldElem, y::ZZRingElem)\n\nReturns true if the box x contains the given integer value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/#Base.contains-Tuple{ComplexFieldElem, QQFieldElem}","page":"Arbitrary precision complex balls","title":"Base.contains","text":"contains(x::ComplexFieldElem, y::QQFieldElem)\n\nReturns true if the box x contains the given rational value, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"The following functions are also provided for determining if a box intersects a certain part of the complex number plane.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"contains_zero(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.contains_zero-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.contains_zero","text":"contains_zero(x::ComplexFieldElem)\n\nReturns true if the box x contains zero, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"1 +/- 0.001\")\ny = CC(\"3\")\n\noverlaps(x, y)\ncontains(x, y)\ncontains(y, 3)\ncontains(x, ZZ(1)//2)\ncontains_zero(x)","category":"page"},{"location":"complex/#Comparison","page":"Arbitrary precision complex balls","title":"Comparison","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Nemo provides a full range of comparison operations for Arb complex boxes. ","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"In addition to the standard comparisons, we introduce an exact equality. This is distinct from arithmetic equality implemented by ==, which merely compares up to the minimum of the precisions of its operands.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"isequal(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.isequal-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.isequal","text":"isequal(x::ComplexFieldElem, y::ComplexFieldElem)\n\nReturn true if the boxes x and y are precisely equal, i.e. their real and imaginary parts have the same midpoints and radii.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"A full range of ad hoc comparison operators is provided. These are implemented directly in Julia, but we document them as though only == were provided.","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Function\n==(x::ComplexFieldElem, y::Integer)\n==(x::Integer, y::ComplexFieldElem)\n==(x::ComplexFieldElem, y::ZZRingElem)\n==(x::ZZRingElem, y::ComplexFieldElem)\n==(x::arb, y::ZZRingElem)\n==(x::ZZRingElem, y::arb)\n==(x::ComplexFieldElem, y::Float64)\n==(x::Float64, y::ComplexFieldElem)","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"1 +/- 0.001\")\ny = CC(\"3\")\nz = CC(\"4\")\n\nisequal(x, deepcopy(x))\nx == 3\nZZ(3) == z\nx != 1.23","category":"page"},{"location":"complex/#Absolute-value","page":"Arbitrary precision complex balls","title":"Absolute value","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"-1 +/- 0.001\")\n\na = abs(x)","category":"page"},{"location":"complex/#Shifting","page":"Arbitrary precision complex balls","title":"Shifting","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"-3 +/- 0.001\")\n\na = ldexp(x, 23)\nb = ldexp(x, -ZZ(15))","category":"page"},{"location":"complex/#Miscellaneous-operations","page":"Arbitrary precision complex balls","title":"Miscellaneous operations","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"trim(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.trim-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.trim","text":"trim(x::ComplexFieldElem)\n\nReturn an acb box containing x but which may be more economical, by rounding off insignificant bits from midpoints.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"unique_integer(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.unique_integer-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.unique_integer","text":"unique_integer(x::ComplexFieldElem)\n\nReturn a pair where the first value is a boolean and the second is an ZZRingElem integer. The boolean indicates whether the box x contains a unique integer. If this is the case, the second return value is set to this unique integer.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\nx = CC(\"-3 +/- 0.001\", \"0.1\")\n\na = trim(x)\nb, c = unique_integer(x)\nd = conj(x)\nf = angle(x)","category":"page"},{"location":"complex/#Constants","page":"Arbitrary precision complex balls","title":"Constants","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"const_pi(::ComplexField)","category":"page"},{"location":"complex/#Nemo.const_pi-Tuple{ComplexField}","page":"Arbitrary precision complex balls","title":"Nemo.const_pi","text":"const_pi(r::ComplexField)\n\nReturn pi = 314159ldots as an element of r.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(200)\n\na = const_pi(CC)","category":"page"},{"location":"complex/#Mathematical-and-special-functions","page":"Arbitrary precision complex balls","title":"Mathematical and special functions","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"rsqrt(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.rsqrt-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.rsqrt","text":"rsqrt(x::ComplexFieldElem)\n\nReturn the reciprocal of the square root of x, i.e. 1sqrtx.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"cispi(::ComplexFieldElem)","category":"page"},{"location":"complex/#Base.cispi-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Base.cispi","text":"cispi(x::ComplexFieldElem)\n\nReturn the exponential of pi i x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"root_of_unity(::ComplexField, k::Int)","category":"page"},{"location":"complex/#Nemo.root_of_unity-Tuple{ComplexField, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.root_of_unity","text":"root_of_unity(C::ComplexField, k::Int)\n\nReturn exp(2pi ik).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"log_sinpi(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.log_sinpi-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.log_sinpi","text":"log_sinpi(x::ComplexFieldElem)\n\nReturn logsin(pi x), constructed without branch cuts off the real line.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma","text":"gamma(x::ComplexFieldElem)\n\nReturn the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"lgamma(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.lgamma-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.lgamma","text":"lgamma(x::ComplexFieldElem)\n\nReturn the logarithm of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"rgamma(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.rgamma-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.rgamma","text":"rgamma(x::ComplexFieldElem)\n\nReturn the reciprocal of the Gamma function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"digamma(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.digamma-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.digamma","text":"digamma(x::ComplexFieldElem)\n\nReturn the logarithmic derivative of the gamma function evaluated at x, i.e. psi(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"zeta(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.zeta-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.zeta","text":"zeta(x::ComplexFieldElem)\n\nReturn the Riemann zeta function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"barnes_g(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.barnes_g-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.barnes_g","text":"barnes_g(x::ComplexFieldElem)\n\nReturn the Barnes G-function, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"log_barnes_g(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.log_barnes_g-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.log_barnes_g","text":"log_barnes_g(x::ComplexFieldElem)\n\nReturn the logarithm of the Barnes G-function, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"erf(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.erf-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.erf","text":"erf(x::ComplexFieldElem)\n\nReturn the error function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"erfi(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.erfi-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.erfi","text":"erfi(x::ComplexFieldElem)\n\nReturn the imaginary error function evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"exp_integral_ei(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.exp_integral_ei-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.exp_integral_ei","text":"exp_integral_ei(x::ComplexFieldElem)\n\nReturn the exponential integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"sin_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.sin_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.sin_integral","text":"sin_integral(x::ComplexFieldElem)\n\nReturn the sine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"cos_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.cos_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.cos_integral","text":"cos_integral(x::ComplexFieldElem)\n\nReturn the exponential cosine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"sinh_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.sinh_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.sinh_integral","text":"sinh_integral(x::ComplexFieldElem)\n\nReturn the hyperbolic sine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"cosh_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.cosh_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.cosh_integral","text":"cosh_integral(x::ComplexFieldElem)\n\nReturn the hyperbolic cosine integral evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"dedekind_eta(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.dedekind_eta-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.dedekind_eta","text":"dedekind_eta(x::ComplexFieldElem)\n\nReturn the Dedekind eta function eta(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_weber_f(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_weber_f-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_weber_f","text":"modular_weber_f(x::ComplexFieldElem)\n\nReturn the modular Weber function mathfrakf(tau) = fraceta^2(tau)eta(tau2)eta(2tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_weber_f1(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_weber_f1-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_weber_f1","text":"modular_weber_f1(x::ComplexFieldElem)\n\nReturn the modular Weber function mathfrakf_1(tau) = fraceta(tau2)eta(tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_weber_f2(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_weber_f2-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_weber_f2","text":"modular_weber_f2(x::ComplexFieldElem)\n\nReturn the modular Weber function mathfrakf_2(tau) = fracsqrt2eta(2tau)eta(tau) at x in the complex upper half plane.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"j_invariant(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.j_invariant-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.j_invariant","text":"j_invariant(x::ComplexFieldElem)\n\nReturn the j-invariant j(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_lambda(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_lambda-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_lambda","text":"modular_lambda(x::ComplexFieldElem)\n\nReturn the modular lambda function lambda(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"modular_delta(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.modular_delta-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.modular_delta","text":"modular_delta(x::ComplexFieldElem)\n\nReturn the modular delta function Delta(tau) at tau = x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"eisenstein_g(::Int, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.eisenstein_g-Tuple{Int64, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.eisenstein_g","text":"eisenstein_g(k::Int, x::ComplexFieldElem)\n\nReturn the non-normalized Eisenstein series G_k(tau) of mathrmSL_2(mathbbZ). Also defined for tau = i infty.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hilbert_class_polynomial(::Int, ::ZZPolyRing)","category":"page"},{"location":"complex/#Nemo.hilbert_class_polynomial-Tuple{Int64, ZZPolyRing}","page":"Arbitrary precision complex balls","title":"Nemo.hilbert_class_polynomial","text":"hilbert_class_polynomial(D::Int, R::ZZPolyRing)\n\nReturn in the ring R the Hilbert class polynomial of discriminant D, which is only defined for D 0 and D equiv 0 1 pmod 4.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"elliptic_k(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.elliptic_k-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.elliptic_k","text":"elliptic_k(x::ComplexFieldElem)\n\nReturn the complete elliptic integral K(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"elliptic_e(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.elliptic_e-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.elliptic_e","text":"elliptic_e(x::ComplexFieldElem)\n\nReturn the complete elliptic integral E(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"agm(::ComplexFieldElem)\nagm(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.agm-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.agm","text":"agm(x::ComplexFieldElem)\n\nReturn the arithmetic-geometric mean of 1 and x.\n\n\n\n\n\n","category":"method"},{"location":"complex/#Nemo.agm-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.agm","text":"agm(x::ComplexFieldElem, y::ComplexFieldElem)\n\nReturn the arithmetic-geometric mean of x and y.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"polygamma(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.polygamma-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.polygamma","text":"polygamma(s::ComplexFieldElem, a::ComplexFieldElem)\n\nReturn the generalised polygamma function psi(sz).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"zeta(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.zeta-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.zeta","text":"zeta(s::ComplexFieldElem, a::ComplexFieldElem)\n\nReturn the Hurwitz zeta function zeta(sa).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"rising_factorial(::ComplexFieldElem, ::Int)","category":"page"},{"location":"complex/#Nemo.rising_factorial-Tuple{ComplexFieldElem, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.rising_factorial","text":"rising_factorial(x::ComplexFieldElem, n::Int)\n\nReturn the rising factorial x(x + 1)ldots (x + n - 1) as an Acb.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"rising_factorial2(::ComplexFieldElem, ::Int)","category":"page"},{"location":"complex/#Nemo.rising_factorial2-Tuple{ComplexFieldElem, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.rising_factorial2","text":"rising_factorial2(x::ComplexFieldElem, n::Int)\n\nReturn a tuple containing the rising factorial x(x + 1)ldots (x + n - 1) and its derivative.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"polylog(::Union{ComplexFieldElem,Int}, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.polylog-Tuple{Union{Int64, ComplexFieldElem}, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.polylog","text":"polylog(s::Union{ComplexFieldElem,Int}, a::ComplexFieldElem)\n\nReturn the polylogarithm Li_s(a).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"log_integral(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.log_integral-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.log_integral","text":"log_integral(x::ComplexFieldElem)\n\nReturn the logarithmic integral, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"log_integral_offset(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.log_integral_offset-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.log_integral_offset","text":"log_integral_offset(x::ComplexFieldElem)\n\nReturn the offset logarithmic integral, evaluated at x.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"exp_integral_e(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.exp_integral_e-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.exp_integral_e","text":"exp_integral_e(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the generalised exponential integral E_s(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma","text":"gamma(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the upper incomplete gamma function Gamma(sx).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma_regularized(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma_regularized-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma_regularized","text":"gamma_regularized(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the regularized upper incomplete gamma function Gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma_lower(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma_lower-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma_lower","text":"gamma_lower(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"gamma_lower_regularized(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.gamma_lower_regularized-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.gamma_lower_regularized","text":"gamma_lower_regularized(s::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the regularized lower incomplete gamma function gamma(sx) Gamma(s).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"airy_ai(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.airy_ai-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.airy_ai","text":"airy_ai(x::ComplexFieldElem)\n\nReturn the Airy function operatornameAi(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"airy_ai_prime(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.airy_ai_prime-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.airy_ai_prime","text":"airy_ai_prime(x::ComplexFieldElem)\n\nReturn the derivative of the Airy function operatornameAi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"airy_bi(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.airy_bi-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.airy_bi","text":"airy_bi(x::ComplexFieldElem)\n\nReturn the Airy function operatornameBi(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"airy_bi_prime(::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.airy_bi_prime-Tuple{ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.airy_bi_prime","text":"airy_bi_prime(x::ComplexFieldElem)\n\nReturn the derivative of the Airy function operatornameBi^prime(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"bessel_j(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.bessel_j-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.bessel_j","text":"bessel_j(nu::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the Bessel function J_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"bessel_y(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.bessel_y-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.bessel_y","text":"bessel_y(nu::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the Bessel function Y_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"bessel_i(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.bessel_i-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.bessel_i","text":"bessel_i(nu::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the Bessel function I_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"bessel_k(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.bessel_k-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.bessel_k","text":"bessel_k(nu::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the Bessel function K_nu(x).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hypergeometric_1f1(::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.hypergeometric_1f1-Tuple{ComplexFieldElem, ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.hypergeometric_1f1","text":"hypergeometric_1f1(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the confluent hypergeometric function _1F_1(abx).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hypergeometric_1f1_regularized(::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.hypergeometric_1f1_regularized-Tuple{ComplexFieldElem, ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.hypergeometric_1f1_regularized","text":"hypergeometric_1f1_regularized(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the regularized confluent hypergeometric function _1F_1(abx) Gamma(b).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hypergeometric_u(::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.hypergeometric_u-Tuple{ComplexFieldElem, ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.hypergeometric_u","text":"hypergeometric_u(a::ComplexFieldElem, b::ComplexFieldElem, x::ComplexFieldElem)\n\nReturn the confluent hypergeometric function U(abx).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"hypergeometric_2f1(::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.hypergeometric_2f1-NTuple{4, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.hypergeometric_2f1","text":"hypergeometric_2f1(a::ComplexFieldElem, b::ComplexFieldElem, c::ComplexFieldElem, x::ComplexFieldElem; flags=0)\n\nReturn the Gauss hypergeometric function _2F_1(abcx).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"jacobi_theta(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.jacobi_theta-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.jacobi_theta","text":"jacobi_theta(z::ComplexFieldElem, tau::ComplexFieldElem)\n\nReturn a tuple of four elements containing the Jacobi theta function values theta_1 theta_2 theta_3 theta_4 evaluated at z tau.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"weierstrass_p(::ComplexFieldElem, ::ComplexFieldElem)","category":"page"},{"location":"complex/#Nemo.weierstrass_p-Tuple{ComplexFieldElem, ComplexFieldElem}","page":"Arbitrary precision complex balls","title":"Nemo.weierstrass_p","text":"weierstrass_p(z::ComplexFieldElem, tau::ComplexFieldElem)\n\nReturn the Weierstrass elliptic function wp(ztau).\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(64)\n\ns = CC(1, 2)\nz = CC(\"1.23\", \"3.45\")\n\na = sin(z)^2 + cos(z)^2\nb = zeta(z)\nc = bessel_j(s, z)\nd = hypergeometric_1f1(s, s+1, z)","category":"page"},{"location":"complex/#Linear-dependence","page":"Arbitrary precision complex balls","title":"Linear dependence","text":"","category":"section"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"lindep(::Vector{ComplexFieldElem}, n::Int)","category":"page"},{"location":"complex/#Nemo.lindep-Tuple{Vector{ComplexFieldElem}, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.lindep","text":"lindep(A::Vector{ComplexFieldElem}, bits::Int)\n\nFind a small linear combination of the entries of the array A that is small (using LLL). The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find linear dependence between a list of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the linear combination.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"lindep(A::Matrix{ComplexFieldElem}, bits::Int)","category":"page"},{"location":"complex/#Nemo.lindep-Tuple{Matrix{ComplexFieldElem}, Int64}","page":"Arbitrary precision complex balls","title":"Nemo.lindep","text":"lindep(A::Matrix{ComplexFieldElem}, bits::Int)\n\nFind a (common) small linear combination of the entries in each row of the array A, that is small (using LLL). It is assumed that the complex numbers in each row of the array share the same linear combination. The entries are first scaled by the given number of bits before truncating the real and imaginary parts to integers for use in LLL. This function can be used to find a common linear dependence shared across a number of lists of complex numbers. The algorithm is heuristic only and returns an array of Nemo integers representing the common linear combination.\n\n\n\n\n\n","category":"method"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"Examples","category":"page"},{"location":"complex/","page":"Arbitrary precision complex balls","title":"Arbitrary precision complex balls","text":"CC = ComplexField(128)\n\n# These are two of the roots of x^5 + 3x + 1\na = CC(1.0050669478588622428791051888364775253, - 0.93725915669289182697903585868761513585)\nb = CC(-0.33198902958450931620250069492231652319)\n\n# We recover the polynomial from one root....\nV1 = [CC(1), a, a^2, a^3, a^4, a^5];\nW = lindep(V1, 20)\n\n# ...or from two\nV2 = [CC(1), b, b^2, b^3, b^4, b^5];\nVs = [V1 V2]\nX = lindep(Vs, 20)","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"finitefield/#Finite-fields","page":"Finite fields","title":"Finite fields","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Finite fields are provided in Nemo by Flint. This allows construction of finite fields of any characteristic and degree for which there are Conway polynomials. It is also possible for the user to specify their own irreducible polynomial generating a finite field.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Finite fields are constructed using the FlintFiniteField function. However, for convenience we define","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"FiniteField = FlintFiniteField","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"so that finite fields can be constructed using FiniteField rather than FlintFiniteField. Note that this is the name of the constructor, but not of finite field type.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"The types of finite field elements in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Library Field Element type Parent type\nFlint mathbbF_p^n (small p) fqPolyRepFieldElem fqPolyRepField\nFlint mathbbF_p^n (large p) FqPolyRepFieldElem FqPolyRepField","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"The only difference between the FqPolyRepFieldElem and fqPolyRepFieldElem types is the representation. The former is for finite fields with multiprecision characteristic and the latter is for characteristics that fit into a single unsigned machine word. The FlintFiniteField constructor automatically picks the correct representation for the user, and so the average user doesn't need to know about the actual types.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"All the finite field types belong to the FinField abstract type and the finite field element types belong to the FinFieldElem abstract type.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Since all the functionality for the FqPolyRepFieldElem finite field type is identical to that provided for the fqPolyRepFieldElem finite field type, we simply document the former.","category":"page"},{"location":"finitefield/#Finite-field-functionality","page":"Finite fields","title":"Finite field functionality","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Finite fields in Nemo provide all the field functionality described in AbstractAlgebra:","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Below we describe the functionality that is provided in addition to this.","category":"page"},{"location":"finitefield/#Constructors","page":"Finite fields","title":"Constructors","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"In order to construct finite field elements in Nemo, one must first construct the finite field itself. This is accomplished with one of the following constructors.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"FlintFiniteField","category":"page"},{"location":"finitefield/#Nemo.FlintFiniteField","page":"Finite fields","title":"Nemo.FlintFiniteField","text":"FlintFiniteField(char::ZZRingElem, deg::Int, s::VarName; cached = true)\n\nReturns a tuple S x consisting of a finite field parent object S and generator x for the finite field of the given characteristic and degree. The string s is used to designate how the finite field generator will be printed. The characteristic must be prime. When a Conway polynomial is known, the field is generated using the Conway polynomial. Otherwise a random sparse, irreducible polynomial is used. The generator of the field is guaranteed to be a multiplicative generator only if the field is generated by a Conway polynomial. We require the degree to be positive.\n\n\n\n\n\nFlintFiniteField(pol::Union{ZZModPolyRingElem, FpPolyRingElem}, s::VarName; cached = true, check = true)\n\nReturns a tuple S x consisting of a finite field parent object S and generator x for the finite field over F_p defined by the given polynomial, i.e. mathbbF_pt(pol). The characteristic is specified by the modulus of pol. The polynomial is required to be irreducible, but this is not checked. The base ring of the polynomial is required to be a field, which is checked by default. Use check = false to disable the check. The string s is used to designate how the finite field generator will be printed. The generator will not be multiplicative in general.\n\n\n\n\n\nFlintFiniteField(F::FqPolyRepField, deg::Int, s::VarName; cached = true)\n\nReturn a finite field with the same type as F but with a possibly different degree deg over the prime subfield.\n\n\n\n\n\n","category":"function"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Here are some examples of creating finite fields and making use of the resulting parent objects to coerce various elements into those fields.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Examples","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"julia> R, x = FiniteField(7, 3, \"x\")\n(Finite field of degree 3 over GF(7), x)\n\njulia> S, y = FiniteField(ZZ(12431351431561), 2, \"y\")\n(Finite field of degree 2 over GF(12431351431561), y)\n\njulia> T, t = polynomial_ring(residue_ring(ZZ, 12431351431561), \"t\")\n(Univariate polynomial ring in t over ZZ/(12431351431561), t)\n\njulia> U, z = FiniteField(t^2 + 7, \"z\")\n(Finite field of degree 2 over GF(12431351431561), z)\n\njulia> a = R(5)\n5\n\njulia> b = R(x)\nx\n\njulia> c = S(ZZ(11))\n11\n\njulia> d = U(7)\n7","category":"page"},{"location":"finitefield/#Basic-manipulation","page":"Finite fields","title":"Basic manipulation","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"gen(::FqPolyRepField)","category":"page"},{"location":"finitefield/#AbstractAlgebra.gen-Tuple{FqPolyRepField}","page":"Finite fields","title":"AbstractAlgebra.gen","text":"gen(a::FqPolyRepField)\n\nReturn the generator of the finite field. Note that this is only guaranteed to be a multiplicative generator if the finite field is generated by a Conway polynomial automatically.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"is_gen(::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#AbstractAlgebra.is_gen-Tuple{FqPolyRepFieldElem}","page":"Finite fields","title":"AbstractAlgebra.is_gen","text":"is_gen(a::FqPolyRepFieldElem)\n\nReturn true if the given finite field element is the generator of the finite field, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"coeff(::FqPolyRepFieldElem, ::Int)","category":"page"},{"location":"finitefield/#AbstractAlgebra.coeff-Tuple{FqPolyRepFieldElem, Int64}","page":"Finite fields","title":"AbstractAlgebra.coeff","text":"coeff(x::FqPolyRepFieldElem, n::Int)\n\nReturn the degree n coefficient of the polynomial representing the given finite field element.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"degree(::FqPolyRepField)","category":"page"},{"location":"finitefield/#AbstractAlgebra.degree-Tuple{FqPolyRepField}","page":"Finite fields","title":"AbstractAlgebra.degree","text":"degree(a::FqPolyRepField)\n\nReturn the degree of the given finite field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"modulus(::FqPolyRepField)","category":"page"},{"location":"finitefield/#AbstractAlgebra.modulus-Tuple{FqPolyRepField}","page":"Finite fields","title":"AbstractAlgebra.modulus","text":"modulus(k::FqPolyRepField, var::VarName=:T)\n\nReturn the modulus defining the finite field k.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Examples","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"julia> R, x = FiniteField(ZZ(7), 5, \"x\")\n(Finite field of degree 5 over GF(7), x)\n\njulia> c = gen(R)\nx\n\njulia> d = characteristic(R)\n7\n\njulia> f = order(R)\n16807\n\njulia> g = degree(R)\n5\n\njulia> n = is_gen(x)\ntrue","category":"page"},{"location":"finitefield/#Special-functions","page":"Finite fields","title":"Special functions","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Various special functions with finite field specific behaviour are defined.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"tr(::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#LinearAlgebra.tr-Tuple{FqPolyRepFieldElem}","page":"Finite fields","title":"LinearAlgebra.tr","text":"tr(x::FqPolyRepFieldElem)\n\nReturn the trace of x. This is an element of mathbbF_p, but the value returned is this value embedded in the original finite field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"norm(::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#LinearAlgebra.norm-Tuple{FqPolyRepFieldElem}","page":"Finite fields","title":"LinearAlgebra.norm","text":"norm(x::FqPolyRepFieldElem)\n\nReturn the norm of x. This is an element of mathbbF_p, but the value returned is this value embedded in the original finite field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"frobenius(::FqPolyRepFieldElem, ::Int)","category":"page"},{"location":"finitefield/#Nemo.frobenius-Tuple{FqPolyRepFieldElem, Int64}","page":"Finite fields","title":"Nemo.frobenius","text":"frobenius(x::FqPolyRepFieldElem, n = 1)\n\nReturn the iterated Frobenius sigma_p^n(x) where sigma_p is the Frobenius map sending the element a to a^p in the finite field of characteristic p. By default the Frobenius map is applied n = 1 times if n is not specified.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"pth_root(::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#Nemo.pth_root-Tuple{FqPolyRepFieldElem}","page":"Finite fields","title":"Nemo.pth_root","text":"pth_root(x::FqPolyRepFieldElem)\n\nReturn the p-th root of x in the finite field of characteristic p. This is the inverse operation to the Frobenius map sigma_p.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Examples","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"julia> R, x = FiniteField(ZZ(7), 5, \"x\")\n(Finite field of degree 5 over GF(7), x)\n\njulia> a = x^4 + 3x^2 + 6x + 1\nx^4 + 3*x^2 + 6*x + 1\n\njulia> b = tr(a)\n1\n\njulia> c = norm(a)\n4\n\njulia> d = frobenius(a)\nx^4 + 2*x^3 + 3*x^2 + 5*x + 1\n\njulia> f = frobenius(a, 3)\n3*x^4 + 3*x^3 + 3*x^2 + x + 4\n\njulia> g = pth_root(a)\n4*x^4 + 3*x^3 + 4*x^2 + 5*x + 2","category":"page"},{"location":"finitefield/#Lift","page":"Finite fields","title":"Lift","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"lift(::FpPolyRing, ::FqPolyRepFieldElem)","category":"page"},{"location":"finitefield/#AbstractAlgebra.lift-Tuple{FpPolyRing, FqPolyRepFieldElem}","page":"Finite fields","title":"AbstractAlgebra.lift","text":"lift(R::FpPolyRing, x::FqPolyRepFieldElem)\n\nLift the finite field element x to a polynomial over the prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Examples","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"julia> R, x = FiniteField(23, 2, \"x\")\n(Finite field of degree 2 over GF(23), x)\n\njulia> S, y = polynomial_ring(GF(23), \"y\")\n(Univariate polynomial ring in y over GF(23), y)\n\njulia> f = 8x + 9\n8*x + 9\n\njulia> lift(S, f)\n8*y + 9","category":"page"},{"location":"finitefield/#Uniform-finite-fields","page":"Finite fields","title":"Uniform finite fields","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"An (experimental) uniform finite field interface is provided by the type FqField. Such a finite field can be constructed as an extension of a prime field mathbfF_p (an absolute extension) or of another finite field (a relative extension). The field over which the extension is constructed is referred to as the base field and field theoretic properties like the degree of an extension or the trace of an element are understood with respect to the base field. The corresponding functionality for the implicit absolute extension over the prime field is available by methods with the prefix absolute_.","category":"page"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Note that all finite fields are simple extension kt(f) of their base field k. The irreducible polynomial f in kt is the defining polynomial and the class of t is referred to as the generator of the extension.","category":"page"},{"location":"finitefield/#Construction-of-finite-fields","page":"Finite fields","title":"Construction of finite fields","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"Nemo._FiniteField\nNemo._GF","category":"page"},{"location":"finitefield/#Nemo._FiniteField","page":"Finite fields","title":"Nemo._FiniteField","text":"_FiniteField(q::IntegerUnion, s::String; cached::Bool, check::Bool)\n_FiniteField(p::IntegerUnion, d::Int, s::String; cached::Bool, check::Bool)\n_FiniteField(f::FqPolyRingElem; s::String; cached::Bool, check::Bool)\n\nReturn a tuple S x consisting of a finite field S of order q = p^d and algebra generator x. The string s is used to designate how the finite field generator will be printed.\n\nIf a polynomial f in kt over a finite field k is specified, the finite field S = kt(f) will be constructed as a finite field with base field k.\n\n\n\n\n\n","category":"function"},{"location":"finitefield/#Nemo._GF","page":"Finite fields","title":"Nemo._GF","text":"_GF(q::IntegerUnion, s::String; cached::Bool, check::Bool)\n_GF(p::IntegerUnion, d::Int, s::String; cached::Bool, check::Bool)\n_GF(f::FqPolyRingElem; s::String; cached::Bool, check::Bool)\n\nReturn a finite field S of order q = p^d. The string s is used to designate how the finite field generator will be printed.\n\nIf a polynomial f in kt over a finite field k is specified, the finite field S = kt(f) will be constructed as a finite field with base field k.\n\n\n\n\n\n","category":"function"},{"location":"finitefield/#Field-properties","page":"Finite fields","title":"Field properties","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"base_field(::FqField)\nprime_field(::FqField)\ndegree(::FqField)\nabsolute_degree(::FqField)\nis_absolute(::FqField)\ndefining_polynomial(::FqPolyRing, ::FqField)","category":"page"},{"location":"finitefield/#AbstractAlgebra.Generic.base_field-Tuple{FqField}","page":"Finite fields","title":"AbstractAlgebra.Generic.base_field","text":"base_field(F::FqField)\n\nReturn the base field of F.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.prime_field-Tuple{FqField}","page":"Finite fields","title":"Nemo.prime_field","text":"prime_field(F::FqField)\n\nReturn the prime field of F.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#AbstractAlgebra.degree-Tuple{FqField}","page":"Finite fields","title":"AbstractAlgebra.degree","text":"degree(a::FqField)\n\nReturn the degree of the given finite field over the base field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.absolute_degree-Tuple{FqField}","page":"Finite fields","title":"Nemo.absolute_degree","text":"absolute_degree(a::FqField)\n\nReturn the degree of the given finite field over the prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.is_absolute-Tuple{FqField}","page":"Finite fields","title":"Nemo.is_absolute","text":"is_absolute(F::FqField)\n\nReturn whether the base field of F is a prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#AbstractAlgebra.Generic.defining_polynomial-Tuple{FqPolyRing, FqField}","page":"Finite fields","title":"AbstractAlgebra.Generic.defining_polynomial","text":"defining_polynomial([R::FqPolyRing], L::FqField)\n\nReturn the defining polynomial of L as a polynomial over the base field of L.\n\nIf the polynomial ring R is specified, the polynomial will be an element of R.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Element-properties","page":"Finite fields","title":"Element properties","text":"","category":"section"},{"location":"finitefield/","page":"Finite fields","title":"Finite fields","text":"tr(::FqFieldElem)\nabsolute_tr(::FqFieldElem)\nnorm(::FqFieldElem)\nabsolute_norm(::FqFieldElem)\nlift(::FqPolyRing, ::FqFieldElem)","category":"page"},{"location":"finitefield/#LinearAlgebra.tr-Tuple{FqFieldElem}","page":"Finite fields","title":"LinearAlgebra.tr","text":"tr(x::FqFieldElem)\n\nReturn the trace of x. This is an element of the base field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.absolute_tr-Tuple{FqFieldElem}","page":"Finite fields","title":"Nemo.absolute_tr","text":"absolute_tr(x::FqFieldElem)\n\nReturn the absolute trace of x. This is an element of the prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#LinearAlgebra.norm-Tuple{FqFieldElem}","page":"Finite fields","title":"LinearAlgebra.norm","text":"norm(x::FqFieldElem)\n\nReturn the norm of x. This is an element of the base field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#Nemo.absolute_norm-Tuple{FqFieldElem}","page":"Finite fields","title":"Nemo.absolute_norm","text":"absolute_norm(x::FqFieldElem)\n\nReturn the absolute norm of x. This is an element of the prime field.\n\n\n\n\n\n","category":"method"},{"location":"finitefield/#AbstractAlgebra.lift-Tuple{FqPolyRing, FqFieldElem}","page":"Finite fields","title":"AbstractAlgebra.lift","text":"lift(R::FqPolyRing, a::FqFieldElem) -> FqPolyRingElem\n\nGiven a polynomial ring over the base field of the parent of a, return a lift such that parent(a)(lift(R, a)) == a is true.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"fraction/#Fraction-fields","page":"Fraction fields","title":"Fraction fields","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Nemo allows the creation of fraction fields over any ring R. We don't require R to be an integral domain, however no attempt is made to deal with the general case. Two fractions ab and cd are equal in Nemo iff ad = bc. Thus, in practice, a greatest common divisor function is currently required for the ring R.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"In order to make the representation ab unique for printing, we have a notion of canonical unit for elements of a ring R. When canonicalising ab, each of the elements a and b is first divided by the canonical unit of b.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The canonical_unit function is defined for elements of every Nemo ring. It must have the properties","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"canonical_unit(u) == u\ncanonical_unit(a*b) == canonical_unit(a)*canonical_unit(b)","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"for any unit u of the ring in question, and a and b arbitrary elements of the ring.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"For example, the canonical unit of an integer is its sign. Thus a fraction of integers always has positive denominator after canonicalisation.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The canonical unit of a polynomial is the canonical unit of its leading coefficient, etc.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"There are two different kinds of implementation of fraction fields in Nemo: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of fractions over specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The following table shows each of the fraction types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of fraction (the type information is mainly of concern to developers).","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.Frac{T} Generic.FracField{T}\nmathbbZ Flint QQFieldElem QQField","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"All fraction element types belong to the abstract type FracElem and all of the fraction field types belong to the abstract type FracField. This enables one to write generic functions that can accept any Nemo fraction type.","category":"page"},{"location":"fraction/#Fraction-functionality","page":"Fraction fields","title":"Fraction functionality","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"All fraction types in Nemo provide functionality for fields described in AbstractAlgebra.jl:","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"In addition all the fraction field functionality of AbstractAlgebra.jl is provided, along with generic fractions fields as described here:","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/fraction","category":"page"},{"location":"fraction/#Basic-manipulation","page":"Fraction fields","title":"Basic manipulation","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"sign(::QQFieldElem)","category":"page"},{"location":"fraction/#Base.sign-Tuple{QQFieldElem}","page":"Fraction fields","title":"Base.sign","text":"sign(a::QQFieldElem)\n\nReturn the sign of a (-1, 0 or 1) as a fraction.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"height(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.height-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.height","text":"height(a::QQFieldElem)\n\nReturn the height of the fraction a, namely the largest of the absolute values of the numerator and denominator.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"height_bits(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.height_bits-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.height_bits","text":"height_bits(a::QQFieldElem)\n\nReturn the number of bits of the height of the fraction a.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"<<(::QQFieldElem, ::Int)","category":"page"},{"location":"fraction/#Base.:<<-Tuple{QQFieldElem, Int64}","page":"Fraction fields","title":"Base.:<<","text":"<<(a::QQFieldElem, b::Int)\n\nReturn a times 2^b.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":">>(::QQFieldElem, ::Int)","category":"page"},{"location":"fraction/#Base.:>>-Tuple{QQFieldElem, Int64}","page":"Fraction fields","title":"Base.:>>","text":">>(a::QQFieldElem, b::Int)\n\nReturn a2^b.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"floor(::QQFieldElem)\nceil(::QQFieldElem)","category":"page"},{"location":"fraction/#Base.floor-Tuple{QQFieldElem}","page":"Fraction fields","title":"Base.floor","text":"floor(a::QQFieldElem)\n\nReturn the greatest integer that is less than or equal to a. The result is returned as a rational with denominator 1.\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Base.ceil-Tuple{QQFieldElem}","page":"Fraction fields","title":"Base.ceil","text":"ceil(a::QQFieldElem)\n\nReturn the least integer that is greater than or equal to a. The result is returned as a rational with denominator 1.\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Examples","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"julia> d = abs(ZZ(11)//3)\n11//3\n\njulia> 4 <= ZZ(7)//ZZ(3)\nfalse","category":"page"},{"location":"fraction/#Modular-arithmetic","page":"Fraction fields","title":"Modular arithmetic","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The following functions are available for rationals.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"mod(a::QQFieldElem, b::ZZRingElem)","category":"page"},{"location":"fraction/#Base.mod-Tuple{QQFieldElem, ZZRingElem}","page":"Fraction fields","title":"Base.mod","text":"mod(a::QQFieldElem, b::ZZRingElem)\nmod(a::QQFieldElem, b::Integer)\n\nReturn a pmodb where b is an integer coprime to the denominator of a.\n\nExamples\n\njulia> mod(-ZZ(2)//3, 7)\n4\n\njulia> mod(ZZ(1)//2, ZZ(5))\n3\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Rational-Reconstruction","page":"Fraction fields","title":"Rational Reconstruction","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Rational reconstruction is available for rational numbers.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"reconstruct(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"fraction/#Nemo.reconstruct-Tuple{ZZRingElem, ZZRingElem}","page":"Fraction fields","title":"Nemo.reconstruct","text":"reconstruct(a::ZZRingElem, b::ZZRingElem)\nreconstruct(a::ZZRingElem, b::Integer)\nreconstruct(a::Integer, b::ZZRingElem)\nreconstruct(a::Integer, b::Integer)\n\nAttempt to return a rational number nd such that 0 leq n leq lfloorsqrtm2rfloor and 0 d leq lfloorsqrtm2rfloor such that gcd(n d) = 1 and a equiv nd^-1 pmodm. If no solution exists, an exception is thrown.\n\nExamples\n\njulia> a = reconstruct(7, 13)\n1//2\n\njulia> b = reconstruct(ZZ(15), 31)\n-1//2\n\njulia> c = reconstruct(ZZ(123), ZZ(237))\n9//2\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Rational-enumeration","page":"Fraction fields","title":"Rational enumeration","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"Various methods exist to enumerate rationals.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"next_minimal(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.next_minimal-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.next_minimal","text":"next_minimal(a::QQFieldElem)\n\nGiven a, return the next rational number in the sequence obtained by enumerating all positive denominators q, and for each q enumerating the numerators 1 le p q in order and generating both pq and qp, but skipping all gcd(pq) neq 1. Starting with zero, this generates every nonnegative rational number once and only once, with the first few entries being 0 1 12 2 13 3 23 32 14 4 34 43 ldots. This enumeration produces the rational numbers in order of minimal height. It has the disadvantage of being somewhat slower to compute than the Calkin-Wilf enumeration. If a 0 we throw a DomainError().\n\nExamples\n\njulia> next_minimal(ZZ(2)//3)\n3//2\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"next_signed_minimal(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.next_signed_minimal-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.next_signed_minimal","text":"next_signed_minimal(a::QQFieldElem)\n\nGiven a signed rational number a assumed to be in canonical form, return the next element in the minimal-height sequence generated by next_minimal but with negative numbers interleaved. The sequence begins 0 1 -1 12 -12 2 -2 13 -13 ldots. Starting with zero, this generates every rational number once and only once, in order of minimal height.\n\nExamples\n\njulia> next_signed_minimal(-ZZ(21)//31)\n31//21\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"next_calkin_wilf(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.next_calkin_wilf-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.next_calkin_wilf","text":"next_calkin_wilf(a::QQFieldElem)\n\nReturn the next number after a in the breadth-first traversal of the Calkin-Wilf tree. Starting with zero, this generates every nonnegative rational number once and only once, with the first few entries being 0 1 12 2 13 32 23 3 14 43 35 52 25 ldots. Despite the appearance of the initial entries, the Calkin-Wilf enumeration does not produce the rational numbers in order of height: some small fractions will appear late in the sequence. This order has the advantage of being faster to produce than the minimal-height order.\n\nExamples\n\njulia> next_calkin_wilf(ZZ(321)//113)\n113//244\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"next_signed_calkin_wilf(::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.next_signed_calkin_wilf-Tuple{QQFieldElem}","page":"Fraction fields","title":"Nemo.next_signed_calkin_wilf","text":"next_signed_calkin_wilf(a::QQFieldElem)\n\nGiven a signed rational number a returns the next element in the Calkin-Wilf sequence with negative numbers interleaved. The sequence begins 0 1 -1 12 -12 2 -2 13 -13 ldots. Starting with zero, this generates every rational number once and only once, but not in order of minimal height.\n\nExamples\n\njulia> next_signed_calkin_wilf(-ZZ(51)//(17))\n1//4\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Random-generation","page":"Fraction fields","title":"Random generation","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"rand_bits(::QQField, b::Int)","category":"page"},{"location":"fraction/#Nemo.rand_bits-Tuple{QQField, Int64}","page":"Fraction fields","title":"Nemo.rand_bits","text":"rand_bits(::QQField, b::Int)\n\nReturn a random signed rational whose numerator and denominator both have b bits before canonicalisation. Note that the resulting numerator and denominator can be smaller than b bits.\n\n\n\n\n\n","category":"method"},{"location":"fraction/#Special-functions","page":"Fraction fields","title":"Special functions","text":"","category":"section"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"The following special functions are available for specific rings in Nemo.","category":"page"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"harmonic(::Int)","category":"page"},{"location":"fraction/#Nemo.harmonic-Tuple{Int64}","page":"Fraction fields","title":"Nemo.harmonic","text":"harmonic(n::Int)\n\nReturn the harmonic number H_n = 1 + 12 + 13 + cdots + 1n. Table lookup is used for H_n whose numerator and denominator fit in a single limb. For larger n, a divide and conquer strategy is used.\n\nExamples\n\njulia> a = harmonic(12)\n86021//27720\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"bernoulli(::Int)","category":"page"},{"location":"fraction/#Nemo.bernoulli-Tuple{Int64}","page":"Fraction fields","title":"Nemo.bernoulli","text":"bernoulli(n::Int)\n\nReturn the Bernoulli number B_n for nonnegative n.\n\nSee also bernoulli_cache.\n\nExamples\n\njulia> d = bernoulli(12)\n-691//2730\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"bernoulli_cache(::Int)","category":"page"},{"location":"fraction/#Nemo.bernoulli_cache-Tuple{Int64}","page":"Fraction fields","title":"Nemo.bernoulli_cache","text":"bernoulli_cache(n::Int)\n\nPrecomputes and caches all the Bernoulli numbers up to B_n. This is much faster than repeatedly calling bernoulli(k). Once cached, subsequent calls to bernoulli(k) for any k le n will read from the cache, making them virtually free.\n\nSee also bernoulli.\n\nExamples\n\njulia> bernoulli_cache(100)\n\njulia> e = bernoulli(100)\n-94598037819122125295227433069493721872702841533066936133385696204311395415197247711//33330\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"dedekind_sum(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"fraction/#Nemo.dedekind_sum-Tuple{ZZRingElem, ZZRingElem}","page":"Fraction fields","title":"Nemo.dedekind_sum","text":"dedekind_sum(h::ZZRingElem, k::ZZRingElem)\n\nReturn the Dedekind sum s(hk) for arbitrary h and k.\n\nExamples\n\njulia> b = dedekind_sum(12, 13)\n-11//13\n\njulia> c = dedekind_sum(-120, ZZ(1305))\n-575//522\n\n\n\n\n\n","category":"method"},{"location":"fraction/","page":"Fraction fields","title":"Fraction fields","text":"simplest_between(::QQFieldElem, ::QQFieldElem)","category":"page"},{"location":"fraction/#Nemo.simplest_between-Tuple{QQFieldElem, QQFieldElem}","page":"Fraction fields","title":"Nemo.simplest_between","text":" simplest_between(l::QQFieldElem, r::QQFieldElem)\n\nReturn the simplest fraction in the closed interval l r. A canonical fraction a_1 b_1 is defined to be simpler than a_2 b_2 if and only if b_1 b_2 or b_1 = b_2 and a_1 a_2.\n\nExamples\n\njulia> simplest_between(QQ(1//10), QQ(3//10))\n1//4\n\n\n\n\n\n","category":"method"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/introduction/#Introduction-to-Nemo-development","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"","category":"section"},{"location":"developer/introduction/#Relationship-to-AbstractAlgebra.jl","page":"Introduction to Nemo development","title":"Relationship to AbstractAlgebra.jl","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Some time in the past, Nemo was split into two packages called Nemo.jl and AbstractAlgebra.jl. The purpose was to provide a Julia only package which did some subset of what Nemo could do, albeit slower. This was requested by people in the Julia community.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Unfortunately this hasn't been terribly successful. Most Julia developers expect that AbstractAlgebra and Nemo functionality will work for Julia matrices over AbstractAlgebra/Nemo rings. This would be possible for functions that do not conflict with Base or LinearAlgebra at least when working with non-empty matrices. However, for reasons that we explain in both the Appendix to the AbstractAlgebra package and in the parent object section of the developer documentation, this is not possible even in theory for functions that would conflict with Julia's standard library or for empty matrices (except in a limited number of special cases).","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Unfortunately the Julia standard library functions do not work with matrices of Nemo objects and there is little we can do about this. Moreover, some Julia functionality isn't supported by the underlying C libraries in Nemo and would be difficult or impossible to provide on the C side.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Nowadays we see AbstractAlgebra to provide three things to Nemo:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"An abstract type hierarchy\nGeneric ring constructions, e.g. generic polynomials and matrices\nGeneric implementations that should work for any ring implementing the required interfaces. These interfaces are documented in the AbstractAlgebra documentation.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Nemo itself is now more or less just a wrapper of four C libraries:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Flint : polynomials and matrices over Z, Q, Z/nZ, Qp, Fq\nArb : polynomials, matrices and special functions over balls over R and C\nAntic : algebraic number field element arithmetic\nCalcium : exact real and complex numbers, including algebraic numbers","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Each ring implemented in those C libraries is wrapped in such a way as to implement the interfaces described by AbstractAlgebra.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Most of the time an AbstractAlgebra implementation will work just as well using Nemo, but the latter will usually be faster, due to the extremely performant C code (around half a million lines of it).","category":"page"},{"location":"developer/introduction/#Layout-of-files","page":"Introduction to Nemo development","title":"Layout of files","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the src directory of Nemo are four directories flint, arb, antic and calcium, each containing the wrappers for the relevant C libraries. The test directory is similarly organised.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Within each of these directories is a set of files, one per module within the C libraries, e.g. the fmpz.jl file wraps the Flint fmpz module for multiple precision integers. The fmpz_poly.jl file wraps the Flint univariate polynomials over fmpz integers, and so on.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The QQFieldElem prefix is for Flint rationals, FqPolyRepFieldElem for Flint finite fields with multiprecision characteristic, fqPolyRepFieldElem is the same but for single word characteristic. The padic prefix is for the field of p-adic numbers for a given p. The zzModRingElem prefix is for Z/nZ for a given n. The gfp prefix is the same as Z/nZ but where n is prime, so that we are dealing with a field.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The FlintTypes.jl file contains the implementation of all the Flint types.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the antic directory, nf_elem is for elements of a number field.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The AnticTypes.jl file contains the Antic types.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the arb directory the arb prefix is for arbitrary precision ball arithmetic over the reals. The acb prefix is similar but for complex numbers.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The ArbTypes.jl file contains the Arb types.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the calcium directory the ca prefix is for Calcium's type. There is also a qqbar file for the field of algebraic numbers.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the AbstractAlgebra.jl package the src directory contains a directory called generic. This is where the implementations of generic types, such as matrices, polynomials, series, etc. reside. Each file such as Matrix.jl corresponds to a generic group/ring/field or other algebraic construction (typically over a base ring). The files in this directory exist inside a submodule of AbstractAlgebra called Generic.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The file GenericTypes.jl is where all the generic types are implemented.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"At the top level of the src directory is a file Generic.jl which is where the Generic submodule of AbstractAlgebra begins and where imports are made from AbstractAlgebra into Generic.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the src directory we have implementations that work for every type belonging to a given abstract type, e.g. Matrix.jl has implementations that will work for any matrix type, whether from AbstractAlgebra's Generic module or even matrix types from Nemo, and so on. So long as they are implemented to provide the Matrix interface all the functions there will work for them. The same applies for Poly.jl for polynomial types, AbsSeries.jl for absolute series types, RelSeries.jl for relative series types, etc.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"In the src directory is AbstractTypes.jl where all the AbstractAlgebra abstract types are defined.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Also in the src directory is a subdirectory called Julia. This is where we give our own implementations of functionality for Julia Integers and Rationals and various other basic rings implemented in terms of Julia types. These are provided so that the package will work as a pure Julia package, replacing many of the rings and fields that would be available in Flint and the other C libraries with Julia equivalents.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Note that some of the implementations we give there would conflict with Base and so are only available inside AbstractAlgebra and are not exported!","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"We try to keep the test directory at the top level of the source tree organised in the same manner as the other directories just discussed, though there is currently no split between tests for Generic and for the implementations in src. All tests are currently combined in test/generic..","category":"page"},{"location":"developer/introduction/#Git,-GitHub-and-project-workflows","page":"Introduction to Nemo development","title":"Git, GitHub and project workflows","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The official repositories for AbstractAlgebra and Nemo are:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://github.com/Nemocas/AbstractAlgebra.jl","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://github.com/Nemocas/Nemo.jl","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"If you wish to contribute to these projects, the first step is to fork them on GitHub. The button for this is in the upper right of the main project page. You will need to sign up for a free GitHub account to do this.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Once you have your own GitHub copy of our repository you can push changes to it from your local machine and this will make them visible to the world.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Before sinking a huge amount of time into a contribution, please open a ticket on the official project page on GitHub explaining what you intend to do and discussing it with the other developers.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The easiest way to get going with development on your local machine is to dev AbstractAlgebra and/or Nemo. To do this, press the ] key in Julia to enter the special package mode and type:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"dev Nemo","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Now you will find a local copy on your machine of the Nemo repository in","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":".julia/dev/Nemo","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"However, this will be set up to push to the official repository instead of your own, so you will need to change this. For example, if your GitHub account name is myname, edit the .git/config file in your local Nemo directory to say:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":" url = https://github.com/Nemocas/Nemo.jl.git\n pushurl = https://github.com/myname/Nemo.jl","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"instead of just the first line which will already be there.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"It is highly recommended that you do not work in the master branch, but create a new branch for each thing you want to contribute to Nemo.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"git checkout -b mynewbranch","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"If your contribution is small and does not take a long time to implement, everything will likely be fine if you simply commit the changes locally, then push them to your GitHub account online:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"git commit -a\ngit push --all","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"However, if you are working on a much larger project it is highly recommended that you frequently pull from the official master branch and rebase your new branch on top of any changes that have been made there:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"git checkout master\ngit pull\ngit checkout mynewbranch\ngit rebase master","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Note that rebasing will try to rewrite each of your commits over the top of the branch you are rebasing on (master in this case). This process will have many steps if there are many commits and lots of conflicts. Simply follow the instructions until the process is finished.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"The longer you leave it before rebasing on master the longer the rebase process will take. It can eventually become overwhelming as it is not replaying the latest state of your repository over master, but each commit that you made in order. You may have completely forgotten what those older commits were about, so this can become very difficult if not done regularly.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Once you have pushed your changes to your GitHub account, go to the official project GitHub page and you should see your branch mentioned near the top of the page. Open a pull request.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Someone will review your code and suggest changes they'd like made. Simply add more commits to your branch and push again. They will automatically get added to your pull request.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Note that we don't accept code without tests and documentation. We use Documenter.jl for our documentation, in Markdown format. See our existing code for examples of docstrings above functions in the source code and look in the docs/src directory to see how these docstrings are merged into our online documentation.","category":"page"},{"location":"developer/introduction/#Development-list","page":"Introduction to Nemo development","title":"Development list","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"All developers of AbstractAlgebra and Nemo are welcome to write to our development list to ask questions and discuss development:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://groups.google.com/g/nemo-devel","category":"page"},{"location":"developer/introduction/#Reporting-bugs","page":"Introduction to Nemo development","title":"Reporting bugs","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Bugs should be reported by opening an issue (ticket) on the official GitHub page for the relevant project. Please state the Julia version being used, the machine you are using and the version of AbstractAlgebra/Nemo you are using. The version can be found in the Project.toml file at the top level of the source tree.","category":"page"},{"location":"developer/introduction/#Development-roadmap","page":"Introduction to Nemo development","title":"Development roadmap","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"AbstractAlgebra has a special roadmap ticket which lists the most important tickets that have been opened. If you want to contribute something high value this is the place to start:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://github.com/Nemocas/AbstractAlgebra.jl/issues/492","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"This ticket is updated every so often.","category":"page"},{"location":"developer/introduction/#Binaries","page":"Introduction to Nemo development","title":"Binaries","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Binaries of C libraries for Nemo are currently made in a separate repository:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://github.com/JuliaPackaging/Yggdrasil","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"If code is added to any of the C libraries used by Nemo, this jll package must be updated first and the version updated in Nemo.jl before the new functionality can be used. Ask the core developers for help with this as various other tasks must be completed at the same time.","category":"page"},{"location":"developer/introduction/#Relationship-to-Oscar","page":"Introduction to Nemo development","title":"Relationship to Oscar","text":"","category":"section"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Nemo and AbstractAlgebra are heavily used by the Oscar computer algebra system being developed in Germany by a number of universities involved in a large project known as TRR 195, funded by the DFG.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"Oscar is the number one customer for Nemo. Many bugs in Nemo are found and fixed by Oscar developers and most of the key Nemo developers are part of the Oscar project.","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"See the Oscar website for further details:","category":"page"},{"location":"developer/introduction/","page":"Introduction to Nemo development","title":"Introduction to Nemo development","text":"https://www.oscar-system.org/","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/typesystem/#The-type-system","page":"The type system","title":"The type system","text":"","category":"section"},{"location":"developer/typesystem/#Use-of-Julia-types-in-Nemo","page":"The type system","title":"Use of Julia types in Nemo","text":"","category":"section"},{"location":"developer/typesystem/#Concrete-and-abstract-types","page":"The type system","title":"Concrete and abstract types","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Julia does not provide a traditional class/inheritance approach to programming. Instead, the basic unit of its object oriented approach is the type definition (struct and mutable struct) and inheritance exists only on the function side of the language rather than data side. Julia provides a rich system of abstract types and unions on the data side and multimethods on the function side to effect this.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example Julia's Number type is an abstract type containing all concrete types that behave like numbers, e.g. Int64, Float64, and so on.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Abstract types can also belong to other abstract types, forming a tree of abstract types.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"In Nemo the most important abstract types are Ring and Field, with the latter belonging to the former so that all fields are rings, and the abstract types RingElem and FieldElem for the objects that represent elements of rings and fields, again with the latter abstract type belonging to the former.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Because this hierarchy of abstract types must form a tree, Julia is strictly speaking single inheritance, as each concrete and abstract type can belong to at most one other abstract type. For example, one could not have a diamond of abstract types with ExactField belonging to both Field and ExactRing.","category":"page"},{"location":"developer/typesystem/#Recovering-aspects-of-multiple-inheritance-in-Nemo","page":"The type system","title":"Recovering aspects of multiple inheritance in Nemo","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Various possibilities exist to get around the limitation that abstract types must form a 'tree' in Nemo and AbstractAlgebra.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"One such possibility is union types. If a function should accept one of a number of concrete or abstract types that can't all be made to belong to a single abstract type due to this limitation then one can use a union type.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example, Nemo defines RingElement to be a union of RingElem and all the Julia standard types which behave like ring elements, e.g. all Integer types and types of rationals with Integer components.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Other union types are defined in src/AbstractAlgebra.jl in AbstractAlgebra.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"A second feature we make use of in Nemo is parameterised types. Each concrete and abstract type can take one or more parameters. These parameter can be any other type, either concrete or abstract. For example, in Julia Rational{T} is for rationals with numerator and denominator of type T.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"A great deal of control over parameterised types is possible, e.g. one can restrict the type parameter T using a where clause, e.g. to write a function that accepts all rational types with integer components of the same type one can use the type Rational{T} where T <: Integer.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Nemo makes use of such parameterised types for generic ring constructions such as generic polynomial rings and matrices over a given base ring. The type of the elements of the base ring is substituted for the parameter T in any concrete instantiation of the types Poly{T} and Mat{T}, which are defined in AbstractAlgebra in src/generic/GenericTypes.jl.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The totality of all univariate polynomial types, including those of generic Poly{T} types and those coming from C libraries (such as ZZPolyRingElem), is represented by the abstract type PolyRingElem{T} which in turn belongs to RingElem, both defined in AbstractAlgebra in src/AbstractTypes.jl.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Similarly, the totality of all matrix types, including explicit C types like ZZMatrix and the generic Mat{T} types is given by the abstract type MatElem{T}, again defined in AbstractAlgebra in src/AbstractTypes.jl.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This hierarchy of types allows one to write functions at any level, e.g. for all univariate polynomial types, just those with a given base type T, or for a specific concrete type corresponding to just one kind of univariate polynomial.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"A third possibility to get around the single inheritance limitation of Julia is type traits. There is currently no explicit compiler/language support for traits, however various implementations exist that make use of type parameters in tricky ways. This allows one to add 'traits' to types, so long as those traits can be expressed as types. In this way, types can have multiple 'properties' at the same time, instead of belonging to just a single abstract type.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Nemo does not currently use type traits, though the map types in Nemo do make use of a custom analogue of this.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Note that unlike class based systems that dispatch on the type of a (sometimes implicit) this or self parameter, Julia methods dispatch on the type of all arguments. This is a natural fit for mathematics where all sorts of ad hoc left and right operations may be required.","category":"page"},{"location":"developer/typesystem/#Encapsulation,-maps-and-runtime-flags","page":"The type system","title":"Encapsulation, maps and runtime flags","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"One limitation of the Julia approach is that the type of an object cannot be changed at runtime. For example one might like to insist that a given ring is in fact a field. There are three standard ways to handle this in Julia.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The first approach is to encapsulate the object in another object which does have the desired type. The second approach is to map the object to a different one of the required type (e.g. by applying a morphism). The third approach is to introduce data fields in the original type which can be changed at runtime, unlike its type. All three approaches come with downsides. ","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Encapsulation can be time consuming for the developer as methods which applied to the original object do not automatically apply to the encapsulated object. One can write methods which do, but this is not automatic.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Application of a map may come with a performance penalty and may be difficult for the user to navigate. Moreover, mutation of the resulting object does not result in mutation of the original object.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The third option of adding runtime data fields essentially takes one back to writing a (possibly bug ridden) interpreter. It relies on the developer implementing outer methods that make use of hand written control statements to determine which of a range of inner methods should be applied to the object. This misses the benefits of one of the main defining features of Julia, namely its multimethod system and can also make introspection more difficult.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Nemo does not apply any of these three approaches widely at present, though information which can only be known at runtime such as whether a ring is Euclidean will eventually have to be encoded using one of these three methods.","category":"page"},{"location":"developer/typesystem/#Nemo's-custom-map-types","page":"The type system","title":"Nemo's custom map types","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"It makes sense that map types in Nemo should be parameterised by the element types of both the domain and codomain of the map, and of course all maps in the system should somehow belong to an abstract type Map.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This leads one to consider a two parameter system of types Map{D, C} where D and C are the domain and codomain types respectively.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"One may also wish to implement various types of map, e.g. linear maps (where the map contains a matrix representing the map) or functional maps (where the map is implemented by a Julia function) and so on. Notionally one imagines doing this with a hierarchy of two parameter abstract types all ultimately belonging to Map{D, C} as the root of the tree.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This approach begins to break down when constructions from homological algebra begin to be applied to maps. In such cases, the maps themselves are the object of study and functions may be applied to maps to produce other maps.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The simplest such function is composition. In a system where composition of maps always results in a map of the same type, no problem arises with the straightforward approach outlined above.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"However, for various reasons (including performance) it may not be desirable or even possible to construct a composition of two given maps using the same representation as the original maps. This means that the result of composing two maps of the same type may be a map of a different type, e.g. in the worst case a general composition type.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This problem makes many homological and category theoretic operations on maps difficult or impossible to implement.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Other operations which may be desirable to implement are caching of maps (e.g. where the map is extremely time consuming to compute, such as discrete logarithms) and attaching category theoretic information to maps. Such operations can be effected by encapsulating existing maps in objects containing the extra information, e.g. a cache or a category. However all the methods that applied to the original map objects now no longer apply to the encapsulated objects.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"To work around these limitations Nemo implements a four parameter Map type, Map{D, C, T, U}.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The first two parameters are the domain and codomain types as discussed above.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The parameter T is a \"map class\" which is itself an abstract type existing in a hierarchy of abstract types. This parameter is best thought of as a trait, independent of the hierarchy of abstract types belonging to Map, giving additional flexibility to the map types in the system.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example, T may be set to LinearMap or FunctionalMap. This may be useful if one wishes to distinguish maps in other ways, e.g. whether they are homomorphisms, isomorphisms, maps with section or retraction etc. As usual, offering traits partially gets around the single inheritance problem.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The final parameter U is used to allow maps of a given type U to be composed and still result in a map of type U, even though the concrete type of the composition is different to that of the original maps. Methods can be written for all maps of type U by matching this parameter, rather than matching on the concrete type U of the original maps.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example, two maps with concrete type MyRingHomomorphism would belong to Map{D, C, T, MyRingHomomorphism} as would any composition of such maps, even if the concrete type of the composition was not a MyRingHomomorphism.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Naturally four parameter types are rather unwieldy and so various helper functions are provided to compute four parameter map types. In the first instance one still has the type Map{D, C} which will give the union of all map types whose first two parameters are D and C, and where the remaining two parameters are arbitrary.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"However one can also pass a map class or a concrete type U to a Map function to compute the class of all maps of the given map class or type.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"For example, to write a function which accepts all maps of \"type\" MyRingHomomorphism, including all compositions of such maps, one inserts Map(MyRingHomomorphism) in place of the type, e.g.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"function myfun(f::Map(MyRingHomomorphism))","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Note the parentheses here, rather than curly braces; it's a function to compute a type! Now the function myfun will accept any map type whose fourth parameter U is set to MyRingHomomorphism.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"This four parameter system is flexible, but may need to be expanded in the future. For example it may be useful to have more than one trait T. This could be achieved either by making T a tuple of traits or by introducing a parameterised MapTrait type which can be placed at that location. Naturally the Map functions for computing the four parameter types will have to be similarly expanded to make it easier for the user.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The map type system is currently considered experimental and our observation so far is that it is not intuitive for developers.","category":"page"},{"location":"developer/typesystem/#Type-hierarchy-diagram","page":"The type system","title":"Type hierarchy diagram","text":"","category":"section"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"The most important abstract types in the system are the element types. Their hierarchy is shown in the following diagram.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"(Image: alt text)","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"Most of the element types have a corresponding parent abstract type. These are shown in the following diagram.","category":"page"},{"location":"developer/typesystem/","page":"The type system","title":"The type system","text":"(Image: alt text)","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"series/#Power-series-and-Laurent-series","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Nemo allows the creation of capped relative and absolute power series over any computable ring R. Capped relative power series are power series of the form a_jx^j + a_j+1x^j+1 + cdots + a_k-1x^k-1 + O(x^k) where j geq 0, a_j in R and the relative precision k - j is at most equal to some specified precision n. On the other hand capped absolute power series are power series of the form a_jx^j + a_j+1x^j+1 + cdots + a_n-1x^n-1 + O(x^n) where j geq 0, a_j in R and the precision n is fixed.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of power series over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The following table shows each of the relative power series types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of series (the type information is mainly of concern to developers).","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl `Generic.RelSeries{T} Generic.RelPowerSeriesRing{T}\nmathbbZ Flint ZZRelPowerSeriesRingElem ZZRelPowerSeriesRing\nmathbbZnmathbbZ (small n) Flint zzModRelPowerSeriesRingElem zzModRelPowerSeriesRing\nmathbbZnmathbbZ (large n) Flint ZZModRelPowerSeriesRingElem ZZModRelPowerSeriesRing\nmathbbQ Flint QQRelPowerSeriesRingElem QQRelPowerSeriesRing\nmathbbF_p (small n) Flint fpRelPowerSeriesRingElem fpRelPowerSeriesRing\nmathbbF_p (large n) Flint FpRelPowerSeriesRingElem FpRelPowerSeriesRing\nmathbbF_p^n (small p) Flint fqPolyRepRelPowerSeriesRingElem fqPolyRepRelPowerSeriesRing\nmathbbF_p^n (large p) Flint FqPolyRepRelPowerSeriesRingElem FqPolyRepRelPowerSeriesRing","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"All relative power series elements belong to the abstract type RelPowerSeriesRingElem and all of the relative power series ring types belong to the abstract type RelPowerSeriesRing.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The maximum relative precision, the string representation of the variable and the base ring R of a generic power series are stored in its parent object. ","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Here is the corresponding table for the absolute power series types.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.AbsSeries{T} Generic.AbsPowerSeriesRing{T}\nmathbbZ Flint ZZAbsPowerSeriesRingElem ZZAbsPowerSeriesRing\nmathbbZnmathbbZ (small n) Flint zzModAbsPowerSeriesRingElem zzModAbsPowerSeriesRing\nmathbbZnmathbbZ (large n) Flint ZZModAbsPowerSeriesRingElem ZZModAbsPowerSeriesRing\nmathbbQ Flint QQAbsPowerSeriesRingElem QQAbsPowerSeriesRing\nmathbbF_p (small n) Flint fpAbsPowerSeriesRingElem fpAbsPowerSeriesRing\nmathbbF_p (large n) Flint FpAbsPowerSeriesRingElem FpAbsPowerSeriesRing\nmathbbF_p^n (small n) Flint fqPolyRepAbsPowerSeriesRingElem fqPolyRepAbsPowerSeriesRing\nmathbbF_p^n (large n) Flint FqPolyRepAbsPowerSeriesRingElem FqPolyRepAbsPowerSeriesRing","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"All absolute power series elements belong to the abstract type AbsPowerSeriesRingElem and all of the absolute power series ring types belong to the abstract type AbsPowerSeriesRing.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The absolute precision, the string representation of the variable and the base ring R of a generic power series are stored in its parent object. ","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"All power series element types belong to the abstract type SeriesElem and all of the power series ring types belong to the abstract type SeriesRing. This enables one to write generic functions that can accept any Nemo power series type.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"AbstractAlgebra.jl also provides Nemo with a generic implementation of Laurent series over a given ring R. For completeness, we list it here.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.LaurentSeriesRingElem{T} Generic.LaurentSeriesRing{T}\nGeneric field K AbstractAlgebra.jl Generic.LaurentSeriesFieldElem{T} Generic.LaurentSeriesField{T}","category":"page"},{"location":"series/#Capped-relative-power-series","page":"Power series and Laurent series","title":"Capped relative power series","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Capped relative power series have their maximum relative precision capped at some value prec_max. This means that if the leading term of a nonzero power series element is c_ax^a and the precision is b then the power series is of the form c_ax^a + c_a+1x^a+1 + ldots + O(x^a + b).","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The zero power series is simply taken to be 0 + O(x^b).","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"The capped relative model has the advantage that power series are stable multiplicatively. In other words, for nonzero power series f and g we have that divexact(f*g), g) == f.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"However, capped relative power series are not additively stable, i.e. we do not always have (f + g) - g = f.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"In the capped relative model we say that two power series are equal if they agree up to the minimum absolute precision of the two power series. Thus, for example, x^5 + O(x^10) == 0 + O(x^5), since the minimum absolute precision is 5.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"During computations, it is possible for power series to lose relative precision due to cancellation. For example if f = x^3 + x^5 + O(x^8) and g = x^3 + x^6 + O(x^8) then f - g = x^5 - x^6 + O(x^8) which now has relative precision 3 instead of relative precision 5.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Amongst other things, this means that equality is not transitive. For example x^6 + O(x^11) == 0 + O(x^5) and x^7 + O(x^12) == 0 + O(x^5) but x^6 + O(x^11) neq x^7 + O(x^12).","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Sometimes it is necessary to compare power series not just for arithmetic equality, as above, but to see if they have precisely the same precision and terms. For this purpose we introduce the isequal function.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"For example, if f = x^2 + O(x^7) and g = x^2 + O(x^8) and h = 0 + O(x^2) then f == g, f == h and g == h, but isequal(f, g), isequal(f, h) and isequal(g, h) would all return false. However, if k = x^2 + O(x^7) then isequal(f, k) would return true.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"There are further difficulties if we construct polynomial over power series. For example, consider the polynomial in y over the power series ring in x over the rationals. Normalisation of such polynomials is problematic. For instance, what is the leading coefficient of (0 + O(x^10))y + (1 + O(x^10))?","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"If one takes it to be (0 + O(x^10)) then some functions may not terminate due to the fact that algorithms may require the degree of polynomials to decrease with each iteration. Instead, the degree may remain constant and simply accumulate leading terms which are arithmetically zero but not identically zero.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"On the other hand, when constructing power series over other power series, if we simply throw away terms which are arithmetically equal to zero, our computations may have different output depending on the order in which the power series are added!","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"One should be aware of these difficulties when working with power series. Power series, as represented on a computer, simply don't satisfy the axioms of a ring. They must be used with care in order to approximate operations in a mathematical power series ring.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Simply increasing the precision will not necessarily give a \"more correct\" answer and some computations may not even terminate due to the presence of arithmetic zeroes!","category":"page"},{"location":"series/#Capped-absolute-power-series","page":"Power series and Laurent series","title":"Capped absolute power series","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"An absolute power series ring over a ring R with precision p behaves very much like the quotient Rx(x^p) of the polynomial ring over R.","category":"page"},{"location":"series/#Power-series-functionality","page":"Power series and Laurent series","title":"Power series functionality","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Power series rings in Nemo provide all the functionality described for power series in AbstractAlgebra:","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/series","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"In addition, generic power series and Laurent series are provided by AbstractAlgebra.","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"We list below only the functionality that is Nemo specific for power series rings.","category":"page"},{"location":"series/#Special-functions","page":"Power series and Laurent series","title":"Special functions","text":"","category":"section"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"Examples","category":"page"},{"location":"series/","page":"Power series and Laurent series","title":"Power series and Laurent series","text":"julia> T, z = power_series_ring(QQ, 30, \"z\")\n(Univariate power series ring over QQ, z + O(z^31))\n\njulia> a = 1 + z + 3z^2 + O(z^5)\n1 + z + 3*z^2 + O(z^5)\n\njulia> b = z + 2z^2 + 5z^3 + O(z^5)\nz + 2*z^2 + 5*z^3 + O(z^5)\n\njulia> d = divexact(z, exp(z + O(z^40)) - 1)\n1 - 1//2*z + 1//12*z^2 - 1//720*z^4 + 1//30240*z^6 - 1//1209600*z^8 + 1//47900160*z^10 - 691//1307674368000*z^12 + 1//74724249600*z^14 - 3617//10670622842880000*z^16 + 43867//5109094217170944000*z^18 - 174611//802857662698291200000*z^20 + 77683//14101100039391805440000*z^22 - 236364091//1693824136731743669452800000*z^24 + 657931//186134520519971831808000000*z^26 - 3392780147//37893265687455865519472640000000*z^28 + O(z^29)\n\njulia> f = exp(b)\n1 + z + 5//2*z^2 + 43//6*z^3 + 193//24*z^4 + O(z^5)\n\njulia> g = log(a)\nz + 5//2*z^2 - 8//3*z^3 - 7//4*z^4 + O(z^5)\n\njulia> h = sqrt(a)\n1 + 1//2*z + 11//8*z^2 - 11//16*z^3 - 77//128*z^4 + O(z^5)\n\njulia> k = sin(b)\nz + 2*z^2 + 29//6*z^3 - z^4 + O(z^5)\n\njulia> m = atanh(b)\nz + 2*z^2 + 16//3*z^3 + 2*z^4 + O(z^5)","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"algebraic/#Algebraic-numbers","page":"Algebraic numbers","title":"Algebraic numbers","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Nemo allows working with exact real and complex algebraic numbers.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The default algebraic number type in Nemo is provided by Calcium. The associated field of algebraic numbers is represented by the constant parent object called CalciumQQBar.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"For convenience we define","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"QQBar = CalciumQQBar","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"so that algebraic numbers can be constructed using QQBar instead of CalciumQQBar. Note that this is the name of a specific parent object, not the name of its type.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Library Element type Parent type\nCalcium qqbar CalciumQQBarField","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Important note on performance","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The default algebraic number type represents algebraic numbers in canonical form using minimal polynomials. This works well for representing individual algebraic numbers, but it does not provide the best performance for field arithmetic. For fast calculation in overlinemathbbQ, CalciumField should typically be used instead (see the section on Exact real and complex numbers). Alternatively, to compute in a fixed subfield of overlinemathbbQ, you may fix a generator a and construct an Antic number field to represent mathbbQ(a).","category":"page"},{"location":"algebraic/#Algebraic-number-functionality","page":"Algebraic numbers","title":"Algebraic number functionality","text":"","category":"section"},{"location":"algebraic/#Constructing-algebraic-numbers","page":"Algebraic numbers","title":"Constructing algebraic numbers","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Methods to construct algebraic numbers include:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Conversion from other numbers and through arithmetic operations\nComputing the roots of a given polynomial\nComputing the eigenvalues of a given matrix\nRandom generation\nExact trigonometric functions (see later section)\nGuessing (see later section)","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Arithmetic:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> ZZRingElem(QQBar(3))\n3\n\njulia> QQFieldElem(QQBar(3) // 2)\n3//2\n\njulia> QQBar(-1) ^ (QQBar(1) // 3)\nRoot 0.500000 + 0.866025*im of x^2 - x + 1","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Solving the quintic equation:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> R, x = polynomial_ring(QQ, \"x\")\n(Univariate polynomial ring in x over QQ, x)\n\njulia> v = roots(QQBar, x^5-x-1)\n5-element Vector{qqbar}:\n Root 1.16730 of x^5 - x - 1\n Root 0.181232 + 1.08395*im of x^5 - x - 1\n Root 0.181232 - 1.08395*im of x^5 - x - 1\n Root -0.764884 + 0.352472*im of x^5 - x - 1\n Root -0.764884 - 0.352472*im of x^5 - x - 1\n\njulia> v[1]^5 - v[1] - 1 == 0\ntrue","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Computing exact eigenvalues of a matrix:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> eigenvalues(ZZ[1 1 0; 0 1 1; 1 0 1], QQBar)\n3-element Vector{qqbar}:\n Root 2.00000 of x - 2\n Root 0.500000 + 0.866025*im of x^2 - x + 1\n Root 0.500000 - 0.866025*im of x^2 - x + 1","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"roots(R::CalciumQQBarField, f::ZZPolyRingElem)\nroots(R::CalciumQQBarField, f::QQPolyRingElem)\neigenvalues(A::ZZMatrix, R::CalciumQQBarField)\neigenvalues(A::QQMatrix, R::CalciumQQBarField)\nrand(R::CalciumQQBarField; degree::Int, bits::Int, randtype::Symbol=:null)","category":"page"},{"location":"algebraic/#AbstractAlgebra.Generic.roots-Tuple{CalciumQQBarField, ZZPolyRingElem}","page":"Algebraic numbers","title":"AbstractAlgebra.Generic.roots","text":"roots(R::CalciumQQBarField, f::ZZPolyRingElem)\n\nReturn all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Roots of multiplicity higher than one are repeated according to their multiplicity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.Generic.roots-Tuple{CalciumQQBarField, QQPolyRingElem}","page":"Algebraic numbers","title":"AbstractAlgebra.Generic.roots","text":"roots(R::CalciumQQBarField, f::QQPolyRingElem)\n\nReturn all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Roots of multiplicity higher than one are repeated according to their multiplicity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.eigenvalues-Tuple{ZZMatrix, CalciumQQBarField}","page":"Algebraic numbers","title":"Nemo.eigenvalues","text":"eigenvalues(A::ZZMatrix, R::CalciumQQBarField)\n\nReturn all the eigenvalues of the matrix A in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Eigenvalues of multiplicity higher than one are repeated according to their multiplicity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.eigenvalues-Tuple{QQMatrix, CalciumQQBarField}","page":"Algebraic numbers","title":"Nemo.eigenvalues","text":"eigenvalues(A::QQMatrix, R::CalciumQQBarField)\n\nReturn all the eigenvalues of the matrix A in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers. Eigenvalues of multiplicity higher than one are repeated according to their multiplicity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.rand-Tuple{CalciumQQBarField}","page":"Algebraic numbers","title":"Base.rand","text":"rand(R::CalciumQQBarField; degree::Int, bits::Int, randtype::Symbol=:null)\n\nReturn a random algebraic number with degree up to degree and coefficients up to bits in size. By default, both real and complex numbers are generated. Set the optional randtype to :real or :nonreal to generate a specific type of number. Note that nonreal numbers require degree at least 2.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Numerical-evaluation","page":"Algebraic numbers","title":"Numerical evaluation","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Algebraic numbers can be evaluated numerically to arbitrary precision by converting to real or complex Arb fields:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> RR = ArbField(64); RR(sqrt(QQBar(2)))\n[1.414213562373095049 +/- 3.45e-19]\n\njulia> CC = AcbField(32); CC(QQBar(-1) ^ (QQBar(1) // 4))\n[0.707106781 +/- 2.74e-10] + [0.707106781 +/- 2.74e-10]*im","category":"page"},{"location":"algebraic/#Minimal-polynomials,-conjugates,-and-properties","page":"Algebraic numbers","title":"Minimal polynomials, conjugates, and properties","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Retrieving the minimal polynomial and algebraic conjugates of a given algebraic number:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> minpoly(polynomial_ring(ZZ, \"x\")[1], QQBar(1+2im))\nx^2 - 2*x + 5\n\njulia> conjugates(QQBar(1+2im))\n2-element Vector{qqbar}:\n Root 1.00000 + 2.00000*im of x^2 - 2x + 5\n Root 1.00000 - 2.00000*im of x^2 - 2x + 5","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"iszero(x::qqbar)\nisone(x::qqbar)\nisinteger(x::qqbar)\nis_rational(x::qqbar)\nisreal(x::qqbar)\ndegree(x::qqbar)\nis_algebraic_integer(x::qqbar)\nminpoly(R::ZZPolyRing, x::qqbar)\nminpoly(R::QQPolyRing, x::qqbar)\nconjugates(a::qqbar)\ndenominator(x::qqbar)\nnumerator(x::qqbar)\nheight(x::qqbar)\nheight_bits(x::qqbar)","category":"page"},{"location":"algebraic/#Base.iszero-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.iszero","text":"iszero(x::qqbar)\n\nReturn whether x is the number 0.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.isone-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.isone","text":"isone(x::qqbar)\n\nReturn whether x is the number 1.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.isinteger-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.isinteger","text":"isinteger(x::qqbar)\n\nReturn whether x is an integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_rational-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.is_rational","text":"is_rational(x::qqbar)\n\nReturn whether x is a rational number.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.isreal-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.isreal","text":"isreal(x::qqbar)\n\nReturn whether x is a real number.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.degree-Tuple{qqbar}","page":"Algebraic numbers","title":"AbstractAlgebra.degree","text":"degree(x::qqbar)\n\nReturn the degree of the minimal polynomial of x.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_algebraic_integer-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.is_algebraic_integer","text":"is_algebraic_integer(x::qqbar)\n\nReturn whether x is an algebraic integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.minpoly-Tuple{ZZPolyRing, qqbar}","page":"Algebraic numbers","title":"AbstractAlgebra.minpoly","text":"minpoly(R::ZZPolyRing, x::qqbar)\n\nReturn the minimal polynomial of x as an element of the polynomial ring R.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.minpoly-Tuple{QQPolyRing, qqbar}","page":"Algebraic numbers","title":"AbstractAlgebra.minpoly","text":"minpoly(R::ZZPolyRing, x::qqbar)\n\nReturn the minimal polynomial of x as an element of the polynomial ring R.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.conjugates-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.conjugates","text":"conjugates(a::qqbar)\n\nReturn all the roots of the polynomial f in the field of algebraic numbers R. The output array is sorted in the default sort order for algebraic numbers.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.denominator-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.denominator","text":"denominator(x::qqbar)\n\nReturn the denominator of x, defined as the leading coefficient of the minimal polynomial of x. The result is returned as an ZZRingElem.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.numerator-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.numerator","text":"numerator(x::qqbar)\n\nReturn the numerator of x, defined as x multiplied by its denominator. The result is an algebraic integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.height-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.height","text":"height(x::qqbar)\n\nReturn the height of the algebraic number x. The result is an ZZRingElem integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.height_bits-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.height_bits","text":"height_bits(x::qqbar)\n\nReturn the height of the algebraic number x measured in bits. The result is a Julia integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Complex-parts","page":"Algebraic numbers","title":"Complex parts","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> real(sqrt(QQBar(1im)))\nRoot 0.707107 of 2x^2 - 1\n\njulia> abs(sqrt(QQBar(1im)))\nRoot 1.00000 of x - 1\n\njulia> floor(sqrt(QQBar(1000)))\nRoot 31.0000 of x - 31\n\njulia> sign(QQBar(-10-20im))\nRoot -0.447214 - 0.894427*im of 5x^4 + 6x^2 + 5","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"real(a::qqbar)\nimag(a::qqbar)\nabs(a::qqbar)\nabs2(a::qqbar)\nconj(a::qqbar)\nsign(a::qqbar)\ncsgn(a::qqbar)\nsign_real(a::qqbar)\nsign_imag(a::qqbar)\nfloor(a::qqbar)\nceil(a::qqbar)","category":"page"},{"location":"algebraic/#Base.real-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.real","text":"real(a::qqbar)\n\nReturn the real part of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.imag-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.imag","text":"imag(a::qqbar)\n\nReturn the imaginary part of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.abs-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.abs","text":"abs(a::qqbar)\n\nReturn the absolute value of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.abs2-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.abs2","text":"abs2(a::qqbar)\n\nReturn the squared absolute value of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.conj-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.conj","text":"conj(a::qqbar)\n\nReturn the complex conjugate of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.sign-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.sign","text":"sign(a::qqbar)\n\nReturn the complex sign of a, defined as zero if a is zero and as a a otherwise.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.csgn-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.csgn","text":"csgn(a::qqbar)\n\nReturn the extension of the real sign function taking the value 1 strictly in the right half plane, -1 strictly in the left half plane, and the sign of the imaginary part when on the imaginary axis. Equivalently, operatornamecsgn(x) = x sqrtx^2 except that the value is 0 at zero. The value is returned as a Julia integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.sign_real-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.sign_real","text":"sign_real(a::qqbar)\n\nReturn the sign of the real part of a as a Julia integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.sign_imag-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.sign_imag","text":"sign_imag(a::qqbar)\n\nReturn the sign of the imaginary part of a as a Julia integer.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.floor-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.floor","text":"floor(a::qqbar)\n\nReturn the floor function of a as an algebraic number. Use ZZRingElem(floor(a)) to construct a Nemo integer instead.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.ceil-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.ceil","text":"ceil(a::qqbar)\n\nReturn the ceiling function of b as an algebraic number. Use ZZRingElem(ceil(a)) to construct a Nemo integer instead.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Comparing-algebraic-numbers","page":"Algebraic numbers","title":"Comparing algebraic numbers","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The operators == and != check exactly for equality.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"We provide various comparison functions for ordering algebraic numbers:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Standard comparison for real numbers (<, isless)\nReal parts\nImaginary parts\nAbsolute values\nAbsolute values of real or imaginary parts\nRoot sort order ","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The standard comparison will throw if either argument is nonreal.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The various comparisons for complex parts are provided as separate operations since these functions are far more efficient than explicitly computing the complex parts and then doing real comparisons.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"The root sort order is a total order for complex algebraic numbers used to order the output of roots and conjugates canonically. We define this order as follows: real roots come first, in descending order. Nonreal roots are subsequently ordered first by real part in descending order, then in ascending order by the absolute value of the imaginary part, and then in descending order of the sign of the imaginary part. This implies that complex conjugate roots are adjacent, with the root in the upper half plane first.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> 1 < sqrt(QQBar(2)) < QQBar(3)//2\ntrue\n\njulia> x = QQBar(3+4im)\nRoot 3.00000 + 4.00000*im of x^2 - 6x + 25\n\njulia> is_equal_abs(x, -x)\ntrue\n\njulia> is_equal_abs_imag(x, 2-x)\ntrue\n\njulia> is_less_real(x, x // 2)\nfalse","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"is_equal_real(a::qqbar, b::qqbar)\nis_equal_imag(a::qqbar, b::qqbar)\nis_equal_abs(a::qqbar, b::qqbar)\nis_equal_abs_real(a::qqbar, b::qqbar)\nis_equal_abs_imag(a::qqbar, b::qqbar)\nis_less_real(a::qqbar, b::qqbar)\nis_less_imag(a::qqbar, b::qqbar)\nis_less_abs(a::qqbar, b::qqbar)\nis_less_abs_real(a::qqbar, b::qqbar)\nis_less_abs_imag(a::qqbar, b::qqbar)\nis_less_root_order(a::qqbar, b::qqbar)","category":"page"},{"location":"algebraic/#Nemo.is_equal_real-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_real","text":"is_equal_real(a::qqbar, b::qqbar)\n\nCompares the real parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_equal_imag-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_imag","text":"is_equal_imag(a::qqbar, b::qqbar)\n\nCompares the imaginary parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_equal_abs-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_abs","text":"is_equal_abs(a::qqbar, b::qqbar)\n\nCompares the absolute values of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_equal_abs_real-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_abs_real","text":"is_equal_abs_real(a::qqbar, b::qqbar)\n\nCompares the absolute values of the real parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_equal_abs_imag-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_equal_abs_imag","text":"is_equal_abs_imag(a::qqbar, b::qqbar)\n\nCompares the absolute values of the imaginary parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_real-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_real","text":"is_less_real(a::qqbar, b::qqbar)\n\nCompares the real parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_imag-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_imag","text":"is_less_imag(a::qqbar, b::qqbar)\n\nCompares the imaginary parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_abs-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_abs","text":"is_less_abs(a::qqbar, b::qqbar)\n\nCompares the absolute values of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_abs_real-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_abs_real","text":"is_less_abs_real(a::qqbar, b::qqbar)\n\nCompares the absolute values of the real parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_abs_imag-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_abs_imag","text":"is_less_abs_imag(a::qqbar, b::qqbar)\n\nCompares the absolute values of the imaginary parts of a and b.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_less_root_order-Tuple{qqbar, qqbar}","page":"Algebraic numbers","title":"Nemo.is_less_root_order","text":"is_less_root_order(a::qqbar, b::qqbar)\n\nCompares the a and b in root sort order.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Roots-and-trigonometric-functions","page":"Algebraic numbers","title":"Roots and trigonometric functions","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> root(QQBar(2), 5)\nRoot 1.14870 of x^5 - 2\n\njulia> sinpi(QQBar(7) // 13)\nRoot 0.992709 of 4096x^12 - 13312x^10 + 16640x^8 - 9984x^6 + 2912x^4 - 364x^2 + 13\n\njulia> tanpi(atanpi(sqrt(QQBar(2)) + 1))\nRoot 2.41421 of x^2 - 2x - 1\n\njulia> root_of_unity(QQBar, 5)\nRoot 0.309017 + 0.951057*im of x^4 + x^3 + x^2 + x + 1\n\njulia> root_of_unity(QQBar, 5, 4)\nRoot 0.309017 - 0.951057*im of x^4 + x^3 + x^2 + x + 1\n\njulia> w = (1 - sqrt(QQBar(-3)))//2\nRoot 0.500000 - 0.866025*im of x^2 - x + 1\n\njulia> is_root_of_unity(w)\ntrue\n\njulia> is_root_of_unity(w + 1)\nfalse\n\njulia> root_of_unity_as_args(w)\n(6, 5)","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"sqrt(a::qqbar)\nroot(a::qqbar, n::Int)\nroot_of_unity(C::CalciumQQBarField, n::Int)\nroot_of_unity(C::CalciumQQBarField, n::Int, k::Int)\nis_root_of_unity(a::qqbar)\nroot_of_unity_as_args(a::qqbar)\nexp_pi_i(a::qqbar)\nlog_pi_i(a::qqbar)\nsinpi(a::qqbar)\ncospi(a::qqbar)\ntanpi(a::qqbar)\nasinpi(a::qqbar)\nacospi(a::qqbar)\natanpi(a::qqbar)","category":"page"},{"location":"algebraic/#Base.sqrt-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.sqrt","text":"sqrt(a::qqbar; check::Bool=true)\n\nReturn the principal square root of a.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#AbstractAlgebra.root-Tuple{qqbar, Int64}","page":"Algebraic numbers","title":"AbstractAlgebra.root","text":"root(a::qqbar, n::Int)\n\nReturn the principal n-th root of a. Requires positive n.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.root_of_unity-Tuple{CalciumQQBarField, Int64}","page":"Algebraic numbers","title":"Nemo.root_of_unity","text":"root_of_unity(C::CalciumQQBarField, n::Int)\n\nReturn the root of unity e^2 pi i n as an element of the field of algebraic numbers C.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.root_of_unity-Tuple{CalciumQQBarField, Int64, Int64}","page":"Algebraic numbers","title":"Nemo.root_of_unity","text":"root_of_unity(C::CalciumQQBarField, n::Int, k::Int)\n\nReturn the root of unity e^2 pi i k n as an element of the field of algebraic numbers C.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.is_root_of_unity-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.is_root_of_unity","text":"is_root_of_unity(a::qqbar)\n\nReturn whether the given algebraic number is a root of unity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.root_of_unity_as_args-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.root_of_unity_as_args","text":"root_of_unity_as_args(a::qqbar)\n\nReturn a pair of integers (q, p) such that the given a equals e^2 pi i p q. The denominator q will be minimal, with 0 le p q. Throws if a is not a root of unity.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.exp_pi_i-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.exp_pi_i","text":"exp_pi_i(a::qqbar)\n\nReturn e^pi i a as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.log_pi_i-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.log_pi_i","text":"log_pi_i(a::qqbar)\n\nReturn log(a) (pi i) as an algebraic number. Throws if this value is transcendental or undefined.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.Math.sinpi-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.Math.sinpi","text":"sinpi(a::qqbar)\n\nReturn sin(pi a) as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Base.Math.cospi-Tuple{qqbar}","page":"Algebraic numbers","title":"Base.Math.cospi","text":"cospi(a::qqbar)\n\nReturn cos(pi a) as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.tanpi-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.tanpi","text":"tanpi(a::qqbar)\n\nReturn tan(pi a) as an algebraic number. Throws if this value is transcendental or undefined.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.asinpi-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.asinpi","text":"asinpi(a::qqbar)\n\nReturn operatornameasin(a) pi as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.acospi-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.acospi","text":"acospi(a::qqbar)\n\nReturn operatornameacos(a) pi as an algebraic number. Throws if this value is transcendental.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Nemo.atanpi-Tuple{qqbar}","page":"Algebraic numbers","title":"Nemo.atanpi","text":"atanpi(a::qqbar)\n\nReturn operatornameatan(a) pi as an algebraic number. Throws if this value is transcendental or undefined.\n\n\n\n\n\n","category":"method"},{"location":"algebraic/#Guessing","page":"Algebraic numbers","title":"Guessing","text":"","category":"section"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Examples","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"An algebraic number can be recovered from a numerical value:","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> RR = ArbField(53); guess(QQBar, RR(\"1.41421356 +/- 1e-6\"), 2)\nRoot 1.41421 of x^2 - 2","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Warning: the input should be an enclosure. If you have a floating-point approximation, you should add an error estimate; otherwise, the only algebraic number that can be guessed is the binary floating-point number itself.","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"julia> RR = ArbField(128);\n\njulia> x = RR(0.1); # note: 53-bit binary approximation of 1//10 without radius\n\njulia> guess(QQBar, x, 1)\nRoot 0.100000 of 36028797018963968x - 3602879701896397\n\njulia> guess(QQBar, x + RR(\"+/- 1e-10\"), 1)\nRoot 0.100000 of 10x - 1","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"Interface","category":"page"},{"location":"algebraic/","page":"Algebraic numbers","title":"Algebraic numbers","text":"guess(R::CalciumQQBarField, x::arb, maxdeg::Int, maxbits::Int=0)\nguess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)","category":"page"},{"location":"algebraic/#Nemo.guess","page":"Algebraic numbers","title":"Nemo.guess","text":"guess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)\n\nTry to reconstruct an algebraic number from a given numerical enclosure x. The algorithm looks for candidates up to degree maxdeg and with coefficients up to size maxbits (which defaults to the precision of x if not given). Throws if no suitable algebraic number can be found.\n\nGuessing typically requires high precision to succeed, and it does not make much sense to call this function with input precision smaller than O(maxdeg cdot maxbits). If this function succeeds, then the output is guaranteed to be contained in the enclosure x, but failure does not prove that such an algebraic number with the specified parameters does not exist.\n\nThis function does a single iteration with the target parameters. For best performance, one should invoke this function repeatedly with successively larger parameters when the size of the intended solution is unknown or may be much smaller than a worst-case bound.\n\n\n\n\n\n","category":"function"},{"location":"algebraic/#Nemo.guess-2","page":"Algebraic numbers","title":"Nemo.guess","text":"guess(R::CalciumQQBarField, x::acb, maxdeg::Int, maxbits::Int=0)\n\nTry to reconstruct an algebraic number from a given numerical enclosure x. The algorithm looks for candidates up to degree maxdeg and with coefficients up to size maxbits (which defaults to the precision of x if not given). Throws if no suitable algebraic number can be found.\n\nGuessing typically requires high precision to succeed, and it does not make much sense to call this function with input precision smaller than O(maxdeg cdot maxbits). If this function succeeds, then the output is guaranteed to be contained in the enclosure x, but failure does not prove that such an algebraic number with the specified parameters does not exist.\n\nThis function does a single iteration with the target parameters. For best performance, one should invoke this function repeatedly with successively larger parameters when the size of the intended solution is unknown or may be much smaller than a worst-case bound.\n\n\n\n\n\n","category":"function"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"numberfield/#Number-field-arithmetic","page":"Number field arithmetic","title":"Number field arithmetic","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Number fields are provided in Nemo by Antic. This allows construction of absolute number fields and basic arithmetic computations therein.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Number fields are constructed using the AnticNumberField function. However, for convenience we define","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"number_field = AnticNumberField","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"so that number fields can be constructed using number_field rather than AnticNumberField. ","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The types of number field elements in Nemo are given in the following table, along with the libraries that provide them and the associated types of the parent objects.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Library Field Element type Parent type\nAntic mathbbQx(f) nf_elem AnticNumberField","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"All the number field types belong to the Field abstract type and the number field element types belong to the FieldElem abstract type.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The Hecke.jl library radically expands on number field functionality, providing ideals, orders, class groups, relative extensions, class field theory, etc.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The basic number field element type used in Hecke is the Nemo/antic number field element type, making the two libraries tightly integrated.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"https://thofma.github.io/Hecke.jl/stable/","category":"page"},{"location":"numberfield/#Number-field-functionality","page":"Number field arithmetic","title":"Number field functionality","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The number fields in Nemo provide all of the AbstractAlgebra field functionality:","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/field","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Below, we document the additional functionality provided for number field elements.","category":"page"},{"location":"numberfield/#Constructors","page":"Number field arithmetic","title":"Constructors","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"In order to construct number field elements in Nemo, one must first construct the number field itself. This is accomplished with one of the following constructors.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"number_field(::QQPolyRingElem, ::VarName)\ncyclotomic_field(::Int, ::VarName)\ncyclotomic_real_subfield(::Int, ::VarName)","category":"page"},{"location":"numberfield/#Nemo.number_field-Tuple{QQPolyRingElem, Union{Char, AbstractString, Symbol}}","page":"Number field arithmetic","title":"Nemo.number_field","text":"number_field(f::QQPolyRingElem, s::VarName;\n cached::Bool = true, check::Bool = true)\n\nReturn a tuple R x consisting of the parent object R and generator x of the number field mathbbQx(f) where f is the supplied polynomial. The supplied string s specifies how the generator of the number field should be printed. If s is not specified, it defaults to _a.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/#Nemo.cyclotomic_field-Tuple{Int64, Union{Char, AbstractString, Symbol}}","page":"Number field arithmetic","title":"Nemo.cyclotomic_field","text":"cyclotomic_field(n::Int, s::VarName = \"z_$n\", t = \"_\\$\"; cached = true)\n\nReturn a tuple R x consisting of the parent object R and generator x of the n-th cyclotomic field, mathbbQ(zeta_n). The supplied string s specifies how the generator of the number field should be printed. If provided, the string t specifies how the generator of the polynomial ring from which the number field is constructed, should be printed. If it is not supplied, a default dollar sign will be used to represent the variable.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/#Nemo.cyclotomic_real_subfield-Tuple{Int64, Union{Char, AbstractString, Symbol}}","page":"Number field arithmetic","title":"Nemo.cyclotomic_real_subfield","text":"cyclotomic_real_subfield(n::Int, s::VarName = \"(z_$n + 1/z_$n)\", t = \"\\$\"; cached = true)\n\nReturn a tuple R x consisting of the parent object R and generator x of the totally real subfield of the n-th cyclotomic field, mathbbQ(zeta_n). The supplied string s specifies how the generator of the number field should be printed. If provided, the string t specifies how the generator of the polynomial ring from which the number field is constructed, should be printed. If it is not supplied, a default dollar sign will be used to represent the variable.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Here are some examples of creating number fields and making use of the resulting parent objects to coerce various elements into those fields.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R, x = polynomial_ring(QQ, \"x\")\nK, a = number_field(x^3 + 3x + 1, \"a\")\nL, b = CyclotomicField(5, \"b\")\nM, c = CyclotomicRealField(5, \"c\")\n\nd = K(3)\nf = L(b)\ng = L(ZZ(11))\nh = L(ZZ(11)//3)\nk = M(x)","category":"page"},{"location":"numberfield/#Number-field-element-constructors","page":"Number field arithmetic","title":"Number field element constructors","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"gen(::AnticNumberField)","category":"page"},{"location":"numberfield/#AbstractAlgebra.gen-Tuple{AnticNumberField}","page":"Number field arithmetic","title":"AbstractAlgebra.gen","text":"gen(a::AnticNumberField)\n\nReturn the generator of the given number field, i.e., a symbolic root of the defining polynomial.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The easiest way of constructing number field elements is to use element arithmetic with the generator, to construct the desired element by its representation as a polynomial. See the following examples for how to do this.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R, x = polynomial_ring(QQ, \"x\")\nK, a = number_field(x^3 + 3x + 1, \"a\")\n\nd = gen(K)\nf = a^2 + 2a - 7","category":"page"},{"location":"numberfield/#Basic-functionality","page":"Number field arithmetic","title":"Basic functionality","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"mul_red!(::nf_elem, ::nf_elem, ::nf_elem, ::Bool)","category":"page"},{"location":"numberfield/#AbstractAlgebra.mul_red!-Tuple{nf_elem, nf_elem, nf_elem, Bool}","page":"Number field arithmetic","title":"AbstractAlgebra.mul_red!","text":"mul_red!(z::nf_elem, x::nf_elem, y::nf_elem, red::Bool)\n\nMultiply x by y and set the existing number field element z to the result. Reduction modulo the defining polynomial is only performed if red is set to true. Note that x and y must be reduced. This function is provided for performance reasons as it saves allocating a new object for the result and eliminates associated garbage collection.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"reduce!(::nf_elem)","category":"page"},{"location":"numberfield/#AbstractAlgebra.Generic.reduce!-Tuple{nf_elem}","page":"Number field arithmetic","title":"AbstractAlgebra.Generic.reduce!","text":"reduce!(x::nf_elem)\n\nReduce the given number field element by the defining polynomial, in-place. This only needs to be done after accumulating values computed by mul_red! where reduction has not been performed. All standard Nemo number field functions automatically reduce their outputs.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"The following coercion function is provided for a number field R.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R(f::QQPolyRingElem)","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Coerce the given rational polynomial into the number field R, i.e. consider the polynomial to be the representation of a number field element and return it.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Conversely, if R is the polynomial ring to which the generating polynomial of a number field belongs, then we can coerce number field elements into the ring R using the following function.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R(b::nf_elem)","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Coerce the given number field element into the polynomial ring R of which the number field is a quotient.","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R, x = polynomial_ring(QQ, \"x\")\nK, a = number_field(x^3 + 3x + 1, \"a\")\n\nf = R(a^2 + 2a + 3)\ng = K(x^2 + 2x + 1)","category":"page"},{"location":"numberfield/#Basic-manipulation","page":"Number field arithmetic","title":"Basic manipulation","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"var(::AnticNumberField)","category":"page"},{"location":"numberfield/#AbstractAlgebra.var-Tuple{AnticNumberField}","page":"Number field arithmetic","title":"AbstractAlgebra.var","text":"var(a::AnticNumberField)\n\nReturns the identifier (as a symbol, not a string), that is used for printing the generator of the given number field.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"is_gen(::nf_elem)","category":"page"},{"location":"numberfield/#AbstractAlgebra.is_gen-Tuple{nf_elem}","page":"Number field arithmetic","title":"AbstractAlgebra.is_gen","text":"is_gen(a::nf_elem)\n\nReturn true if the given number field element is the generator of the number field, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"coeff(::nf_elem, ::Int)","category":"page"},{"location":"numberfield/#AbstractAlgebra.coeff-Tuple{nf_elem, Int64}","page":"Number field arithmetic","title":"AbstractAlgebra.coeff","text":"coeff(x::nf_elem, n::Int)\n\nReturn the n-th coefficient of the polynomial representation of the given number field element. Coefficients are numbered from 0, starting with the constant coefficient.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"denominator(::nf_elem)","category":"page"},{"location":"numberfield/#Base.denominator-Tuple{nf_elem}","page":"Number field arithmetic","title":"Base.denominator","text":"denominator(a::nf_elem)\n\nReturn the denominator of the polynomial representation of the given number field element.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"degree(::AnticNumberField)","category":"page"},{"location":"numberfield/#AbstractAlgebra.degree-Tuple{AnticNumberField}","page":"Number field arithmetic","title":"AbstractAlgebra.degree","text":"degree(a::AnticNumberField)\n\nReturn the degree of the given number field, i.e. the degree of its defining polynomial.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"R, x = polynomial_ring(QQ, \"x\")\nK, a = number_field(x^3 + 3x + 1, \"a\")\n\nd = a^2 + 2a - 7\nm = gen(K)\n\nc = coeff(d, 1)\nis_gen(m)\nq = degree(K)\nr, s = signature(K)\nv = var(R)","category":"page"},{"location":"numberfield/#Norm-and-trace","page":"Number field arithmetic","title":"Norm and trace","text":"","category":"section"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"norm(::nf_elem)","category":"page"},{"location":"numberfield/#LinearAlgebra.norm-Tuple{nf_elem}","page":"Number field arithmetic","title":"LinearAlgebra.norm","text":"norm(a::nf_elem)\n\nReturn the absolute norm of a. The result will be a rational number.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"tr(::nf_elem)","category":"page"},{"location":"numberfield/#LinearAlgebra.tr-Tuple{nf_elem}","page":"Number field arithmetic","title":"LinearAlgebra.tr","text":"tr(a::nf_elem)\n\nReturn the absolute trace of a. The result will be a rational number.\n\n\n\n\n\n","category":"method"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"Examples","category":"page"},{"location":"numberfield/","page":"Number field arithmetic","title":"Number field arithmetic","text":"julia> R, x = polynomial_ring(QQ, \"x\")\n(Univariate polynomial ring in x over QQ, x)\n\njulia> K, a = number_field(x^3 + 3x + 1, \"a\")\n(Number field of degree 3 over QQ, a)\n\njulia> c = 3a^2 - a + 1\n3*a^2 - a + 1\n\njulia> d = norm(c)\n113\n\njulia> f = tr(c)\n-15","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"puiseux/#Puiseux-series","page":"Puiseux series","title":"Puiseux series","text":"","category":"section"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Nemo allows the creation of Puiseux series over any computable ring R. Puiseux series are series of the form a_jx^jm + a_j+1x^(j+1)m + cdots + a_k-1x^(k-1)m + O(x^km) where m is a positive integer, a_i in R and the relative precision k - j is at most equal to some specified precision n.","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of Puiseux series over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"The following table shows each of the Puiseux series types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of series (the type information is mainly of concern to developers).","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl `Generic.PuiseuxSeriesRingElem{T} Generic.PuiseuxSeriesRing{T}\nGeneric field K AbstractAlgebra.jl `Generic.PuiseuxSeriesFieldElem{T} Generic.PuiseuxSeriesField{T}\nmathbbZ Flint FlintPuiseuxSeriesRingElem{ZZLaurentSeriesRingElem} FlintPuiseuxSeriesRing{ZZLaurentSeriesRingElem}","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"For convenience, FlintPuiseuxSeriesRingElem and FlintPuiseuxSeriesFieldElem both belong to a union type called FlintPuiseuxSeriesElem.","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"The maximum relative precision, the string representation of the variable and the base ring R of a generic power series are stored in the parent object. ","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Note that unlike most other Nemo types, Puiseux series are parameterised by the type of the underlying Laurent series type (which must exist before Nemo can make use of it), instead of the type of the coefficients.","category":"page"},{"location":"puiseux/#Puiseux-power-series","page":"Puiseux series","title":"Puiseux power series","text":"","category":"section"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Puiseux series have their maximum relative precision capped at some value prec_max. This refers to the maximum precision of the underlying Laurent series. See the description of the generic Puiseux series in AbstractAlgebra.jl for details.","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"There are numerous important things to be aware of when working with Puiseux series, or series in general. Please refer to the documentation of generic Puiseux series and series in general in AbstractAlgebra.jl for details.","category":"page"},{"location":"puiseux/#Puiseux-series-functionality","page":"Puiseux series","title":"Puiseux series functionality","text":"","category":"section"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Puiseux series rings in Nemo implement all the same functionality that is available for AbstractAlgebra series rings, with the exception of the pol_length and polcoeff functions:","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/series","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"In addition, generic Puiseux series are provided by AbstractAlgebra.jl","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"We list below only the functionality that differs from that described in AbstractAlgebra, for specific rings provided by Nemo.","category":"page"},{"location":"puiseux/#Special-functions","page":"Puiseux series","title":"Special functions","text":"","category":"section"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Base.sqrt(a::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})","category":"page"},{"location":"puiseux/#Base.sqrt-Tuple{FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem}}","page":"Puiseux series","title":"Base.sqrt","text":"Base.sqrt(f::PolyRingElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of f. By default the function checks the input is square and raises an exception if not. If check=false this check is omitted.\n\n\n\n\n\nBase.sqrt(a::FracElem{T}; check::Bool=true) where T <: RingElem\n\nReturn the square root of a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\nsqrt(a::Generic.PuiseuxSeriesElem{T}; check::Bool=true) where T <: RingElement\n\nReturn the square root of the given Puiseux series a. By default the function will throw an exception if the input is not square. If check=false this test is omitted.\n\n\n\n\n\n","category":"method"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Base.exp(a::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})","category":"page"},{"location":"puiseux/#Base.exp-Tuple{FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem}}","page":"Puiseux series","title":"Base.exp","text":"exp(a::AbsPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::RelPowerSeriesRingElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::Generic.LaurentSeriesElem)\n\nReturn the exponential of the power series a.\n\n\n\n\n\nexp(a::Generic.PuiseuxSeriesElem{T}) where T <: RingElement\n\nReturn the exponential of the given Puiseux series a.\n\n\n\n\n\n","category":"method"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"eta_qexp(x::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})","category":"page"},{"location":"puiseux/#Nemo.eta_qexp-Tuple{FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem}}","page":"Puiseux series","title":"Nemo.eta_qexp","text":"eta_qexp(x::FlintPuiseuxSeriesElem{ZZLaurentSeriesRingElem})\n\nReturn the q-series for eta evaluated at x, which must currently be a rational power of the generator of the Puiseux series ring.\n\n\n\n\n\n","category":"method"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"Examples","category":"page"},{"location":"puiseux/","page":"Puiseux series","title":"Puiseux series","text":"julia> S, z = PuiseuxSeriesRing(ZZ, 30, \"z\")\n(Puiseux series ring in z over ZZ, z + O(z^31))\n\njulia> a = 1 + z + 3z^2 + O(z^5)\n1 + z + 3*z^2 + O(z^5)\n\njulia> h = sqrt(a^2)\n1 + z + 3*z^2 + O(z^5)\n\njulia> k = eta_qexp(z)\nz^(1//24) - z^(25//24) + O(z^(31//24))","category":"page"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"ff_embedding/#Finite-field-embeddings","page":"Finite field embeddings","title":"Finite field embeddings","text":"","category":"section"},{"location":"ff_embedding/#Introduction","page":"Finite field embeddings","title":"Introduction","text":"","category":"section"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"Nemo allows the construction of finite field embeddings making use of the algorithm of Bosma, Cannon and Steel behind the scenes to ensure compatibility. Critical routines (e.g. polynomial factorization, matrix computations) are provided by the C library Flint, whereas high level tasks are written directly in Nemo.","category":"page"},{"location":"ff_embedding/#Embedding-functionality","page":"Finite field embeddings","title":"Embedding functionality","text":"","category":"section"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"It is possible to explicitly call the embedding embed function to create an embedding, but it is also possible to directly ask for the conversion of a finite field element x in some other finite field k via calling k(x). The resulting embedding is of type FinFieldMorphism. It is also possible to compute the preimage map of an embedding via the preimage_map function, applied to an embedding or directly to the finite fields (this actually first computes the embedding), or via conversion. An error is thrown if the element you want to compute the preimage of is not in the image of the embedding.","category":"page"},{"location":"ff_embedding/#Computing-an-embedding","page":"Finite field embeddings","title":"Computing an embedding","text":"","category":"section"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"embed(::fqPolyRepField, ::fqPolyRepField)","category":"page"},{"location":"ff_embedding/#Nemo.embed-Tuple{fqPolyRepField, fqPolyRepField}","page":"Finite field embeddings","title":"Nemo.embed","text":"embed(k::T, K::T) where T <: FinField\n\nEmbed k in K, with some additional computations in order to satisfy compatibility conditions with previous and future embeddings.\n\n\n\n\n\n","category":"method"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"Examples","category":"page"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"julia> k2, x2 = FiniteField(19, 2, \"x2\")\n(Finite field of degree 2 over GF(19), x2)\n\njulia> k4, x4 = FiniteField(19, 4, \"x4\")\n(Finite field of degree 4 over GF(19), x4)\n\njulia> f = embed(k2, k4)\nMorphism of finite fields from\n from finite field of degree 2 over gF(19)\n to finite field of degree 4 over gF(19)\n\njulia> y = f(x2)\n6*x4^3 + 5*x4^2 + 9*x4 + 17\n\njulia> z = k4(x2)\n6*x4^3 + 5*x4^2 + 9*x4 + 17","category":"page"},{"location":"ff_embedding/#Computing-the-preimage-of-an-embedding","page":"Finite field embeddings","title":"Computing the preimage of an embedding","text":"","category":"section"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"preimage_map(::fqPolyRepField, ::fqPolyRepField)\npreimage_map(::FinFieldMorphism)","category":"page"},{"location":"ff_embedding/#AbstractAlgebra.Generic.preimage_map-Tuple{fqPolyRepField, fqPolyRepField}","page":"Finite field embeddings","title":"AbstractAlgebra.Generic.preimage_map","text":"preimage_map(k::T, k::T) where T <: FinField\n\nComputes the preimage map corresponding to the embedding of k into K.\n\n\n\n\n\n","category":"method"},{"location":"ff_embedding/#AbstractAlgebra.Generic.preimage_map-Tuple{Nemo.FinFieldMorphism}","page":"Finite field embeddings","title":"AbstractAlgebra.Generic.preimage_map","text":"preimage_map(f::FinFieldMorphism)\n\nCompute the preimage map corresponding to the embedding f.\n\n\n\n\n\n","category":"method"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"Examples","category":"page"},{"location":"ff_embedding/","page":"Finite field embeddings","title":"Finite field embeddings","text":"julia> k7, x7 = FiniteField(13, 7, \"x7\")\n(Finite field of degree 7 over GF(13), x7)\n\njulia> k21, x21 = FiniteField(13, 21, \"x21\")\n(Finite field of degree 21 over GF(13), x21)\n\njulia> s = preimage_map(k7, k21)\nPreimage of the morphism from Finite field of degree 7 over GF(13) to Finite field of degree 21 over GF(13)\n\njulia> y = k21(x7);\n\njulia> z = s(y)\nx7\n\njulia> t = k7(y)\nx7","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"gfp/#Galois-fields","page":"Galois fields","title":"Galois fields","text":"","category":"section"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Nemo allows the creation of Galois fields of the form mathbbZpmathbbZ for a prime p. Note that these are not the same as finite fields of degree 1, as Conway polynomials are not used and no generator is given.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"For convenience, the following constructors are provided.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"GF(n::UInt)\nGF(n::Int)\nGF(n::ZZRingElem)","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"For example, one can create the Galois field of characteristic 7 as follows.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"R = GF(7)","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Elements of the field are then created in the usual way.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"a = R(3)","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Elements of Galois fields have type fpFieldElem when p is given to the constructor as an Int or UInt, and of type FpFieldElem if p is given as an ZZRingElem, and the type of the parent objects is fpField or FpField respectively.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"The modulus p of an element of a Galois field is stored in its parent object.","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"The fpFieldElem and FpFieldElem types belong to the abstract type FinFieldElem and the fpField and FpField parent object types belong to the abstract type FinField.","category":"page"},{"location":"gfp/#Galois-field-functionality","page":"Galois fields","title":"Galois field functionality","text":"","category":"section"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Galois fields in Nemo provide all the residue ring functionality of AbstractAlgebra.jl:","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/residue","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"In addition, all the functionality for rings is available:","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/ring","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Below we describe the functionality that is provided in addition to these.","category":"page"},{"location":"gfp/#Basic-manipulation","page":"Galois fields","title":"Basic manipulation","text":"","category":"section"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"Examples","category":"page"},{"location":"gfp/","page":"Galois fields","title":"Galois fields","text":"julia> F = GF(3)\nFinite field of characteristic 3\n\njulia> a = characteristic(F)\n3\n\njulia> b = order(F)\n3","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"CurrentModule = Nemo\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"integer/#Integers","page":"Integers","title":"Integers","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"The default integer type in Nemo is provided by Flint. The associated ring of integers is represented by the constant parent object called FlintZZ.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"For convenience we define","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"ZZ = FlintZZ","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"so that integers can be constructed using ZZ instead of FlintZZ. Note that this is the name of a specific parent object, not the name of its type.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"The types of the integer ring parent objects and elements of the associated rings of integers are given in the following table according to the library providing them.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Library Element type Parent type\nFlint ZZRingElem ZZRing","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"All integer element types belong directly to the abstract type RingElem and all the integer ring parent object types belong to the abstract type Ring.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"A lot of code will want to accept both ZZRingElem integers and Julia integers, that is, subtypes of Base.Integer. Thus for convenience we define","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"IntegerUnion = Union{Integer,ZZRingElem}","category":"page"},{"location":"integer/#Integer-functionality","page":"Integers","title":"Integer functionality","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"Nemo integers provide all of the ring and Euclidean ring functionality of AbstractAlgebra.jl.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/ring","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/euclidean_interface","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Below, we describe the functionality that is specific to the Nemo/Flint integer ring.","category":"page"},{"location":"integer/#Constructors","page":"Integers","title":"Constructors","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"ZZ(n::Integer)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Coerce a Julia integer value into the integer ring.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"ZZ(n::String)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Parse the given string as an integer.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"ZZ(n::Float64)\nZZ(n::Float32)\nZZ(n::Float16)\nZZ(n::BigFloat)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Coerce the given floating point number into the integer ring, assuming that it can be exactly represented as an integer.","category":"page"},{"location":"integer/#Basic-manipulation","page":"Integers","title":"Basic manipulation","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"sign(::ZZRingElem)","category":"page"},{"location":"integer/#Base.sign-Tuple{ZZRingElem}","page":"Integers","title":"Base.sign","text":"sign(a::ZZRingElem)\n\nReturn the sign of a, i.e. +1, 0 or -1.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"size(::ZZRingElem)","category":"page"},{"location":"integer/#Base.size-Tuple{ZZRingElem}","page":"Integers","title":"Base.size","text":"size(a::ZZRingElem)\n\nReturn the number of limbs required to store the absolute value of a.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"fits(::Type{UInt}, ::ZZRingElem)\nfits(::Type{Int}, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.fits-Tuple{Type{UInt64}, ZZRingElem}","page":"Integers","title":"Nemo.fits","text":"fits(::Type{UInt}, a::ZZRingElem)\n\nReturn true if a fits into a UInt, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.fits-Tuple{Type{Int64}, ZZRingElem}","page":"Integers","title":"Nemo.fits","text":"fits(::Type{Int}, a::ZZRingElem)\n\nReturn true if a fits into an Int, otherwise return false.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"denominator(::ZZRingElem)","category":"page"},{"location":"integer/#Base.denominator-Tuple{ZZRingElem}","page":"Integers","title":"Base.denominator","text":"denominator(a::ZZRingElem)\n\nReturn the denominator of a thought of as a rational. Always returns 1.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"numerator(::ZZRingElem)","category":"page"},{"location":"integer/#Base.numerator-Tuple{ZZRingElem}","page":"Integers","title":"Base.numerator","text":"numerator(a::ZZRingElem)\n\nReturn the numerator of a thought of as a rational. Always returns a.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> a = ZZ(12)\n12\n\njulia> is_unit(a)\nfalse\n\njulia> sign(a)\n1\n\njulia> s = size(a)\n1\n\njulia> fits(Int, a)\ntrue\n\njulia> n = numerator(a)\n12\n\njulia> d = denominator(a)\n1","category":"page"},{"location":"integer/#Euclidean-division","page":"Integers","title":"Euclidean division","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"Nemo also provides a large number of Euclidean division operations. Recall that for a dividend a and divisor b, we can write a = bq + r with 0 leq r b. We call q the quotient and r the remainder.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"We distinguish three cases. If q is rounded towards zero, r will have the same sign as a. If q is rounded towards plus infinity, r will have the opposite sign to b. Finally, if q is rounded towards minus infinity, r will have the same sign as b.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"In the following table we list the division functions and their rounding behaviour. We also give the return value of the function, with q representing return of the quotient and r representing return of the remainder.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function Return Rounding of the quotient\nmod r towards minus infinity\nrem r towards zero\ndiv q towards minus infinity\ndivrem(a::ZZRingElem, b::ZZRingElem) q, r towards minus infinity\ntdivrem(a::ZZRingElem, b::ZZRingElem) q, r towards zero\nfdivrem(a::ZZRingElem, b::ZZRingElem) q, r towards minus infinity\ncdivrem(a::ZZRingElem, b::ZZRingElem) q, r towards plus infinity\nntdivrem(a::ZZRingElem, b::ZZRingElem) q, r nearest integer, ties toward zero\nnfdivrem(a::ZZRingElem, b::ZZRingElem) q, r nearest integer, ties toward minus infinity\nncdivrem(a::ZZRingElem, b::ZZRingElem) q, r nearest integer, ties toward plus infinity","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"N.B: the internal definition of Nemo.div and Nemo.divrem are the same as fdiv and fdivrem. The definitions in the table are of Base.div and Base.divrem which agree with Julia's definitions of div and divrem.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Nemo also offers the following ad hoc division operators. The notation and description is as for the other Euclidean division functions.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function Return Rounding\nmod(a::ZZRingElem, b::Int) r towards minus infinity\nrem(a::ZZRingElem, b::Int) r towards zero\ndiv(a::ZZRingElem, b::Int) q towards zero\ntdiv(a::ZZRingElem, b::Int) q towards zero\nfdiv(a::ZZRingElem, b::Int) q towards minus infinity\ncdiv(a::ZZRingElem, b::Int) q towards plus infinity","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"N.B: the internal definition of Nemo.div is the same as fdiv. The definition in the table is Base.div which agrees with Julia's definition of div.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"The following functions are also available, for the case where one is dividing by a power of 2. In other words, for Euclidean division of the form a = b2^d + r. These are useful for bit twiddling.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function Return Rounding\ntdivpow2(a::ZZRingElem, d::Int) q towards zero\nfdivpow2(a::ZZRingElem, d::Int) q towards minus infinity\nfmodpow2(a::ZZRingElem, d::Int) r towards minus infinity\ncdivpow2(a::ZZRingElem, d::Int) q towards plus infinity","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> a = ZZ(12)\n12\n\njulia> b = ZZ(5)\n5\n\njulia> q, r = divrem(a, b)\n(2, 2)\n\njulia> c = cdiv(a, b)\n3\n\njulia> d = fdiv(a, b)\n2\n\njulia> f = tdivpow2(a, 2)\n3\n\njulia> g = fmodpow2(a, 3)\n4","category":"page"},{"location":"integer/#Comparison","page":"Integers","title":"Comparison","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"Instead of isless we implement a function cmp(a, b) which returns a positive value if a b, zero if a == b and a negative value if a b. We then implement all the other operators, including == in terms of cmp.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"For convenience we also implement a cmpabs(a, b) function which returns a positive value if a b, zero if a == b and a negative value if a b. This can be slightly faster than a call to cmp or one of the comparison operators when comparing nonnegative values for example.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Here is a list of the comparison functions implemented, with the understanding that cmp provides all of the comparison operators listed above.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function\ncmp(a::ZZRingElem, b::ZZRingElem)\ncmpabs(a::ZZRingElem, b::ZZRingElem)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"We also provide the following ad hoc comparisons which again provide all of the comparison operators mentioned above.","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Function\ncmp(a::ZZRingElem, b::Int)\ncmp(a::Int, b::ZZRingElem)\ncmp(a::ZZRingElem, b::UInt)\ncmp(a::UInt, b::ZZRingElem)","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> a = ZZ(12)\n12\n\njulia> b = ZZ(3)\n3\n\njulia> a < b\nfalse\n\njulia> a != b\ntrue\n\njulia> a > 4\ntrue\n\njulia> 5 <= b\nfalse\n\njulia> cmpabs(a, b)\n1","category":"page"},{"location":"integer/#Shifting","page":"Integers","title":"Shifting","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"<<(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#Base.:<<-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Base.:<<","text":"<<(x::ZZRingElem, c::Int)\n\nReturn 2^cx where c geq 0.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":">>(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#Base.:>>-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Base.:>>","text":">>(x::ZZRingElem, c::Int)\n\nReturn x2^c, discarding any remainder, where c geq 0.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> a = ZZ(12)\n12\n\njulia> a << 3\n96\n\njulia> a >> 5\n0","category":"page"},{"location":"integer/#Modular-arithmetic","page":"Integers","title":"Modular arithmetic","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"sqrtmod(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.sqrtmod-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.sqrtmod","text":"sqrtmod(x::ZZRingElem, m::ZZRingElem)\n\nReturn a square root of x (mod m) if one exists. The remainder will be in the range 0 m). We require that m is prime, otherwise the algorithm may not terminate.\n\nExamples\n\njulia> sqrtmod(ZZ(12), ZZ(13))\n5\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"crt(r1::ZZRingElem, m1::ZZRingElem, r2::ZZRingElem, m2::ZZRingElem, signed=false; check::Bool=true)","category":"page"},{"location":"integer/#AbstractAlgebra.crt","page":"Integers","title":"AbstractAlgebra.crt","text":"crt(r1::ZZRingElem, m1::ZZRingElem, r2::ZZRingElem, m2::ZZRingElem, signed=false; check::Bool=true)\ncrt(r1::ZZRingElem, m1::ZZRingElem, r2::Union{Int, UInt}, m2::Union{Int, UInt}, signed=false; check::Bool=true)\ncrt(r::Vector{ZZRingElem}, m::Vector{ZZRingElem}, signed=false; check::Bool=true)\ncrt_with_lcm(r1::ZZRingElem, m1::ZZRingElem, r2::ZZRingElem, m2::ZZRingElem, signed=false; check::Bool=true)\ncrt_with_lcm(r1::ZZRingElem, m1::ZZRingElem, r2::Union{Int, UInt}, m2::Union{Int, UInt}, signed=false; check::Bool=true)\ncrt_with_lcm(r::Vector{ZZRingElem}, m::Vector{ZZRingElem}, signed=false; check::Bool=true)\n\nAs per the AbstractAlgebra crt interface, with the following option. If signed = true, the solution is the range (-m2 m2, otherwise it is in the range 0m), where m is the least common multiple of the moduli.\n\nExamples\n\njulia> crt(ZZ(5), ZZ(13), ZZ(7), ZZ(37), true)\n44\n\njulia> crt(ZZ(5), ZZ(13), 7, 37, true)\n44\n\n\n\n\n\n","category":"function"},{"location":"integer/#Integer-logarithm","page":"Integers","title":"Integer logarithm","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"flog(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.flog-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.flog","text":"flog(x::ZZRingElem, c::ZZRingElem)\nflog(x::ZZRingElem, c::Int)\n\nReturn the floor of the logarithm of x to base c.\n\nExamples\n\njulia> flog(ZZ(12), ZZ(2))\n3\n\njulia> flog(ZZ(12), 3)\n2\n\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"clog(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.clog-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.clog","text":"clog(x::ZZRingElem, c::ZZRingElem)\nclog(x::ZZRingElem, c::Int)\n\nReturn the ceiling of the logarithm of x to base c.\n\nExamples\n\njulia> clog(ZZ(12), ZZ(2))\n4\n\njulia> clog(ZZ(12), 3)\n3\n\n\n\n\n\n\n","category":"method"},{"location":"integer/#Integer-roots","page":"Integers","title":"Integer roots","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"isqrt(::ZZRingElem)","category":"page"},{"location":"integer/#Base.isqrt-Tuple{ZZRingElem}","page":"Integers","title":"Base.isqrt","text":"isqrt(x::ZZRingElem)\n\nReturn the floor of the square root of x.\n\nExamples\n\njulia> isqrt(ZZ(13))\n3\n\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"isqrtrem(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.isqrtrem-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.isqrtrem","text":"isqrtrem(x::ZZRingElem)\n\nReturn a tuple s r consisting of the floor s of the square root of x and the remainder r, i.e. such that x = s^2 + r. We require x geq 0.\n\nExamples\n\njulia> isqrtrem(ZZ(13))\n(3, 4)\n\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"root(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#AbstractAlgebra.root-Tuple{ZZRingElem, Int64}","page":"Integers","title":"AbstractAlgebra.root","text":"root(x::ZZRingElem, n::Int; check::Bool=true)\n\nReturn the n-the root of x. We require n 0 and that x geq 0 if n is even. By default the function tests whether the input was a perfect n-th power and if not raises an exception. If check=false this check is omitted.\n\nExamples\n\njulia> root(ZZ(27), 3; check=true)\n3\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"iroot(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#AbstractAlgebra.iroot-Tuple{ZZRingElem, Int64}","page":"Integers","title":"AbstractAlgebra.iroot","text":"iroot(x::ZZRingElem, n::Int)\n\nReturn the integer truncation of the n-the root of x (round towards zero). We require n 0 and that x geq 0 if n is even.\n\nExamples\n\njulia> iroot(ZZ(13), 3)\n2\n\n\n\n\n\n","category":"method"},{"location":"integer/#Number-theoretic-functionality","page":"Integers","title":"Number theoretic functionality","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"divisible(::ZZRingElem, ::Int)\ndivisible(::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.divisible-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.divisible","text":"divisible(x::ZZRingElem, y::Int)\n\nReturn true if x is divisible by y, otherwise return false. We require x neq 0.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.divisible-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.divisible","text":"divisible(x::ZZRingElem, y::ZZRingElem)\n\nReturn true if x is divisible by y, otherwise return false. We require x neq 0.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"is_square(::ZZRingElem)","category":"page"},{"location":"integer/#AbstractAlgebra.is_square-Tuple{ZZRingElem}","page":"Integers","title":"AbstractAlgebra.is_square","text":"is_square(f::PolyRingElem{T}) where T <: RingElement\n\nReturn true if f is a perfect square.\n\n\n\n\n\nis_square(a::FracElem{T}) where T <: RingElem\n\nReturn true if a is a square.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"is_prime(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.is_prime-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.is_prime","text":"is_prime(x::ZZRingElem)\nis_prime(x::Int)\n\nReturn true if x is a prime number, otherwise return false.\n\nExamples\n\njulia> is_prime(ZZ(13))\ntrue\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"is_probable_prime(::ZZRingElem)","category":"page"},{"location":"integer/#AbstractAlgebra.is_probable_prime-Tuple{ZZRingElem}","page":"Integers","title":"AbstractAlgebra.is_probable_prime","text":"is_probable_prime(x::ZZRingElem)\n\nReturn true if x is very probably a prime number, otherwise return false. No counterexamples are known to this test, but it is conjectured that infinitely many exist.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"factor(::ZZRingElem)","category":"page"},{"location":"integer/#AbstractAlgebra.factor-Tuple{ZZRingElem}","page":"Integers","title":"AbstractAlgebra.factor","text":"factor(a::ZZRingElem)\nfactor(a::UInt)\nfactor(a::Int)\n\nReturn a factorisation of a using a Fac struct (see the documentation on factorisation in Nemo).\n\nExamples\n\njulia> factor(ZZ(12))\n1 * 2^2 * 3\n\njulia> factor(UInt(12))\n1 * 2^2 * 3\n\njulia> factor(12)\n1 * 2^2 * 3\n\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"divisor_lenstra(::ZZRingElem, ::ZZRingElem, ::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.divisor_lenstra-Tuple{ZZRingElem, ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.divisor_lenstra","text":"divisor_lenstra(n::ZZRingElem, r::ZZRingElem, m::ZZRingElem)\n\nIf n has a factor which lies in the residue class r (mod m) for 0 r m n, this function returns such a factor. Otherwise it returns 0. This is only efficient if m is at least the cube root of n. We require gcd(r m) = 1 and this condition is not checked.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"factorial(::ZZRingElem)","category":"page"},{"location":"integer/#Base.factorial-Tuple{ZZRingElem}","page":"Integers","title":"Base.factorial","text":"factorial(x::ZZRingElem)\n\nReturn the factorial of x, i.e. x = 123ldots x. We require x geq 0.\n\nExamples\n\njulia> factorial(ZZ(100))\n93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"rising_factorial(::ZZRingElem, ::ZZRingElem)\nrising_factorial(::ZZRingElem, ::Int)\nrising_factorial(::Int, ::Int)","category":"page"},{"location":"integer/#Nemo.rising_factorial-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.rising_factorial","text":"rising_factorial(x::ZZRingElem, n::ZZRingElem)\n\nReturn the rising factorial of x, i.e. x(x + 1)(x + 2)cdots (x + n - 1). If n 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.rising_factorial-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.rising_factorial","text":"rising_factorial(x::ZZRingElem, n::Int)\n\nReturn the rising factorial of x, i.e. x(x + 1)(x + 2)ldots (x + n - 1). If n 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.rising_factorial-Tuple{Int64, Int64}","page":"Integers","title":"Nemo.rising_factorial","text":"rising_factorial(x::Int, n::Int)\n\nReturn the rising factorial of x, i.e. x(x + 1)(x + 2)ldots (x + n - 1). If n 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"primorial(::ZZRingElem)\nprimorial(::Int)","category":"page"},{"location":"integer/#Nemo.primorial-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.primorial","text":"primorial(x::ZZRingElem)\n\nReturn the primorial of x, i.e. the product of all primes less than or equal to x. If x 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.primorial-Tuple{Int64}","page":"Integers","title":"Nemo.primorial","text":"primorial(x::Int)\n\nReturn the primorial of x, i.e. the product of all primes less than or equal to x. If x 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"fibonacci(::Int)\nfibonacci(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.fibonacci-Tuple{Int64}","page":"Integers","title":"Nemo.fibonacci","text":"fibonacci(x::Int)\n\nReturn the x-th Fibonacci number F_x. We define F_1 = 1, F_2 = 1 and F_i + 1 = F_i + F_i - 1 for all integers i.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.fibonacci-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.fibonacci","text":"fibonacci(x::ZZRingElem)\n\nReturn the x-th Fibonacci number F_x. We define F_1 = 1, F_2 = 1 and F_i + 1 = F_i + F_i - 1 for all integers i.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"bell(::ZZRingElem)\nbell(::Int)","category":"page"},{"location":"integer/#Nemo.bell-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.bell","text":"bell(x::ZZRingElem)\n\nReturn the Bell number B_x.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.bell-Tuple{Int64}","page":"Integers","title":"Nemo.bell","text":"bell(x::Int)\n\nReturn the Bell number B_x.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"binomial(::ZZRingElem, ::ZZRingElem)\nbinomial(::UInt, ::UInt, ::ZZRing)","category":"page"},{"location":"integer/#Base.binomial-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Base.binomial","text":"binomial(n::ZZRingElem, k::ZZRingElem)\n\nReturn the binomial coefficient fracn (n-1) cdots (n-k+1)k. If k 0 we return 0, and the identity binomial(n, k) == binomial(n - 1, k - 1) + binomial(n - 1, k) always holds for integers n and k.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Base.binomial-Tuple{UInt64, UInt64, ZZRing}","page":"Integers","title":"Base.binomial","text":"binomial(n::UInt, k::UInt, ::ZZRing)\n\nReturn the binomial coefficient fracn(n - k)k as an ZZRingElem.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"moebius_mu(::Int)\nmoebius_mu(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.moebius_mu-Tuple{Int64}","page":"Integers","title":"Nemo.moebius_mu","text":"moebius_mu(x::Int)\n\nReturn the Moebius mu function of x as an Int. The value returned is either -1, 0 or 1. If x leq 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.moebius_mu-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.moebius_mu","text":"moebius_mu(x::ZZRingElem)\n\nReturn the Moebius mu function of x as an Int. The value returned is either -1, 0 or 1. If x leq 0 we throw a DomainError().\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"jacobi_symbol(::Int, ::Int)\njacobi_symbol(::ZZRingElem, ::ZZRingElem)\nkronecker_symbol(::Int, ::Int)","category":"page"},{"location":"integer/#Nemo.jacobi_symbol-Tuple{Int64, Int64}","page":"Integers","title":"Nemo.jacobi_symbol","text":"jacobi_symbol(x::Int, y::Int)\n\nReturn the value of the Jacobi symbol left(fracxyright). The modulus y must be odd and positive, otherwise a DomainError is thrown.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.jacobi_symbol-Tuple{ZZRingElem, ZZRingElem}","page":"Integers","title":"Nemo.jacobi_symbol","text":"jacobi_symbol(x::ZZRingElem, y::ZZRingElem)\n\nReturn the value of the Jacobi symbol left(fracxyright). The modulus y must be odd and positive, otherwise a DomainError is thrown.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.kronecker_symbol-Tuple{Int64, Int64}","page":"Integers","title":"Nemo.kronecker_symbol","text":"kronecker_symbol(x::ZZRingElem, y::ZZRingElem)\nkronecker_symbol(x::Int, y::Int)\n\nReturn the value of the Kronecker symbol left(fracxyright). The definition is as per Henri Cohen's book, \"A Course in Computational Algebraic Number Theory\", Definition 1.4.8.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"divisor_sigma(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#Nemo.divisor_sigma-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.divisor_sigma","text":"divisor_sigma(x::ZZRingElem, y::Int)\ndivisor_sigma(x::ZZRingElem, y::ZZRingElem)\ndivisor_sigma(x::Int, y::Int)\n\nReturn the value of the sigma function, i.e. sum_0 d x d^y. If x leq 0 or y 0 we throw a DomainError().\n\nExamples\n\njulia> divisor_sigma(ZZ(32), 10)\n1127000493261825\n\njulia> divisor_sigma(ZZ(32), ZZ(10))\n1127000493261825\n\njulia> divisor_sigma(32, 10)\n1127000493261825\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"euler_phi(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.euler_phi-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.euler_phi","text":"euler_phi(x::ZZRingElem)\neuler_phi(x::Int)\n\nReturn the value of the Euler phi function at x, i.e. the number of positive integers up to x (inclusive) that are coprime with x. An exception is raised if x leq 0.\n\nExamples\n\njulia> euler_phi(ZZ(12480))\n3072\n\njulia> euler_phi(12480)\n3072\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"number_of_partitions(::Int)","category":"page"},{"location":"integer/#Nemo.number_of_partitions-Tuple{Int64}","page":"Integers","title":"Nemo.number_of_partitions","text":"number_of_partitions(x::Int)\nnumber_of_partitions(x::ZZRingElem)\n\nReturn the number of partitions of x.\n\nExamples\n\njulia> number_of_partitions(100)\n190569292\n\njulia> number_of_partitions(ZZ(1000))\n24061467864032622473692149727991\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"is_perfect_power(::ZZRingElem)\nNemo.is_prime_power(::ZZRingElem)\nis_prime_power_with_data(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.is_perfect_power-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.is_perfect_power","text":"is_perfect_power(a::IntegerUnion)\n\nReturns whether a is a perfect power, that is, whether a = m^r for some integer m and r 1.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.is_prime_power-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.is_prime_power","text":"is_prime_power(q::IntegerUnion) -> Bool\n\nReturns whether q is a prime power.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.is_prime_power_with_data-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.is_prime_power_with_data","text":"is_prime_power_with_data(q::IntegerUnion) -> Bool, ZZRingElem, Int\n\nReturns a flag indicating whether q is a prime power and integers e p such that q = p^e. If q is a prime power, than p is a prime.\n\n\n\n\n\n","category":"method"},{"location":"integer/#Digits-and-bases","page":"Integers","title":"Digits and bases","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"bin(::ZZRingElem)","category":"page"},{"location":"integer/#Base.bin-Tuple{ZZRingElem}","page":"Integers","title":"Base.bin","text":"bin(n::ZZRingElem)\n\nReturn n as a binary string.\n\nExamples\n\njulia> bin(ZZ(12))\n\"1100\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"oct(::ZZRingElem)","category":"page"},{"location":"integer/#Base.oct-Tuple{ZZRingElem}","page":"Integers","title":"Base.oct","text":"oct(n::ZZRingElem)\n\nReturn n as a octal string.\n\nExamples\n\njulia> oct(ZZ(12))\n\"14\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"dec(::ZZRingElem)","category":"page"},{"location":"integer/#Base.dec-Tuple{ZZRingElem}","page":"Integers","title":"Base.dec","text":"dec(n::ZZRingElem)\n\nReturn n as a decimal string.\n\nExamples\n\njulia> dec(ZZ(12))\n\"12\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"hex(::ZZRingElem)","category":"page"},{"location":"integer/#Base.hex-Tuple{ZZRingElem}","page":"Integers","title":"Base.hex","text":"hex(n::ZZRingElem) = base(n, 16)\n\nReturn n as a hexadecimal string.\n\nExamples\n\njulia> hex(ZZ(12))\n\"c\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"base(::ZZRingElem, ::Integer)","category":"page"},{"location":"integer/#Nemo.base-Tuple{ZZRingElem, Integer}","page":"Integers","title":"Nemo.base","text":"base(n::ZZRingElem, b::Integer)\n\nReturn n as a string in base b. We require 2 leq b leq 62.\n\nExamples\n\njulia> base(ZZ(12), 13)\n\"c\"\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"ndigits(::ZZRingElem, ::Integer)","category":"page"},{"location":"integer/#Base.ndigits-Tuple{ZZRingElem, Integer}","page":"Integers","title":"Base.ndigits","text":"ndigits(x::ZZRingElem, b::Integer)\n\nReturn the number of digits of x in the base b (default is b = 10).\n\nExamples\n\njulia> ndigits(ZZ(12), 3)\n3\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"nbits(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.nbits-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.nbits","text":"nbits(x::ZZRingElem)\n\nReturn the number of binary bits of x. We return zero if x = 0.\n\nExamples\n\njulia> nbits(ZZ(12))\n4\n\n\n\n\n\n","category":"method"},{"location":"integer/#Bit-twiddling","page":"Integers","title":"Bit twiddling","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"popcount(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.popcount-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.popcount","text":"popcount(x::ZZRingElem)\n\nReturn the number of ones in the binary representation of x.\n\nExamples\n\njulia> popcount(ZZ(12))\n2\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"prevpow2(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.prevpow2-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.prevpow2","text":"prevpow2(x::ZZRingElem)\n\nReturn the previous power of 2 up to including x.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"nextpow2(::ZZRingElem)","category":"page"},{"location":"integer/#Nemo.nextpow2-Tuple{ZZRingElem}","page":"Integers","title":"Nemo.nextpow2","text":"nextpow2(x::ZZRingElem)\n\nReturn the next power of 2 that is at least x.\n\nExamples\n\njulia> nextpow2(ZZ(12))\n16\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"trailing_zeros(::ZZRingElem)","category":"page"},{"location":"integer/#Base.trailing_zeros-Tuple{ZZRingElem}","page":"Integers","title":"Base.trailing_zeros","text":"trailing_zeros(x::ZZRingElem)\n\nReturn the number of trailing zeros in the binary representation of x.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"clrbit!(::ZZRingElem, ::Int)\nsetbit!(::ZZRingElem, ::Int)\ncombit!(::ZZRingElem, ::Int)\ntstbit(::ZZRingElem, ::Int)","category":"page"},{"location":"integer/#Nemo.clrbit!-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.clrbit!","text":"clrbit!(x::ZZRingElem, c::Int)\n\nClear bit c of x, where the least significant bit is the 0-th bit. Note that this function modifies its input in-place.\n\nExamples\n\njulia> a = ZZ(12)\n12\n\njulia> clrbit!(a, 3)\n\njulia> a\n4\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.setbit!-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.setbit!","text":"setbit!(x::ZZRingElem, c::Int)\n\nSet bit c of x, where the least significant bit is the 0-th bit. Note that this function modifies its input in-place.\n\nExamples\n\njulia> a = ZZ(12)\n12\n\njulia> setbit!(a, 0)\n\njulia> a\n13\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.combit!-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.combit!","text":"combit!(x::ZZRingElem, c::Int)\n\nComplement bit c of x, where the least significant bit is the 0-th bit. Note that this function modifies its input in-place.\n\nExamples\n\njulia> a = ZZ(12)\n12\n\njulia> combit!(a, 2)\n\njulia> a\n8\n\n\n\n\n\n","category":"method"},{"location":"integer/#Nemo.tstbit-Tuple{ZZRingElem, Int64}","page":"Integers","title":"Nemo.tstbit","text":"tstbit(x::ZZRingElem, c::Int)\n\nReturn bit i of x (numbered from 0) as true for 1 or false for 0.\n\nExamples\n\njulia> a = ZZ(12)\n12\n\njulia> tstbit(a, 0)\nfalse\n\njulia> tstbit(a, 2)\ntrue\n\n\n\n\n\n","category":"method"},{"location":"integer/#Random-generation","page":"Integers","title":"Random generation","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"rand_bits(::ZZRing, ::Int)","category":"page"},{"location":"integer/#Nemo.rand_bits-Tuple{ZZRing, Int64}","page":"Integers","title":"Nemo.rand_bits","text":"rand_bits(::ZZRing, b::Int)\n\nReturn a random signed integer whose absolute value has b bits.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"rand_bits_prime(::ZZRing, ::Int, ::Bool)","category":"page"},{"location":"integer/#Nemo.rand_bits_prime-Tuple{ZZRing, Int64, Bool}","page":"Integers","title":"Nemo.rand_bits_prime","text":"rand_bits_prime(::ZZRing, n::Int, proved::Bool=true)\n\nReturn a random prime number with the given number of bits. If only a probable prime is required, one can pass proved=false.\n\n\n\n\n\n","category":"method"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"a = rand_bits(ZZ, 23)\nb = rand_bits_prime(ZZ, 7)","category":"page"},{"location":"integer/#Complex-Integers","page":"Integers","title":"Complex Integers","text":"","category":"section"},{"location":"integer/","page":"Integers","title":"Integers","text":"The Gaussian integer type in Nemo is provided by a pair of Flint integers. The associated ring of integers and the fraction field can be retrieved by Nemo.GaussianIntegers() and Nemo.GaussianRationals().","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"Examples","category":"page"},{"location":"integer/","page":"Integers","title":"Integers","text":"julia> ZZi = Nemo.GaussianIntegers()\nGaussian integer ring\n\njulia> a = ZZ(5)*im\n5*im\n\njulia> b = ZZi(3, 4)\n3 + 4*im\n\njulia> is_unit(a)\nfalse\n\njulia> factor(a)\nim * (2 - im) * (2 + im)\n\njulia> a//b\n4//5 + 3//5*im\n\njulia> abs2(a//b)\n1","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"CurrentModule = Nemo","category":"page"},{"location":"mpolynomial/#Multivariate-polynomials","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"","category":"section"},{"location":"mpolynomial/#Introduction","page":"Multivariate polynomials","title":"Introduction","text":"","category":"section"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"Nemo allow the creation of sparse, distributed multivariate polynomials over any computable ring R. There are two different kinds of implementation: a generic one for the case where no specific implementation exists (provided by AbstractAlgebra.jl), and efficient implementations of polynomials over numerous specific rings, usually provided by C/C++ libraries.","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"The following table shows each of the polynomial types available in Nemo, the base ring R, and the Julia/Nemo types for that kind of polynomial (the type information is mainly of concern to developers).","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"Base ring Library Element type Parent type\nGeneric ring R AbstractAlgebra.jl Generic.MPoly{T} Generic.MPolyRing{T}\nmathbbZ Flint ZZMPolyRingElem ZZMPolyRing\nmathbbZnmathbbZ (small n) Flint zzModMPolyRingElem zzModMPolyRing\nmathbbQ Flint QQMPolyRingElem QQMPolyRing\nmathbbZpmathbbZ (small prime p) Flint fpMPolyRingElem fpMPolyRing\nmathbbF_p^n (small p) Flint fqPolyRepMPolyRingElem fqPolyRepMPolyRing","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"The string representation of the variables and the base ring R of a generic polynomial is stored in its parent object. ","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"All polynomial element types belong to the abstract type MPolyRingElem and all of the polynomial ring types belong to the abstract type MPolyRing. This enables one to write generic functions that can accept any Nemo multivariate polynomial type.","category":"page"},{"location":"mpolynomial/#Polynomial-functionality","page":"Multivariate polynomials","title":"Polynomial functionality","text":"","category":"section"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"All multivariate polynomial types in Nemo provide the multivariate polynomial functionality described by AbstractAlgebra:","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"https://nemocas.github.io/AbstractAlgebra.jl/stable/mpolynomial","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"Generic multivariate polynomials are also available.","category":"page"},{"location":"mpolynomial/","page":"Multivariate polynomials","title":"Multivariate polynomials","text":"We describe here only functions that are in addition to that guaranteed by AbstractAlgebra.jl, for specific coefficient rings.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"CurrentModule = Nemo\nDocTestFilters = r\"[0-9\\.]+ seconds \\(.*\\)\"\nDocTestSetup = quote\n using Nemo\nend","category":"page"},{"location":"#Getting-Started","page":"Getting Started","title":"Getting Started","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Nemo is a computer algebra package for the Julia programming language, maintained by William Hart, Tommy Hofmann, Claus Fieker, Fredrik Johansson with additional code by Oleksandr Motsak, Marek Kaluba and other contributors.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"https://github.com/Nemocas/Nemo.jl (Source code)\nhttps://nemocas.github.io/Nemo.jl/stable/ (Online documentation)","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"The features of Nemo so far include:","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Multiprecision integers and rationals\nIntegers modulo n\np-adic numbers\nFinite fields (prime and non-prime order)\nNumber field arithmetic\nAlgebraic numbers\nExact real and complex numbers\nArbitrary precision real and complex balls\nUnivariate and multivariate polynomials and matrices over the above","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Nemo depends on AbstractAlgebra.jl which provides Nemo with generic routines for:","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Univariate and multivariate polynomials\nAbsolute and relative power series\nLaurent series\nFraction fields\nResidue rings\nMatrices and linear algebra\nYoung Tableaux\nPermutation groups\nCharacters","category":"page"},{"location":"#Installation","page":"Getting Started","title":"Installation","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"To use Nemo we require Julia 1.6 or higher. Please see https://julialang.org/downloads/ for instructions on how to obtain julia for your system.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"At the Julia prompt simply type","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Pkg; Pkg.add(\"Nemo\")","category":"page"},{"location":"#Quick-start","page":"Getting Started","title":"Quick start","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Here are some examples of using Nemo.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"This example computes recursive univariate polynomials.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Nemo\n\njulia> R, x = polynomial_ring(ZZ, \"x\")\n(Univariate polynomial ring in x over ZZ, x)\n\njulia> S, y = polynomial_ring(R, \"y\")\n(Univariate polynomial ring in y over univariate polynomial ring, y)\n\njulia> T, z = polynomial_ring(S, \"z\")\n(Univariate polynomial ring in z over univariate polynomial ring, z)\n\njulia> f = x + y + z + 1\nz + y + x + 1\n\njulia> p = f^30; # semicolon suppresses output\n\njulia> @time q = p*(p+1);\n 0.161733 seconds (79.42 k allocations: 2.409 MiB)","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Here is an example using generic recursive ring constructions.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Nemo\n\njulia> R, x = FiniteField(7, 11, \"x\")\n(Finite field of degree 11 over GF(7), x)\n\njulia> S, y = polynomial_ring(R, \"y\")\n(Univariate polynomial ring in y over GF(7^11), y)\n\njulia> T = residue_ring(S, y^3 + 3x*y + 1)\nResidue ring of univariate polynomial ring modulo y^3 + 3*x*y + 1\n\njulia> U, z = polynomial_ring(T, \"z\")\n(Univariate polynomial ring in z over residue ring, z)\n\njulia> f = (3y^2 + y + x)*z^2 + ((x + 2)*y^2 + x + 1)*z + 4x*y + 3;\n\njulia> g = (7y^2 - y + 2x + 7)*z^2 + (3y^2 + 4x + 1)*z + (2x + 1)*y + 1;\n\njulia> s = f^12;\n\njulia> t = (s + g)^12;\n\njulia> @time resultant(s, t)\n 0.059095 seconds (391.89 k allocations: 54.851 MiB, 5.22% gc time)\n(x^10 + 4*x^8 + 6*x^7 + 3*x^6 + 4*x^5 + x^4 + 6*x^3 + 5*x^2 + x)*y^2 + (5*x^10 + x^8 + 4*x^7 + 3*x^5 + 5*x^4 + 3*x^3 + x^2 + x + 6)*y + 2*x^10 + 6*x^9 + 5*x^8 + 5*x^7 + x^6 + 6*x^5 + 5*x^4 + 4*x^3 + x + 3","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Here is an example using matrices.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Nemo\n\njulia> R, x = polynomial_ring(ZZ, \"x\")\n(Univariate polynomial ring in x over ZZ, x)\n\njulia> S = matrix_space(R, 40, 40)\nMatrix space of 40 rows and 40 columns\n over univariate polynomial ring in x over ZZ\n\njulia> M = rand(S, 2:2, -20:20);\n\njulia> @time det(M);\n 0.080976 seconds (132.28 k allocations: 23.341 MiB, 4.11% gc time)","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"And here is an example with power series.","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"julia> using Nemo\n\njulia> R, x = QQ[\"x\"]\n(Univariate polynomial ring in x over QQ, x)\n\njulia> S, t = power_series_ring(R, 100, \"t\")\n(Univariate power series ring over univariate polynomial ring, t + O(t^101))\n\njulia> u = t + O(t^100)\nt + O(t^100)\n\njulia> @time divexact((u*exp(x*u)), (exp(u)-1));\n 0.412813 seconds (667.49 k allocations: 33.966 MiB, 90.26% compilation time)","category":"page"},{"location":"#Building-dependencies-from-source","page":"Getting Started","title":"Building dependencies from source","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Nemo depends on various C libraries which are installed using binaries by default. With julia version >= 1.3, the use of these binaries can be overridden by putting the following into the file ~/.julia/artifacts/Overrides.toml:","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"[e134572f-a0d5-539d-bddf-3cad8db41a82]\nFLINT = \"/prefix/for/libflint\"\n\n[d9960996-1013-53c9-9ba4-74a4155039c3]\nArb = \"/prefix/for/libarb\"\n\n[e21ec000-9f72-519e-ba6d-10061e575a27]\nAntic = \"/prefix/for/libantic\"","category":"page"},{"location":"","page":"Getting Started","title":"Getting Started","text":"(If only a specific library should be overridden, only the specific entry should be added.)","category":"page"},{"location":"#Experimental-threading-support-for-flint","page":"Getting Started","title":"Experimental threading support for flint","text":"","category":"section"},{"location":"","page":"Getting Started","title":"Getting Started","text":"Enabling a threaded version of flint can be done by setting the environment variable NEMO_THREADED=1. To set the actual number of threads, use Nemo.flint_set_num_threads($numberofthreads).","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"CurrentModule = Nemo","category":"page"},{"location":"developer/conventions/#Conventions","page":"Conventions","title":"Conventions","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"AbstractAlgebra and Nemo have adopted a number of conventions to help maintain a uniform codebase.","category":"page"},{"location":"developer/conventions/#Code-conventions","page":"Conventions","title":"Code conventions","text":"","category":"section"},{"location":"developer/conventions/#Function-and-type-names","page":"Conventions","title":"Function and type names","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Names of types in Julia follow the convention of CamelCase where the first letter of each word is capitalised, e.g. Int64 and AbstractString.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Function/method names in Julia use all lowercase with underscores between the words, e.g. zip and jacobi_symbol.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We follow these conventions in Nemo with some exceptions:","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"When interfacing C libraries the types use the same spelling and capitalisation in Nemo as they do in C, e.g. the Flint library's ZZPolyRingElem remains uncapitalised in Nemo.\nTypes such as fpPolyRingElem which don't exist under that name on the C side also use the lowercase convention as they wrap an actual C type which must be split into more than one type on the Julia side. For example zzModPolyRingElem and fpPolyRingElem on the Julia side both represent Flint zzModPolyRingElem's on the C side.\nTypes of rings and fields, modules, maps, etc. are capitalised whether they correspond to a C type or not, e.g. fqPolyRepField for the type of an object representing the field that fqPolyRepFieldElem's belong to.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":".","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We omit an underscore if the first word of a method is \"is\" or \"has\", e.g. iseven.\nUnderscores are omitted if the method name is already well established without an underscore in Julia itself, e.g. setindex.\nConstructors with the same name as a type use the same spelling and capitalisation as that type, e.g. ZZRingElem(1).\nFunctions for creating rings, fields, modules, maps, etc. (rather than the elements thereof) use CamelCase, e.g. polynomial_ring. We refer to these functions as parent constructors. Note that we do not follow the Julia convention here, e.g. polynomial_ring is a function and not a type constructor (in fact we often return a tuple consisting of a parent object and other objects such as generators with this type of function) yet we capitalise it.\nWe prefer words to not be abbreviated, e.g. denominator instead of den.\nExceptions always exist where the result would be offensive in any major spoken language (example omitted).","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"It is easy to find counterexamples to virtually all these rules. However we have been making efforts to remove the most egregious cases from our codebase over time. As perfect consistency is not possible, work on this has to at times take a back seat.","category":"page"},{"location":"developer/conventions/#Use-of-ASCII-characters","page":"Conventions","title":"Use of ASCII characters","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"All code and printed output in Nemo should use ASCII characters only. This is because we have developers who are using versions of the WSL that cannot correctly display non-ASCII characters.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"This extends to function and operator names, which saves people having to learn how to enter them to use the system.","category":"page"},{"location":"developer/conventions/#Spacing-and-tabs","page":"Conventions","title":"Spacing and tabs","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"All function bodies and control blocks should be indented using spaces.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"A survey of existing code shows 2, 3 or 4 space indenting commonly used in our files. Values outside this range should not be used.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"When contributing to an existing file, follow the majority convention in that file. Consistency within a file is valued highly.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"If you are new to Nemo development and do not already have a very strong preference, new files should be started with 3 space indenting. This maximises the likelihood that copy and paste between files will be straightforward, though modern editors ease this to some degree.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Function signatures in docstrings should have four spaces before them.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Where possible, line lengths should not exceed 80 characters.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We use a term/factor convention for spacing. This means that all (additive) terms have spaces before and after them, (multiplicative) factors usually do not.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"In practice this means that +, -, =, ==, !=, <, >, <=, >= all have spaces before and after them. The operators *, /, ^ and unary minus do not.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"As per English, commas are followed by a single space in expressions. This applies for example to function arguments and tuples.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We do not put spaces immediately inside or before parentheses.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Colons used for ranges do not have spaces before or after them.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Logical operators, &, |, &&, etc. usually have spaces before and after them.","category":"page"},{"location":"developer/conventions/#Comments","page":"Conventions","title":"Comments","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Despite appearances to the contrary, we now prefer code comments explaining the algorithm as it proceeds.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"The hash when used for a comment should always be followed by a space. Full sentences are preferred.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"We do not generally use comments in Nemo for questions, complaints or proposals for future improvement. These are better off in a ticket on GitHub with a discussion that will be brought to the attention of all relevant parties.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Any (necessary) limitations of the implementation should be noted in docstrings.","category":"page"},{"location":"developer/conventions/#Layout-of-files","page":"Conventions","title":"Layout of files","text":"","category":"section"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"In Nemo, all types are places in special files with the word \"Types\" in their name, e.g. FlintTypes.jl. This is because Julia must be aware of all types before they are used. Separation of types from implementations makes it easy to ensure this happens.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Abstract types should be put in the file called AbstractTypes.jl at the top level of the src directory.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Most implementation files present functions in a particular order, which is as follows:","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"A header stating what the file is for, and if needed, any copyright notices\nFunctions applying to any \"types\" used in the file, e.g. parent_type, elem_type, base_ring, parent, check_parent.\nBasic manipulation, including hashes, predicates, getters/setters, functions for creating special values (e.g. one, zero and the like), deepcopy_internal. These are usually fairly short functions, often a single line.\nIndexing (getindex, setindex), iteration, views.\nString I/O (expressify and file access, etc.)\nArithmetic operations, usually in multiple sections, such as unary operations, binary operations, ad hoc binary operations (e.g. multiplication of a complex object by a scalar), comparisons, ad hoc comparisons, division, etc.\nMore complex functionality separated into sections based on functionality provided, e.g. gcd, interpolation, special functions, solving, etc.\nFunctions for mapping between different types, coercion, changing base ring, etc.\nUnsafe operators, e.g. mul!, add!, addeq! etc.\nRandom generation\nPromotion rules\nParent object call overload (e.g. for implementing R(2) where R is an object representing a ring or field, etc.)\nAdditional constructors, e.g. matrix, which might be used instead of a parent object to construct elements.\nParent object constructors, e.g. polynomial_ring, etc.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"The exact order within the file is less important than generally following something like the above. This aids in finding functions in a file since all files are more or less set out the same way.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"For an example to follow, see the src/Poly.jl and src/generic/Poly.jl files in AbstractAlgebra which form the oldest and most canonical example.","category":"page"},{"location":"developer/conventions/","page":"Conventions","title":"Conventions","text":"Headings for sections should be 80 characters wide and formed of hashes in the style that can be seen in each Nemo file.","category":"page"},{"location":"types/#Types-in-Nemo","page":"Types in Nemo","title":"Types in Nemo","text":"","category":"section"},{"location":"types/","page":"Types in Nemo","title":"Types in Nemo","text":"Nemo is fully compatible with AbstractAlgebra.jl, but specialises implementations of various commonly used rings with a highly optimised C implementation, provided by the C libraries wrapped by Nemo.","category":"page"},{"location":"types/","page":"Types in Nemo","title":"Types in Nemo","text":"Below, we give a list of all of the specialised types available in Nemo that implement rings using a specialised C library. The types of elements of the respective rings and other mathematical structures are given, and in parentheses we list the types of the parent objects of the given rings and structures.","category":"page"},{"location":"types/","page":"Types in Nemo","title":"Types in Nemo","text":"Flint\nZZRingElem (ZZRing)\nQQFieldElem (QQField)\nzzModRingElem (zzModRing)\nZZModRingElem (ZZModRing`)\nfqPolyRepFieldElem (fqPolyRepField)\nfpFieldElem (fpField)\nFpFieldElem (FpField)\nFqPolyRepFieldElem (FqPolyRepField)\npadic (FlintPadicField)\nqadic (FlintQadicField)\nZZPolyRingElem (ZZPolyRing)\nQQPolyRingElem (QQPolyRing)\nzzModPolyRingElem (zzModPolyRing)\nZZModPolyRingElem (ZZModPolyRing)\nFqPolyRepPolyRingElem (FqPolyRepPolyRing)\nfqPolyRepPolyRingElem (fqPolyRepPolyRing)\nZZMPolyRingElem (ZZMPolyRing)\nQQMPolyRingElem (QQMPolyRing)\nzzModMPolyRingElem (zzModMPolyRing)\nfqPolyRepMPolyRingElem (fqPolyRepMPolyRing`)\nfpPolyRingElem (fpPolyRing)\nFpPolyRingElem (FpPolyRing)\nZZRelPowerSeriesRingElem (ZZRelPowerSeriesRing)\nZZAbsPowerSeriesRingElem (ZZAbsPowerSeriesRing)\nQQRelPowerSeriesRingElem (QQRelPowerSeriesRing)\nQQAbsPowerSeriesRingElem (QQAbsPowerSeriesRing)\nZZModRelPowerSeriesRingElem (ZZModRelPowerSeriesRing)\nZZModAbsPowerSeriesRingElem (ZZModAbsPowerSeriesRing)\nzzModRelPowerSeriesRingElem (zzModRelPowerSeriesRing)\nzzModAbsPowerSeriesRingElem (zzModAbsPowerSeriesRing)\nfpRelPowerSeriesRingElem (fpRelPowerSeriesRing)\nfpAbsPowerSeriesRingElem (fpAbsPowerSeriesRing)\nFpRelPowerSeriesRingElem (FpRelPowerSeriesRing)\nFpAbsPowerSeriesRingElem (FpAbsPowerSeriesRing)\nfqPolyRepRelPowerSeriesRingElem (fqPolyRepRelPowerSeriesRing)\nfqPolyRepAbsPowerSeriesRingElem (fqPolyRepAbsPowerSeriesRing)\nFqPolyRepRelPowerSeriesRingElem (FqPolyRepRelPowerSeriesRing)\nFqPolyRepAbsPowerSeriesRingElem (FqPolyRepAbsPowerSeriesRing)\nZZMatrix (ZZMatrixSpace)\nQQMatrix (QQMatrixSpace)\nzzModMatrix (zzModMatrixSpace)\nZZModMatrix (ZZModMatrixSpace`)\nfqPolyRepMatrix (fqPolyRepMatrixSpace)\nFqPolyRepMatrix (FqPolyRepMatrixSpace)\nfpMatrix (fpMatrixSpace)\nperm (SymmetricGroup)\nAntic\nnf_elem (AnticNumberField)\nArb\narb (ArbField)\nacb (AcbField)\narb_poly (ArbPolyRing)\nacb_poly (AcbPolyRing)\narb_mat (ArbMatSpace)\nacb_mat (AcbMatSpace)\nCalcium\nqqbar (CalciumQQBarField)\nca (CalciumField)","category":"page"}] } diff --git a/dev/series/index.html b/dev/series/index.html index f0a41afaa..612ada224 100644 --- a/dev/series/index.html +++ b/dev/series/index.html @@ -24,4 +24,4 @@ z + 2*z^2 + 29//6*z^3 - z^4 + O(z^5) julia> m = atanh(b) -z + 2*z^2 + 16//3*z^3 + 2*z^4 + O(z^5) +z + 2*z^2 + 16//3*z^3 + 2*z^4 + O(z^5) diff --git a/dev/types/index.html b/dev/types/index.html index 936632f02..03104835c 100644 --- a/dev/types/index.html +++ b/dev/types/index.html @@ -1,2 +1,2 @@ -Types in Nemo · Nemo.jl

      Types in Nemo

      Nemo is fully compatible with AbstractAlgebra.jl, but specialises implementations of various commonly used rings with a highly optimised C implementation, provided by the C libraries wrapped by Nemo.

      Below, we give a list of all of the specialised types available in Nemo that implement rings using a specialised C library. The types of elements of the respective rings and other mathematical structures are given, and in parentheses we list the types of the parent objects of the given rings and structures.

      • Flint

        • ZZRingElem (ZZRing)
        • QQFieldElem (QQField)
        • zzModRingElem (zzModRing)
        • ZZModRingElem (ZZModRing`)
        • fqPolyRepFieldElem (fqPolyRepField)
        • fpFieldElem (fpField)
        • FpFieldElem (FpField)
        • FqPolyRepFieldElem (FqPolyRepField)
        • padic (FlintPadicField)
        • qadic (FlintQadicField)
        • ZZPolyRingElem (ZZPolyRing)
        • QQPolyRingElem (QQPolyRing)
        • zzModPolyRingElem (zzModPolyRing)
        • ZZModPolyRingElem (ZZModPolyRing)
        • FqPolyRepPolyRingElem (FqPolyRepPolyRing)
        • fqPolyRepPolyRingElem (fqPolyRepPolyRing)
        • ZZMPolyRingElem (ZZMPolyRing)
        • QQMPolyRingElem (QQMPolyRing)
        • zzModMPolyRingElem (zzModMPolyRing)
        • fqPolyRepMPolyRingElem (fqPolyRepMPolyRing`)
        • fpPolyRingElem (fpPolyRing)
        • FpPolyRingElem (FpPolyRing)
        • ZZRelPowerSeriesRingElem (ZZRelPowerSeriesRing)
        • ZZAbsPowerSeriesRingElem (ZZAbsPowerSeriesRing)
        • QQRelPowerSeriesRingElem (QQRelPowerSeriesRing)
        • QQAbsPowerSeriesRingElem (QQAbsPowerSeriesRing)
        • ZZModRelPowerSeriesRingElem (ZZModRelPowerSeriesRing)
        • ZZModAbsPowerSeriesRingElem (ZZModAbsPowerSeriesRing)
        • zzModRelPowerSeriesRingElem (zzModRelPowerSeriesRing)
        • zzModAbsPowerSeriesRingElem (zzModAbsPowerSeriesRing)
        • fpRelPowerSeriesRingElem (fpRelPowerSeriesRing)
        • fpAbsPowerSeriesRingElem (fpAbsPowerSeriesRing)
        • FpRelPowerSeriesRingElem (FpRelPowerSeriesRing)
        • FpAbsPowerSeriesRingElem (FpAbsPowerSeriesRing)
        • fqPolyRepRelPowerSeriesRingElem (fqPolyRepRelPowerSeriesRing)
        • fqPolyRepAbsPowerSeriesRingElem (fqPolyRepAbsPowerSeriesRing)
        • FqPolyRepRelPowerSeriesRingElem (FqPolyRepRelPowerSeriesRing)
        • FqPolyRepAbsPowerSeriesRingElem (FqPolyRepAbsPowerSeriesRing)
        • ZZMatrix (ZZMatrixSpace)
        • QQMatrix (QQMatrixSpace)
        • zzModMatrix (zzModMatrixSpace)
        • ZZModMatrix (ZZModMatrixSpace`)
        • fqPolyRepMatrix (fqPolyRepMatrixSpace)
        • FqPolyRepMatrix (FqPolyRepMatrixSpace)
        • fpMatrix (fpMatrixSpace)
        • perm (SymmetricGroup)
      • Antic

        • nf_elem (AnticNumberField)
      • Arb

        • arb (ArbField)
        • acb (AcbField)
        • arb_poly (ArbPolyRing)
        • acb_poly (AcbPolyRing)
        • arb_mat (ArbMatSpace)
        • acb_mat (AcbMatSpace)
      • Calcium

        • qqbar (CalciumQQBarField)
        • ca (CalciumField)
      +Types in Nemo · Nemo.jl

      Types in Nemo

      Nemo is fully compatible with AbstractAlgebra.jl, but specialises implementations of various commonly used rings with a highly optimised C implementation, provided by the C libraries wrapped by Nemo.

      Below, we give a list of all of the specialised types available in Nemo that implement rings using a specialised C library. The types of elements of the respective rings and other mathematical structures are given, and in parentheses we list the types of the parent objects of the given rings and structures.

      • Flint

        • ZZRingElem (ZZRing)
        • QQFieldElem (QQField)
        • zzModRingElem (zzModRing)
        • ZZModRingElem (ZZModRing`)
        • fqPolyRepFieldElem (fqPolyRepField)
        • fpFieldElem (fpField)
        • FpFieldElem (FpField)
        • FqPolyRepFieldElem (FqPolyRepField)
        • padic (FlintPadicField)
        • qadic (FlintQadicField)
        • ZZPolyRingElem (ZZPolyRing)
        • QQPolyRingElem (QQPolyRing)
        • zzModPolyRingElem (zzModPolyRing)
        • ZZModPolyRingElem (ZZModPolyRing)
        • FqPolyRepPolyRingElem (FqPolyRepPolyRing)
        • fqPolyRepPolyRingElem (fqPolyRepPolyRing)
        • ZZMPolyRingElem (ZZMPolyRing)
        • QQMPolyRingElem (QQMPolyRing)
        • zzModMPolyRingElem (zzModMPolyRing)
        • fqPolyRepMPolyRingElem (fqPolyRepMPolyRing`)
        • fpPolyRingElem (fpPolyRing)
        • FpPolyRingElem (FpPolyRing)
        • ZZRelPowerSeriesRingElem (ZZRelPowerSeriesRing)
        • ZZAbsPowerSeriesRingElem (ZZAbsPowerSeriesRing)
        • QQRelPowerSeriesRingElem (QQRelPowerSeriesRing)
        • QQAbsPowerSeriesRingElem (QQAbsPowerSeriesRing)
        • ZZModRelPowerSeriesRingElem (ZZModRelPowerSeriesRing)
        • ZZModAbsPowerSeriesRingElem (ZZModAbsPowerSeriesRing)
        • zzModRelPowerSeriesRingElem (zzModRelPowerSeriesRing)
        • zzModAbsPowerSeriesRingElem (zzModAbsPowerSeriesRing)
        • fpRelPowerSeriesRingElem (fpRelPowerSeriesRing)
        • fpAbsPowerSeriesRingElem (fpAbsPowerSeriesRing)
        • FpRelPowerSeriesRingElem (FpRelPowerSeriesRing)
        • FpAbsPowerSeriesRingElem (FpAbsPowerSeriesRing)
        • fqPolyRepRelPowerSeriesRingElem (fqPolyRepRelPowerSeriesRing)
        • fqPolyRepAbsPowerSeriesRingElem (fqPolyRepAbsPowerSeriesRing)
        • FqPolyRepRelPowerSeriesRingElem (FqPolyRepRelPowerSeriesRing)
        • FqPolyRepAbsPowerSeriesRingElem (FqPolyRepAbsPowerSeriesRing)
        • ZZMatrix (ZZMatrixSpace)
        • QQMatrix (QQMatrixSpace)
        • zzModMatrix (zzModMatrixSpace)
        • ZZModMatrix (ZZModMatrixSpace`)
        • fqPolyRepMatrix (fqPolyRepMatrixSpace)
        • FqPolyRepMatrix (FqPolyRepMatrixSpace)
        • fpMatrix (fpMatrixSpace)
        • perm (SymmetricGroup)
      • Antic

        • nf_elem (AnticNumberField)
      • Arb

        • arb (ArbField)
        • acb (AcbField)
        • arb_poly (ArbPolyRing)
        • acb_poly (AcbPolyRing)
        • arb_mat (ArbMatSpace)
        • acb_mat (AcbMatSpace)
      • Calcium

        • qqbar (CalciumQQBarField)
        • ca (CalciumField)