2
$\begingroup$

The task is to estimate $\ln(x)$ using Taylor Polynomial expansion accurate to specified precision. After computing is done, the value compared to the number that WolframAlpha provides to check if the error estimation was made right. for $x \ge 0.5$ every series I try behave as expected, but for $x\le0.5$ there are problems
Expanding around $a=1$ gives below series valid for $x\in(0;2]$ $$\ln(x)=\sum_{n=1}^\infty \frac{(-1)^{n+1}(x-1)^n}{n}$$ Let's say I need to estimate $\ln(0.25)$ so that the absolute error would be $\le0.00005$ (correct to 4 decimal places). WolframAlpha says $\ln(0.25)=-1.38629436...$

I tried this iterative algorithm: https://www.mathworks.com/matlabcentral/answers/uploaded_files/38169/Part%20B.pdf which uses next polynomial term as error bound. Sadly this is not good enough and stops too early so the actual error is bigger than $0.00005$.

I also tried using Lagrange Error Bound as it represented here: http://math.feld.cvut.cz/mt/txte/3/txe4ea3c.htm at the end of the document it says that "on $(0,1/2)$, the Lagrange estimate is too generous." so for my value of $0.25$ taking as many terms as Lagrange Error Bound says, still does no good (I did check that).

So I decided to try this approach: http://math.colorado.edu/~nowi9933/Math2300F17/2300TPRemainderEstimateSol.pdf [page 4, section (d)]

using $\ln(1+x)$ series valid for $|x|\le1$ $$\ln(1+x)=\sum_{n=1}^\infty \frac{(-1)^{n+1}(x)^n}{n}$$ with Lagrange Error Bound $$\frac{(0.25)^{n+1}}{n+1} \le 0.00005$$
Solving it gives $n\ge5$ terms. And this is also not enough as adding 5 terms gives $ln(x)\approx-1.2984375$ last term being $-0.0474609375$
Above calculations were made with a program in python and though IEEE754 floating point format has its flaws its not the problem in the program but in the math part. I'm quiet surprised that there is almost no information regarding that issue on the internet. I understand that one way wolfram must be getting the value is just adding terms as much as it can, but I need some trustworthy error bounding method. Is there some key point I am missing about this?

$\endgroup$
0
$\begingroup$

I would be using instead the expansion $$\log \left(\frac{1-x}{1+x}\right)=-2 \sum_{i=0}^\infty \frac{x^{2n+1}}{2n+1}$$ and make $x=\frac 35$. $$S_p=-2\sum_{i=0}^p \frac{\left(\frac{3}{5}\right)^{2 n+1}}{2 n+1}$$ and compute $$\left( \begin{array}{ccc} p & S_p &\log \left(\frac{1}{4}\right) -S_p \\ 0 & -1.200000000 & -0.186294361 \\ 1 & -1.344000000 & -0.042294361 \\ 2 & -1.375104000 & -0.011190361 \\ 3 & -1.383102171 & -0.003192190 \\ 4 & -1.385341659 & -0.000952702 \\ 5 & -1.386001290 & -0.000293071 \\ 6 & -1.386202224 & -0.000092137 \\ 7 & -1.386264916 & -0.000029446 \\ 8 & -1.386284829 & -0.000009532 \end{array} \right)$$

$\endgroup$
  • $\begingroup$ Can you please elaborate why did you choose these series and why these are better? I must've accented on the Wolfram too much and now edited the question to not be misleading. We do not know the actual value of $\ln(x)$ before computing the polynomial and Wolfram only serves as a standard to verify against that the error estimation was made right. As it turns out comparing next term to the error is enough in case of these series [at least the python program seems to work], is this right, or should I look into Lagrange Remainder? $\endgroup$ – wonderwhy Aug 31 '18 at 13:53
  • $\begingroup$ and could you please show the interval of convergence? $\endgroup$ – wonderwhy Aug 31 '18 at 14:39
0
$\begingroup$

A more efficient technique is to avoid Maclaurin/Taylor series (since they tend to converge slowly if not suitably accelerated) and use Beuker-like integrals instead. You are just interested in a tight approximation for $-2\log 2$, and

$$ \int_{0}^{1}\frac{x^m(1-x)^m}{1+x}\,dx $$ for any $m\in\mathbb{N}$ is a number of the form $q_m \pm 2^m\log(2)$ with $q_m\in\mathbb{Q}$, and also an element of $\left(0,\frac{1}{4^m}\right)$. By choosing $m=6$ we get that $\color{red}{\frac{19519}{21860}}$ is a lower bound for $\log(2)$ within an error $<4\cdot 10^{-6}$ and we are done. Even better, we may consider $$ \int_{0}^{1}\frac{P_6(2x-1)}{x+1}\,dx $$ with $P_n$ being a Legendre polynomial, to derive that $\color{red}{\frac{62307}{89890}}$ is an approximation for $\log(2)$ within an error $<7\cdot 10^{-10}$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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