title: Gnuplot behaves oddly in polynomial fit. Why is that?
body: <p>A friend of mine discovered some odd behavior in gnuplot regarding a simple polynomial fit Can sombody explain this?</p>
  
  <p>Here is the file:</p>
  
  <pre><code>#!/usr/bin/gnuplot -p
  
  f(x) = B*(x**4) + A
  fit f(x) "data.txt" using ($1+273.14):2 via A, B
  
  plot    "data.txt" using ($1+273.14):2 notitle,\
          f(x) notitle
  </code></pre>
  
  <p>The data is: </p>
  
  <pre><code># content of data.txt
  350 3.856
  330 3.242
  290 2.391
  250 1.713
  210 1.181
  170 0.763
  130 0.437
  </code></pre>
  
  <p>The resulting plot is the green line. The blue line shows a far better fit using another function of basically the same form. For the green line A was replaced by a constant value (A = 0.2123 which is about B*300^4)</p>
  
  <p><img src="https://i.stack.imgur.com/CZ8tN.png" alt="odd fitting behavior gnuplot"></p>
  
  <p>So the green line is clearly not the best fit here since <code>f(x) = B*(x**4) - 0.2123</code> yields far betterresults and is also of the form B*x<strong>4 + A. In the green fit the parameter **A is simply ignored by gnuplot</strong> and remains unchanged by the fitting algorithm. Setting different initial values for A and B doesn't seem to help much - the value of A never changes for its inital value. My friend and I are using the standard Gnuplot version that comes with Ubuntu: gnuplot 4.4 patchlevel 3.</p>