For an analytical solution simply run
max( 0.4 / sqrt(1+x^2) - sqrt(1+x^2) * (1 - 0.4 / (1+x^2)) + x) on Wolfram Alpha (or a similar expression in any symbolical language, even Matlab provides a symbolic toolbox). An analytical solution should always be preferred, if applicable.
But I suppose you are interested in a purely numerical approach?
For an analytical solution simply run max( 0.4 / sqrt(1+x^2) - sqrt(1+x^2) * (1 - 0.4 / (1+x^2)) + x) on Wolfram Alpha (or a similar expression in any symbolical language, even Matlab provides a symbolic toolbox). An analytical solution should always be preferred, if applicable.
But I suppose you are interested in a purely numerical approach?
So, let us at first define the function (inline):
Plot it (play with the range) to get an impression on it:
The function seems to have a global optimum somewhere near to 1. So now negate it
to make it compatible with the built-in numerical minimization functions. Now just minimize fneg. For example by:
where 1 is passed as starting position for the local search. Take a look at
Alternatively use
in order to search for a minimum in the interval [0,2]. The result is x=1.0519, which also matches the result at Wolfram Alpha.