Scipy minimize a scalar with Brent method throws an Overflow 34
Question: I'd like to find a local minimum of the function `f(x) = x^3 + x^2 + x - 2`
where `x` is between `<-10; 10>`. I use Anaconda 3 on Windows 64bit.

My scipy python code throws an error:

    
    
    from scipy import optimize
    def f(x):
        return (x**3)+(x**2)+x-2
    x_min = optimize.minimize_scalar(f, bounds=[-10, 10], method='brent')
    

> OverflowError: (34, 'Result too large')

Isn't a power to 3 too simple function to break a scipy optimization package?


Answer: When using local boundaries, changing `method` to `'bounded'` is required

    
    
    from scipy import optimize
    def f(x):
        return (x**3)+(x**2)+x-2
    x_min = optimize.minimize_scalar(f, bounds=[-10, 10], method='bounded')
    print(x_min)
    

