1
$\begingroup$

I have a sequence of numbers such as {1,2,4,8,16}

The goal is to create a polynomial f(x) such that:

f(0)=1, f(1)=2, f(2)=4, f(n)=nth item on the list

I found this function which claims to do exactly that

But I cant seem to get it coded right on Mathematica.

enter image description here

Which for my sequence should give

enter image description here

and f(5)=31

$\endgroup$
1
3
$\begingroup$

Why not use InterpolatingPolynomial? For your example:

Expand @ InterpolatingPolynomial[
    {{0, 1}, {1, 2}, {2, 4}, {3, 8}, {4, 16}},
    x
]

1 + (7 x)/12 + (11 x^2)/24 - x^3/12 + x^4/24

$\endgroup$

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