0

So I managed to solve this problem by simply taking the Maclaurin series of sin(7x), which was

$$\sum_{n=0}^∞ \frac{(-1)^n(7x)^{2n+1}}{(2n+1)!}$$

and divided the summation by x, which gave me

$$\sum_{n=0}^∞ \frac{(-1)^n(7x)^{2n}}{(2n+1)!}$$

I integrated this and got $$\sum_{n=0}^∞ \frac{(-1)^n(7x)^{2n+1}}{(2n+1)(2n+1)!}$$ and set the bounds from 0 to 1. I plugged in 1 to get

$$\sum_{n=0}^∞ \frac{(-1)^n(7)^{2n+1}}{(2n+1)(2n+1)!}$$

Now, this is where my problem came in. I managed to use a calculator to figure out what the series converges to. However, I want to know how to solve this by finding the number of terms needed to find the sum. How can one find the number of terms necessary to get this sum?

Raffaele
  • 26,371

2 Answers2

1

In an alternating series the error is less than the absolute value of the first term neglected. Thus to compute the value with four decimal places, we must make an error less than $10^{-4}$ $$s=\sum_{n=0}^{\infty} \frac{(-1)^n\,7^{2n+1}}{(2n+1)(2n+1)!}$$ This means finding an index $n$ such that $$\frac{7^{2n+1}}{(2n+1)(2n+1)!}\le 10^{-4}\to n=11$$

Raffaele
  • 26,371
1

There is a formula which will give you in advance the numbers to be added before computing anything.

Let us make the problem more general $$\sum_{n=0}^\infty (-1)^n\frac{a^{2n+1}}{(2n+1)(2n+1)!}=$$ $$\sum_{n=0}^p (-1)^n\frac{a^{2n+1}}{(2n+1)(2n+1)!}+\sum_{n=p+1}^\infty (-1)^n\frac{a^{2n+1}}{(2n+1)(2n+1)!}$$ and then, you want to know $p$ such that the first neglected term be smaller or equal to $10^{-k}$; that is to say $$R_p=\frac{a^{2p+3}}{(2p+3)(2p+3)!} \leq 10^{-k}\implies(2p+3)(2p+3)! \geq a^{2p+3}\,10^{k}$$

Taking logarithms, solve for $p$ the equation $$\log(2p+3)+\log\big[ (2p+3)!\big] - (2p+3)\log(a)-k\log(10)=0$$ and later, wa shall use $\lceil p\rceil$.

For the time being, let $m=2p+3$; using Stirling approximation and continuing with Taylor series, the above write $$m (\log (m)-\log (e a))+\frac{3 }{2}\log (m)+ \log (\sqrt{2 \pi} )-k \log(10)+O\left(\frac{1}{m}\right)=0$$ which can be solved only if we neglect the $\frac{3 }{2}\log (m)$ term (this means that the solution would be a slight overestimate of the solution. So, the approximation $$m=2p+3 \sim \frac{2 k \log (10)-\log (2 \pi )}{2 W\left(\frac{2 k \log (10)-\log (2 \pi )}{2 e a}\right)}$$ where $W(.)$ is Lambert function.

Applied to your case $a=7$ and $k=4$, this gives $p=11.5664$; if the $\frac{3 }{2}\log (m)$ term was kept, the solution would have been $p=9.68912$.

Checking with your numbers $$R_{9}=5.21 \times 10^{-4} \qquad R_{10}=4.60 \times 10^{-5} \qquad R_{11}=3.46 \times 10^{-6}$$

But, since we had to enter the beautiful world of Lambert function, we could do much better assuming $(2p+3)(2p+3)! \sim (2p+4)!$ and write the equation as $$(2p+4)!=a^{2p+4} \frac {10^k} a$$ Now, have a look at this question of mine and admire the approximation proposed by @robjohn. Adapted to your problem, this would give $$m=2p+4 \sim e\,a \, \exp\Bigg[W\left(\frac{2 k \log (10)-\log \left(2 \pi a^3\right)}{2 e a}\right) \Bigg]-\frac 12$$

Applied to your case, this would give $p=9.66906$ then $\lceil p\rceil=10$.

Suppose now that you want $100$ decimal places; this gives immediately $\lceil p\rceil=59$.

Checking $$R_{58}=5.56 \times 10^{-99} > 10^{-100} \qquad R_{59}=1.84 \times 10^{-101} < 10^{-100}$$