JuliaIntervals / ValidatedNumerics.jl

Rigorous floating-point calculations with interval arithmetic in Julia
Other
85 stars 17 forks source link

Add `@monotone` to declare monotone interval functions #198

Open dpsanders opened 7 years ago

dpsanders commented 7 years ago

This could be used both in the package and in user code.

cf. #191

dpsanders commented 7 years ago

There would need to be two: one with outward rounding (e.g. for exp) and the other with no rounding (e.g. for sign, ceil etc.).

lbenet commented 7 years ago

The idea would be that @monotone f(I), with I and interval, returns directly Interval(f(I.lo),f(I.hi)) or Interval(f(I.hi),f(I.lo)), depending which makes sense (only one of them makes sense, unless the function is constant). Nice idea!

lbenet commented 7 years ago

The only thing I would be worried is how to react when f is not monotonic. (If you use @inbounds out of range, you get an error.)

Another issue is how to extend it to DecoratedIntervals; the issue is subtle, since you may have a truly monotonic but not continuous function in I, so a com decoration should be transformed into trv...

lbenet commented 7 years ago

I guess with try ... catch... and directed rounding would be enough. Yet, so far I see no way for the decorations...

dpsanders commented 7 years ago

I actually meant to define the function in the first place. Maybe it's not necessary to have a macro, just generate the code. I agree that for decorated intervals with sign etc. it still has to be done by hand, or else provide a function that calculates where the discontinuities are.

dpsanders commented 7 years ago

Closing this as it's not clear what to actually do.

Kolaru commented 5 years ago

As I needed interval extension of both the zeta Riemann function (monotone for real argument greater than 1) and the polylogarithm (which is monotone in each of its argument), I implemented something very similar to what is proposed.

The current implementation can be found here and an example of use here.

This implementation is not ready for publication though, as it is mainly untested and over typed. But I am willing to improve it and make it available either by integrating it in IntervalArithmetic.jl or as a separate package.

To tell more about what it does, it defines a macro @monotone that define a new method for all possible combinations of real and interval arguments of a function (it works on multi dimensional function provided it is monotone argumentwise). For example for the polylogarithm polylog(s, z) it defines

polylog(s::Interval, z)
polylog(s, z::Interval)
polylog(s::Interval, z::Interval)

For each argument a domain must be given and the monotonicity of the function is determined automatically by computing the value of the function on the boundary of the domain.

Optionnal arguments are: