I'm attempting to fit the positive domain part of an odd polynomial to even polynomials using the Fit function, and I get incredibly tiny coefficients that are clearly wrong. Now, I've read the "possible issues" section of the documentation that mentions this exact problem, and I have attempted the solution they advise (shifting and scaling your basis set), to no avail. Is there any recourse within Mathematica? I've tried the other fitting functions, with similar results.

Fit[Transpose[{Table[i^3, {i, 0, 10, 0.01}], Range[0, 10, 0.01]}], {x^2, x^4, x^6}, x]

(* Out: (0.0000714209) x^2 + (-1.5437*10^-10) x^4 + (9.69696*10^-17) x^6 *)
  • 6
    $\begingroup$ You're trying to approximate something with a vertical tangent at the origin with the monomial basis. Such things don't end well. $\endgroup$ – J. M.'s discontentment Aug 15 '17 at 14:42
  • $\begingroup$ I'm voting to close this question as off-topic because the issue it raises is not really a Mathematica issue but a matter of the OP not having grasped the mathematics involved. $\endgroup$ – m_goldberg Aug 18 '17 at 16:28
  • $\begingroup$ I'm in favor of closing it as off topic since it was a simple mistake (and I got my answer anyway), but it was a syntax error. I understand the math just fine. $\endgroup$ – Qaziz Aug 19 '17 at 21:00


If you're trying to fit $x^3$ with $a x^2 + b x^4 + c x^6$, with your current setup you're fitting the range rather then function. i.e. you're submitting: {{f[x[1]], x[1]},...} when you want to supply: {{ x[1], f[x[1]]},...}


Fit[Table[{i, i^3}, {i, 0, 10, 1/100}], {x^2, x^4, x^6}, x]


If you're really trying to fit $x^{1/3}$ (not technically an odd polynomial), as J.M. points out in his comment, you won't get there with $a x^2 + b x^4 + c x^6$. You can try: $a x^{1/2} + b x^{1/4} + c x^{1/6}$:

soln= Fit[Table[{i^3, i}, {i, 0, 10, 1/100}], {x^(1/2), x^(1/4), x^(1/6)}, x]

Landing on:

-0.88736 x^(1/6) + 1.80165 x^(1/4) + 0.0853975 Sqrt[x]


with deviation plot:


| improve this answer | |
  • 2
    $\begingroup$ Actually, if he's trying to approximate the cube root function, then that's the right table. His choice of approximation method is another kettle of fish altogether. $\endgroup$ – J. M.'s discontentment Aug 15 '17 at 14:49
  • $\begingroup$ All the same, this seems to have solved my problem. I flipped the values! Thanks, both of you. $\endgroup$ – Qaziz Aug 15 '17 at 14:53
  • $\begingroup$ He said odd polynomial so I assumed he was trying to fit $x^3$ with $a x^2 + b x^4 + c x^6$. $\endgroup$ – John Joseph M. Carrasco Aug 15 '17 at 14:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.