title: Using lambda to change minimize_scalar to maximize in Python
body: <p>I'm trying to maximize a (scalar) function in Python using scipy.minimize_scalar. Thought it would be more elegant to use lambda instead of defining a new function that's the negative of the given function. Unfortunately, it's giving a TypeError. Here's a simple example:</p>
  <pre><code>from scipy.optimize import minimize_scalar
  
  def square(x):
      return -(x-1)**2
  
  print(minimize_scalar(lambda x:-square(x),bounds=(0,None),method='bounded'))
  </code></pre>
  <p>Here's the error message I get:</p>
  <pre><code>TypeError: '&gt;' not supported between instances of 'int' and 'NoneType'
  </code></pre>
  <p>What's wrong with this example code?</p>
  <p>Thanks</p>