4
$\begingroup$

I know that, sequence has formula $f(n) = \dfrac{1}{2^n}$ satifying the conditions $f(1)=\dfrac{1}{2}$, $f(2)=\dfrac{1}{4}$, $f(3)=\dfrac{1}{8}$, $f(4)=\dfrac{1}{16}$. Now I am trying to find a polynominal that also satisfies these conditions.

f[x_] = a x^3 + b x^2 + c x + d;
Solve[{f[1] == 1/2, f[2] == 1/4, f[3] == 1/8, f[4] == 1/16 }, {a, b, 
  c, d}]

{{a -> -(1/96), b -> 1/8, c -> -(53/96), d -> 15/16}}

With more conditions, $f(1)=\dfrac{1}{2}$, $f(2)=\dfrac{1}{4}$, $f(3)=\dfrac{1}{8}$, $f(4)=\dfrac{1}{16}$, $\ldots$, $f(10)=\dfrac{1}{2^{10}}$. How can I make a polynomial without solving a system of equations?

$\endgroup$
1
  • $\begingroup$ I can't correct the typo because an edit must be at least 6 characters. I think the last expression before ". How can" should begin with f(10), not f(4). $\endgroup$
    – dougp
    Nov 29, 2023 at 23:01

1 Answer 1

7
$\begingroup$
InterpolatingPolynomial[Table[{i, 2^-i}, {i, 4}], x] // Expand
(*    15/16 - 53 x/96 + x^2/8 - x^3/96    *)

InterpolatingPolynomial[Table[{i, 2^-i}, {i, 10}], x] // Expand
(*    1023/1024 - 254437 x/368640 + 348803 x^2/1474560 -
      2458693 x^3/46448640 + 5561 x^4/655360 - 17653 x^5/17694720 +
      83 x^6/983040 - 43 x^7/8847360 + x^8/5898240 - x^9/371589120    *)

The $i$-values of the data points are actually the default assumed values, and so we can code-golf this last example down:

InterpolatingPolynomial[2^-Range[10], x] // Expand
(*    1023/1024 - 254437 x/368640 + 348803 x^2/1474560 -
      2458693 x^3/46448640 + 5561 x^4/655360 - 17653 x^5/17694720 +
      83 x^6/983040 - 43 x^7/8847360 + x^8/5898240 - x^9/371589120    *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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