>>> from math import sin >>> def f(x): return x**2-sin(x) >>> extremum(f,0,1,0.0000001,"min") 0.45018357038497925 >>> def f(x): return -x**2-sin(x) >>> extremum(f,-1,0,0.0000001,"max") -0.450183629989624