From 56e043a1b25f07b59e86be10e7652735d15fa742 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Fri, 14 Jul 2023 04:50:28 +0000 Subject: [PATCH] build based on 45d8783 --- dev/about/index.html | 2 +- dev/acb/index.html | 18 ++++---- dev/algebraic/index.html | 12 +++--- dev/arb/index.html | 22 +++++----- dev/complex/index.html | 18 ++++---- dev/constructors/index.html | 2 +- dev/developer/conventions/index.html | 2 +- dev/developer/future/index.html | 2 +- dev/developer/interfaces/index.html | 2 +- dev/developer/introduction/index.html | 2 +- dev/developer/parents/index.html | 2 +- dev/developer/topics/index.html | 2 +- dev/developer/typesystem/index.html | 2 +- dev/exact/index.html | 8 ++-- dev/factor/index.html | 2 +- dev/ff_embedding/index.html | 6 +-- dev/finitefield/index.html | 12 +++--- dev/fraction/index.html | 24 +++++------ dev/gfp/index.html | 2 +- dev/index.html | 2 +- dev/integer/index.html | 62 +++++++++++++-------------- dev/matrix/index.html | 34 +++++++-------- dev/misc/index.html | 2 +- dev/mpolynomial/index.html | 2 +- dev/numberfield/index.html | 12 +++--- dev/padic/index.html | 10 ++--- dev/polynomial/index.html | 18 ++++---- dev/puiseux/index.html | 4 +- dev/qadic/index.html | 10 ++--- dev/rational/index.html | 2 +- dev/real/index.html | 24 +++++------ dev/residue/index.html | 4 +- dev/search/index.html | 2 +- dev/series/index.html | 2 +- dev/types/index.html | 2 +- 35 files changed, 167 insertions(+), 167 deletions(-) diff --git a/dev/about/index.html b/dev/about/index.html index 542529e36..32aa0a3c2 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 5783f883f..78b9d4284 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 cfb094f7d..86b9a869a 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 4ac5fb302..6e2f6c234 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 736a0a5d0..473e7a650 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 b5e6be1d1..c071b393e 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 1f5179f8d..511e81769 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 c6eccb71b..7e4d0c143 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 486d70ade..898c3a406 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 1b64748e8..2d80a658e 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 04cc7efa9..1313ac26c 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 c6ad86aae..33cdd6772 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 c0488c18b..e05b31ded 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 201999bb4..7de5a0b0d 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 ad4403cfc..28aae1323 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 65cae2b2d..2f80ea167 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 d46e01a56..43835ea20 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

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
diff --git a/dev/fraction/index.html b/dev/fraction/index.html index 083240a31..08d4f0cef 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.

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.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.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 f53765ab8..24712652c 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 be75f5122..73238b70c 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 ecafabcb7..21023442b 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 0ffc2c8e5..35f0fc308 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 b4cd891b5..3015bf780 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 53f8c6ad1..ac9f6609c 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 942929e2a..25ea41f41 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 dace2921f..9d652f98e 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)
@@ -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::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)
 
 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 2df12041d..f73ae5530 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 b6b149edb..4aeb999f9 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
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 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 66f7e638b..43d9e385e 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)
@@ -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::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);
 
 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 262412885..cdc0095a8 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 9d1bd137b..4ab1a3c9b 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
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
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
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
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
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
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(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
rand([rng=GLOBAL_RNG,] G::SymmetricGroup)

Return a random permutation from G.

Examples

RR = RealField()
+8717442233//2774848045
source

Random generation

Base.randMethod
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
rand([rng=GLOBAL_RNG,] G::SymmetricGroup)

Return a random permutation from G.

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 23dc7f2a2..23412acb6 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 d45055a6b..fc3c04dc1 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/series/index.html b/dev/series/index.html index 4bf8f05ed..3b1b82ed0 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 bd401924a..3d6d08fcd 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)