title: passing a function with multiple independent variables and multiple arguments to scipy optimize minimize
body: <p>Following <a href="https://stackoverflow.com/q/60386406/4999991">this question</a>, I want to make my question as specific as possible focusing on the part that I can not solve. Consider a very simple function of:</p>
  
  <pre class="lang-py prettyprint-override"><code>def foo(x, y, a, b, c):
      return a * x**4 + b * y**2 + c
  </code></pre>
  
  <p>now I want to use the <code>scipy.optimize.minimize</code> or any of other existing functions to find the <code>x</code> and <code>y</code> (i.e., parameters) to minimize <code>foo</code> given the constants <code>a</code>, <code>b</code>, and <code>c</code> (i.e., args). If I had only one parameter and multiples arguments then from <a href="https://stackoverflow.com/a/43017924/4999991">this page</a> I could do:</p>
  
  <pre class="lang-py prettyprint-override"><code>def foo(x, *args):
      a, b, c = args
      return a * x**4 + b * x**2 + c
  
  # X0 = to some scalar
  # ARGS = a tuple of scalars (A, B, C) 
  
  x_min = scipy.optimize.minimize(foo, x0=X0, args=ARGS)
  </code></pre>
  
  <p>and if I had only independent variables, with no constant args, then from <a href="https://stackoverflow.com/a/13670414/4999991">this page</a> I could do: </p>
  
  <pre class="lang-py prettyprint-override"><code>def foo(*params):
      x, y = params
      return 4 * x**4 + 2 * y**2 + 1
  
  # P0 = to a list of scalars [X0, Y0] 
  
  x_min = scipy.optimize.minimize(foo, x0=P0)
  </code></pre>
  
  <p>However, I can not use any of the above syntaxes. I believe I have to define my function as something like:</p>
  
  <pre class="lang-py prettyprint-override"><code>def foo(*args, **kwargs):
      x, y = args
      a, b, c = tuple(kwargs.values())
      return a * x**4 + b * y**2 + c
  </code></pre>
  
  <p>but then I don't know how to pass <code>args</code> and <code>kwargs</code> to the <code>scipy.optimize</code> functions. I would appreciate if you could help me understand what is the best way to define the <code>foo</code> function with multiple independent parameters and constant arguments to <code>scipy.optimize</code> functions. Thanks for your support in advance.</p>