Reference

Index

DedekindCutArithmetic.DedekindCut — Type

Representation of a real number $x$ as a dedekind cut.

Fields

  • low : function approximating the number from below. Evaluates to true for every number $< x$.
  • high : function approximating the number from above. Evaluates to true for every number $> x$.
  • mpa : Cached most precise approximation computed so far. This is a dyadic interval bound $x$ which is updated every time the cut is refined to a higher precision.
source
DedekindCutArithmetic.DyadicInterval — Type

Represents an interval with lower and uppper bound expressed as dyadic numbers. Note this is a generalized interval, that is, the lower bound can be greater than the upper bound.

source
DedekindCutArithmetic.RationalCauchyCut — Type

This represents a dyadic interval [(m-1)/2^e, (m+1)/2^e] approximating a non-dyadic rational number.

This is a special-case of Dedekind cut representing a rational number for which we do not need iterative refinement

source
DedekindCutArithmetic.make_prec — Method

Given precision p and interval i, compute a precision which is better than p and is suitable for working with intervals of width i.

Taken from: https://github.com/andrejbauer/marshall/blob/c9f1f6466e879e8db11a12b9bc030e62b07d8bd2/src/eval.ml#L22-L26

source
DedekindCutArithmetic.refine! — Method

Refine the given cut to give an approximation with precision bits of accuracy. If the required accuracy cannot be achieved within max_iter iterations, return the current estimate with a warning.

source
DedekindCutArithmetic.@cut — Macro

Macro to construct a DedekindCut.

A cut is defined using the following syntax

@cut x ∈ [a, b], low, high

This defines a real number $x$ in the interval $[a, b]$ which is approximated by the inequality $φ(x)$ from below and $ψ(x)$ from above.

$φ$ and $ψ$ can be any julia expression, also referring to variables in the scope where the macro is called.

Similarly, $a$ and $b$ can also be julia expressions, but they cannot depend on $x$.

source
DedekindCutArithmetic.@exact_str — Macro

Parse a decimal literal into an exact real

julia> a = exact"0.1"
[0.099999999999999867, 0.10000000000000009]

julia> refine!(a; precision = 80)
[0.099999999999999992, 0.10000000000000001]

This is needed because literals are already parsed before constructing the AST, hence when writing :(x - 0.1) one would get the floating point approximation of 1//10 instead of the exact rational.

source