1
$\begingroup$

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)$

$\endgroup$

closed as off-topic by MarcoB, Henrik Schumacher, bbgodfrey, garej, Coolwater May 9 at 17:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Henrik Schumacher, bbgodfrey, garej, Coolwater
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ 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. $\endgroup$ – David G. Stork Apr 18 at 21:50
  • 1
    $\begingroup$ 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. $\endgroup$ – Quote Dave Apr 19 at 2:23
  • $\begingroup$ 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. $\endgroup$ – David G. Stork Apr 19 at 3:53
  • $\begingroup$ Oh, so for a degree n function, you need n points. Ok $\endgroup$ – Quote Dave Apr 19 at 14:44
  • 1
    $\begingroup$ Actually, $n-1$. Think of two points. What polynomial is guaranteed to fit those? Now think of three points... get it? $\endgroup$ – David G. Stork Apr 19 at 17:15
4
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Thank you so much! $\endgroup$ – Quote Dave Apr 18 at 21:03

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