# Curve Fitting using known Points [closed]

In this answer, David Stork said that my question could be solved using "simple curve fitting with different numbers of even polynomial rank" in Mathematica. How would I do that (an equation that goes through all of the points), the points I'm using are : $$(\pm\sqrt{3},0),(\pm5,11)$$

• Fit[{{-Sqrt[3],0},{Sqrt[3],0},{-5,11},{5,11}}, {1, x^2, x^4, x^6}, x] A fourth-order polynomial is the simplest even-order polynomial that is guaranteed to go through four points. Higher-order are also (obviously) guaranteed to do that. Apr 18, 2019 at 21:50
• Is there a way to just get an equation that would go through all of those points of any number of terms or degrees without you specifying the degree or number of terms. Apr 19, 2019 at 2:23
• Huh? You need four degrees of freedom to fit four points. If you have more degrees, you have multiple ways to fit the given four points. There is no "single equation" as you seem to imply. Apr 19, 2019 at 3:53
• Oh, so for a degree n function, you need n points. Ok Apr 19, 2019 at 14:44
• Actually, $n-1$. Think of two points. What polynomial is guaranteed to fit those? Now think of three points... get it? Apr 19, 2019 at 17:15

Some examples:

data = {{-Sqrt[3], 0}, {Sqrt[3], 0}, {-5, 11}, {5, 11}};

f[x_] = Fit[data, {1, x^2}, x]
(* -1.5 + 0.5 x^2 *)

f[x_] = Fit[data, {x^2, x^4}, x]
(* -0.06 x^2 + 0.02 x^4 *)

f[x_] = Fit[data, {x^-4, x^12}, x]
(* -0.000295612/x^4 + 4.5056*10^-8 x^12 *)

f[x_] = Fit[data, {Cos[x], Cosh[x]}, x]
(* 2.51619 Cos[x] + 0.13861 Cosh[x] *)

f[x_] = Fit[data, {1, Exp[x], Sin[x], 1/x}, x]
(* -0.449683 + 0.154288 E^x - 15.5852/x + 8.68848 Sin[x] *)


You just have to pick two symmetric (or four unsymmetric) functions to fit to your data.

• Thank you so much! Apr 18, 2019 at 21:03