title: Minimizing function by changing parameters using scipy
body: <p>I want to minimize the next equation by changing the parameters B0, B1, B2, B3, T1, T2. The variable y just another variable to calculate the objective function.
  I just need help to minimize that function (used as an objective function) by changing the parameters but I can't get the results. I tried with scipy but I did not change the parameters.
  By running the function, I get the result that I want:</p>
  
  <pre><code>funcion_opt(B0, B1, B2, B3, T1, T2)
  output:  64.30571361326217
  </code></pre>
  
  <p>But when I do the minimization, I get the next result:</p>
  
  <pre><code>res = optimize.minimize(funcion_opt, parameters, args=(beta0, beta1, beta2, 
  beta3, tau1, tau2))
  output: funcion_opt() takes 6 positional arguments but 7 were given
  </code></pre>
  
  <p>I know that the mistake is the way to introduce the parameters and there is where I need help. Sorry if it's not clear enough.</p>
  
  <p>Small example of my issue:</p>
  
  <pre><code>y = np.array([98.494500, 97.828500, 97.610000, 97.314000, 97.014500, 
  92.959000, 96.696222])
  def objective(b0, b1, b2, b3, t1, t2):
      return (y * b0 + b1) - ( y * b2 + b3) + t1 + t2
      x0 = np.array([0.03, -0.03, 0, 0, 1, 1]) #Initial values of b0, b1...
      result = minimize(objective, x0, args=(b0, b1, b2, b3, t1, t2))
  </code></pre>
  
  <p>I know that the inputs in the function are wrong, the variables that are constant is y, and I want to change the values of the parameters b0, b1, b2, b3, t1, t2. So the minimize function I need is the one that takes the return of the function and by tuning the parameters, minimizes the error. So maybe the mistake is when setting the objective function.</p>
  
  <p>This is a dummy function, the original one is the sum of square errors.
  After that I need to minimize tat function by changing the values of the parameters inside the return b0, b1, b2, b3, t1, t2 because in the function these parameters are set as. Discount factor is irrelevant I just need how to change the parameters to the ones that minimize the objective function:</p>
  
  <p>When I try to minimize get the output that the error is the same and the parameters did not change.
  Any assistance with this would be much appreciated. Thanks in advance.</p>