I have a polynomial expression of order n (say n=20). F(x)=1+x+x^2+x^3++...x^20.

I want to approximate the polynomial for order 3 only. So I need to make the coefficient of power of x greater than 3 to zero. How can I do that in Mathematica?


closed as off-topic by user9660, Edmund, Kuba, ubpdqn, Öskå May 28 '16 at 10:56

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

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Community, Edmund, Kuba, ubpdqn, Öskå
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ Try Series[1 + x + x^2 + x^3 + x^20, {x, 0, 5}] // Normal. $\endgroup$ – b.gates.you.know.what Jul 16 '13 at 10:35
  • 1
    $\begingroup$ You question in not clear. The approximation theory is a vast subject. But if you want only to delete powers greater than 3, I'd do it this F[x] /. x^k_ /; k > 3 :> 0 having defined e.g. F[x_] = Total[x^Range[0, 20]];. $\endgroup$ – Artes Jul 16 '13 at 10:36
  • 1
    $\begingroup$ Over what range do you need the approximation to be accurate? Simply truncating the polynomial, $1 + x + x^2 + x^3 + x^20$ leaves you with approx. a $10\%$ error at $x=1$. It quickly falls below machine precision ($10^{-16}$) on my machine at $x \approx 0.16$. However, if you need a more uniform error, you should look at expanding it in terms of Chebyshev polynomials. $\endgroup$ – rcollyer Jul 16 '13 at 12:58

A simple possibility is this:

 1 + x + x^2 + x^3 + x^4 + x^20 // Function[y, Normal[y + O[x]^4]]

which results in

1 + x + x^2 + x^3

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