Taylor Series Approximation: Squaring and Scaling

137 Views Asked by At

This was seen from a numerical analysis text/reference. enter image description here

There is a vague statement here: square the result repeatedly. The scaling is rather clear: divide by 2 until $|x|<1$. How about the squaring? I tried squaring the result by the number of times I scaled, and the result was way off.

Have you seen any proof or justification to this technique?

thanks

1

There are 1 best solutions below

0
On BEST ANSWER

Seems to be working for me. Just make sure you follow the directions exactly. The first sixteen terms of the Taylor expansion are $e^x=1+x+\frac{x^2}{2!}+...+\frac{x^{15}}{15!}$. So write $e^{30}$ as $(e^{30/2^5})^{2^5}$, because $2^5$ is the smallest power of 2 that makes the exponent less in absolute value than 1. Do the Taylor expansion for $e^{30/2^5}$, and then raise the result to the power of $2^5$. It matches $e^{30}$. I also tried $\exp -3$ and it worked.

taylor=function(x){
  sum=1
  for (i in 1:15) {
    sum=sum+x^i/factorial(i)
  }
  return(sum)
}

-out

> taylor(30/2^5)^(2^5)
[1] 1.068647e+13
> exp(30)
[1] 1.068647e+13
> taylor(-3/2^2)^(2^2)
[1] 0.04978707
> exp(-3)
[1] 0.04978707