Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @monotone to declare monotone interval functions #198

Open
dpsanders opened this issue Jan 31, 2017 · 7 comments
Open

Add @monotone to declare monotone interval functions #198

dpsanders opened this issue Jan 31, 2017 · 7 comments

Comments

@dpsanders
Copy link
Member

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

cf. #191

@dpsanders
Copy link
Member Author

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
Copy link
Member

lbenet commented Jan 31, 2017

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
Copy link
Member

lbenet commented Jan 31, 2017

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
Copy link
Member

lbenet commented Jan 31, 2017

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

@dpsanders
Copy link
Member Author

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
Copy link
Member Author

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

@Kolaru
Copy link

Kolaru commented Nov 27, 2018

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:

  • clampto: The result is clamped to this interval. Useful if the image set of the function is known.
  • relerr: Allows to give a relative error. The resulting interval is expanded by that factor to take in account the fact that the function may not be computed with machine precision (untested).
  • singularities: If given, the domain is cut at each singularity, so functions that are monotonic on well defined domains can be extended as well (need some work to separate the case in which the singularity is exactly representable as a floating point).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants