I need to find the maximiser and the maximum of functions that have a narrow bump. I had some issues with numerics, so I decided to try my luck with intervals.
Here is a minimal working (?) example:
using IntervalArithmetic, IntervalOptimisation
f(x) = exp(1/x)/(x^2*(1 + exp(1/x))^2)
maximise(f, 0..∞)
This results to
([0.439228, ∞], Interval{Float64}[[0, 0.000655297], [0.000655296, 0.00132092], [0.00132091, 0.00198653], [0.415145, 0.415866], [0.414436, 0.415146], [0.413728, 0.414437], [0.412322, 0.413031], [0.417947, 0.418656], [0.41303, 0.413729], [0.416551, 0.41725] … [0.389124, 0.389822], [0.442803, 0.443524], [0.388426, 0.389125], [0.443523, 0.444255], [0.387739, 0.388427], [0.444254, 0.444964], [0.387031, 0.38774], [0.444963, 0.445683], [0.445682, 0.446403], [0.386333, 0.387032]])
The interval maximum that it gives has the actual maximum as lower bound, but the upper bound is infinity. However, the main problem is that it gives me 88 maximasers.
For reference the function looks like that
I also tried to invert the argument, hoping that this would make things better
using IntervalArithmetic, IntervalOptimisation
f(x) = 2*exp(x)*x^2/(1 + exp(x))^2
maximise(f, 0..∞)
but I waited 10 minutes and killed the process.
Does anyone have any insight on what’s happening here and how I can get the maximiser?
EDIT: I realised that but restricting the upper bound of the starting interval it gives me the maximum. So I have calculated a crude upper bound. The problem is that I get a huge list of maximisers (it grows longer with lower tolerance). Here’s a minimal working example:
using IntervalArithmetic, IntervalOptimisation
f(x) = exp(x)*x^2/(1 + exp(x))^2
maximise(f, 0..4)
This gives me
([0.439228, 0.440029], Interval{Float64}[[2.39909, 2.4001], [2.3981, 2.3991], [2.39614, 2.39714], [2.40401, 2.40501], [2.39223, 2.39323], [2.40597, 2.40698], [2.40697, 2.40797], [2.39713, 2.39811], [2.40205, 2.40304], [2.39516, 2.39615] … [2.31803, 2.31903], [2.45531, 2.45582], [2.31705, 2.31804], [2.48043, 2.48136], [2.45581, 2.45633], [2.31607, 2.31706], [2.48135, 2.48229], [2.45928, 2.45979], [2.45978, 2.4603], [2.48228, 2.48322]])
EDIT: Calling wrong package fixed.