title: Minimizing the cost function for function that takes multiple arrays as inputs in Python
body: <p>I have some function that takes in 4 1-D arrays as input and returns a single 1-D array as output.</p>
  
  <pre><code>def func(arr1,arr2,arr3,arr4):
      #function guts
      return answer
  </code></pre>
  
  <p>I am trying to get the output array of this function to match a pre-known correct array answer. I have made a cost function that can compare the function output to the actual answer, and give me a value representing how close it is (a lower number is better)</p>
  
  <pre><code>def cost_function(guess, real_answer):
     #function guts
     return cost      #lower number means guess is close to real answer
  </code></pre>
  
  <p>I would like a way to find the best values to use for the original input arrays to get close to the real answer. Presumably this will use the SciPy optimization package, but I am unsure where to start.</p>