Define a function when you are given a graph with points (0,3),(2,5),(10,4),(6,2)
-2
$\begingroup$
$\endgroup$
-
$\begingroup$ Is this about Wolfram Mathematica? $\endgroup$ – Kuba♦ May 16 at 10:23
1
$\begingroup$
$\endgroup$
You can use FindFormula
:
list = {{0, 3}, {2, 5}, {10, 4}, {6, 2}};
ClearAll[f]
f = FindFormula[list];
f[x]
$ 3. + 2.12083 x - 0.65 x^2 + 0.0447917 x^3$
f /@ list[[All, 1]]
{3., 5., 4., 2.}
Alternatively, you can use Interpolation
:
ClearAll[f2]
f2 = Interpolation[list];
f2 /@ list[[All, 1]]
{3, 5, 4, 2}