1
$\begingroup$

I know Mathematica has the FindFit function to determine the parameters of a known function that fits a sequence of points, but what if you do not know the relationship (linear, log, quadratic, etc)?

For example, if I have two lists of values:

x={1, 3, 5, 11}
y={1, 9, 25, 121}

Is there a way Mathematica can automatically figure out that y=x^2 ?

$\endgroup$
  • $\begingroup$ x = Table[2 i + 1, {i, 10}]; y = x^2; FindSequenceFunction[Transpose[{x, y}], n] // Simplify $\endgroup$ – Dr. belisarius Oct 1 '15 at 20:02
  • $\begingroup$ But FindSequenceFunction[ ] doesn't guess very well ... $\endgroup$ – Dr. belisarius Oct 1 '15 at 20:03
6
$\begingroup$

FindFormuala is EXPERIMENTAL and new in v10.2

Clear[x, y];

xData = {1, 3, 5, 11};
yData = {1, 9, 25, 121};

y[x_] = FindFormula[Transpose[{xData, yData}], x]

(*  x^2  *)
$\endgroup$
4
$\begingroup$

Try the following:

data = Transpose[{x, y}];
FindFormula[data, z]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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