Info | Documentation | Build status | Contributing |
---|---|---|---|
|
|
A Julia library for exact real arithmetic using Dedekind cuts and Abstract Stone Duality. Heavily inspired by the Marshall programming language.
-
If you haven't already, install Julia. The easiest way is to install Juliaup. This allows to easily install and manage Julia versions.
-
Open the terminal and start a Julia session by typing
julia
. -
Install the library by typing
using Pkg; Pkg.add("DedekindCutArithmetic")
-
The package can now be loaded (in the interactive REPL or in a script file) with the command
using DedekindCutArithmetic
-
That's it, have fun!
The following snippet shows how to define the square root of a number and the maximum of a function
using DedekindCutArithmetic
# Textbook example of dedekind cuts, define square-root
my_sqrt(a) = @cut x ∈ ℝ, (x < 0) ∨ (x * x < a), (x > 0) ∧ (x * x > a)
# lazy computation, however it is automatically evaluated to 53 bits of precision if printed in the REPL.
sqrt2 = my_sqrt(2);
# evaluate to 80 bits precision, this gives an interval with width <2⁻⁸⁰ containing √2
refine!(sqrt2; precision=80)
# [1.4142135623730949, 1.4142135623730951]
# Define maximum of a function f: [0, 1] → ℝ as a Dedekind cut
my_max(f::Function) = @cut a ∈ ℝ, ∃(x ∈ [0, 1] : f(x) > a), ∀(x ∈ [0, 1] : f(x) < a)
f = x -> x * (1 - x)
fmax = my_max(f);
refine!(fmax) # evaluate to 53 bits of precision by default
# [0.24999999999999992, 0.25000000000000006]
- STABLE: Documentation of the latest release
- DEV: Documentation of the in-development version on main
A good starting point is the beginner tutorial
Contributions are welcome! Here is a small decision tree with useful links. More details in the contributor's guide.
-
There is a discussion section on GitHub. You can use the helpdesk category to ask for help on how to use the software or the show and tell category to simply share with the world your work using DedekindCutArithmetic.jl
-
If you find a bug or want to suggest a new feature, open an issue.
-
You are also encouraged to send pull requests (PRs). For small changes, it is ok to open a PR directly. For bigger changes, it is advisable to discuss it in an issue first. Before opening a PR, make sure to check the developer's guide.
- Copyright (c) 2024 Luca Ferranti, released under MIT license