# Arblib.jl

Hello everyone! Iβm pleased to announce the release of Arblib.jl version 1.0.0! Arblib.jl is a wrapper of Arb, a library for rigorous, arbitrary precision, numerics based on ball arithmetic. Since a few months back Arb is a part of FLINT, before it was a separate library.

The goal of Arblib.jl is supply a low lever wrapper of the methods in Arb, as well as a high level interface. The low level wrapper should allow for writing methods using mutability, and with performance very close to that of those written in C. The high level interface should make it easy to use in generic Julia code, similarly to how `BigFloat`

is a wrapper around the MPFR library. In addition, it should be possible to seamlessly switch between the high level interface and the low level wrapper when needed.

There are already multiple other wrappers for Arb, including Nemo and ArbNumerics.jl. Compared to both of these Arblib.jl has a stronger focus on mutability and the low level wrapper. The high level interface of Nemo is also mostly focused on the AbstractAlgebra.jl universe.

Version 0.1.0 of the package was released in October 2020, so it has been a long time in the making!

## Examples

Some examples of the high level interface:

```
julia> using Arblib, SpecialFunctions
julia> sin(Arb(1)) + exp(Acb(5, 4))^2 # Some elementary functions
[-3204.01004684383875410045781564841032005656259070096652381237542043151155723 +/- 3.31e-72] + [21792.06557805986636823313294686313092865354316154564677314220247182417305111 +/- 4.65e-72]im
julia> besselj(Arb(Ο), Arb(1 // 2)) # Some special functions
[0.00175952799476796625069318818831373840939006931720588178138608727360903797650 +/- 5.61e-78]
julia> Arblib.integrate(sin, 0, 10) # Integrate sin from 0 to 10
[1.83907152907645245225886394782406483451993016513316854683595373104879258687 +/- 5.15e-75]
julia> Arblib.integrate(z -> 1/z, Acb(1, -5), Acb(1, 5)) # Integrate 1/z from 1 - 5i to 1 + 5i
[+/- 2.02e-75] + [2.74680153389003172172254385288992229730199919179940161793956671182574846633 +/- 2.83e-75]im
```

Compare computing \sqrt{x^2 + y^2} using mutable arithmetic with the default.

```
julia> using Arblib, BenchmarkTools
julia> x = Arb(1 // 3)
[0.33333333333333333333333333333333333333333333333333333333333333333333333333333 +/- 4.78e-78]
julia> y = Arb(1 // 5)
[0.20000000000000000000000000000000000000000000000000000000000000000000000000000 +/- 3.89e-78]
julia> res = zero(x)
0
julia> f(x, y) = sqrt(x^2 + y^2)
f (generic function with 1 method)
julia> f!(res, x, y) = begin
Arblib.sqr!(res, x)
Arblib.fma!(res, res, y, y)
return Arblib.sqrt!(res, res)
end
f! (generic function with 1 method)
julia> @benchmark f($x, $y) samples=10000 evals=500
BenchmarkTools.Trial: 6390 samples with 500 evaluations.
Range (min β¦ max): 624.406 ns β¦ 379.276 ΞΌs β GC (min β¦ max): 0.00% β¦ 83.71%
Time (median): 814.207 ns β GC (median): 0.00%
Time (mean Β± Ο): 1.552 ΞΌs Β± 10.335 ΞΌs β GC (mean Β± Ο): 22.72% Β± 3.46%
ββββββ
βββββββββββ
β
β
ββββββββββββββββββββββββββββββββββββββββββββββββ β
624 ns Histogram: frequency by time 2.96 ΞΌs <
Memory estimate: 448 bytes, allocs estimate: 8.
julia> @benchmark f!($res, $x, $y) samples=10000 evals=500
BenchmarkTools.Trial: 10000 samples with 500 evaluations.
Range (min β¦ max): 371.404 ns β¦ 12.993 ΞΌs β GC (min β¦ max): 0.00% β¦ 0.00%
Time (median): 462.204 ns β GC (median): 0.00%
Time (mean Β± Ο): 499.765 ns Β± 309.469 ns β GC (mean Β± Ο): 0.00% Β± 0.00%
ββ
β
ββββββ β
βββββββββββββββββ
β
β
ββββββββββββββββββββββββββββββββββββββββββ β
371 ns Histogram: frequency by time 952 ns <
Memory estimate: 0 bytes, allocs estimate: 0.
```