4
$\begingroup$

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?

$\endgroup$
  • 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
9
$\begingroup$

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
| improve this answer | |
$\endgroup$

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