title: Custom interpolation / minimization function (aka curve fitting) any library
body: <p>I usually work with ROOT and its powerful MINUIT interpolation classes in a C++ environment. For reason related to plotting and ease of data handling, I switched recently to Python 3.8. The problem is that I can't find a library that allows me to set my custom interpolation function (1D by now, multivariate in the future)! <code>Scipy</code> and <code>Pandas</code> have preset <code>methods</code>, and I am not aware of other libraries for interpolation. It seems to me quite impossible, therefore I ask you!</p>
  <p>What I need to reproduce is something that sounds like this in ROOT:</p>
  <p><strong>DEFINITION OF THE INTERPOLATING FUNCTION</strong></p>
  <pre><code>TF1* f3 = new TF1(&quot;PECD6&quot;, &quot;([0]*x + 0.5*[2]*(5*x*x*x-3*x) +0.125*[4]*(63*x*x*x*x*x-70*x*x*x+15*x)) / (1 + 0.5*[1]*(3*x*x-1) + 0.125*[3]*(35*x*x*x*x-30*x*x+3) + 0.0625*[5]*(231*x*x*x*x*x*x-315*x*x*x*x+105*x*x-5)) +1&quot;, -0.9, 0.9);
      f3-&gt;SetParameters(0, 0, 0, 0, 0, 0);
      f3-&gt;SetParLimits(0, -1, 1);
      f3-&gt;SetParLimits(1, -1, 1);
      f3-&gt;SetParLimits(2, -1, 1);
      f3-&gt;SetParLimits(3, -1, 1);
      f3-&gt;SetParLimits(4, -1, 1);
      f3-&gt;SetParLimits(5, -1, 1);
      f3-&gt;SetParNames(&quot;b1&quot;, &quot;b2&quot;, &quot;b3&quot;, &quot;b4&quot;, &quot;b5&quot;, &quot;b6&quot;);
  </code></pre>
  <p>as you can see, I am using Legendre polynomials up to the 6th order and I'd like to receive the coefficient, possibly with propagations of error.</p>
  <p><strong>USE OF THE FUNCTION</strong></p>
  <pre><code>ratio_genarray[rcounter]-&gt;Fit(&quot;PECD6&quot;, &quot;QR&quot;);
  fit1[k] = ratio_genarray[rcounter]-&gt;GetFunction(&quot;PECD6&quot;);
  </code></pre>
  <p>Does anybody have a suggestion?</p>
  <p>Thank you!</p>