Post Reply 
Small Solver Program
02-25-2019, 11:00 PM (This post was last modified: 02-25-2019 11:18 PM by Thomas Klemm.)
Post: #25
RE: Small Solver Program
(02-25-2019 08:39 PM)Csaba Tizedes Wrote:  Not really, because in my idea no needed to bracket the root.

There's nothing wrong with a digit-by-digit algorithm.
However after the first change of sign you already bracket the root.

So let's assume that this interval has length \(I\).
And we want to bring it down to a small value, say \(\epsilon\).

Digit-by-digit method

With each digit we divide the interval by 10.
After \(k\) digits we end up with:

\(\epsilon=\frac{I}{10^k}\)

Thus \(k=\frac{\log I - \log \epsilon}{\log 10}\).
But on average we need 5 steps until we can decide on the digit.
All in all we use about \(\frac{5}{\log 10}(\log I - \log \epsilon)\) steps.

Binary search

We divide the interval consecutively by 2.
After \(k\) bisections we end up with:

\(\epsilon=\frac{I}{2^k}\)

Thus \(k=\frac{\log I - \log \epsilon}{\log 2}\).
We only need 1 step to decide which interval to keep.
All in all we use \(\frac{1}{\log 2}(\log I - \log \epsilon)\) steps.

Conclusion

Now compare \(\frac{5}{\log 10} \approx 2.1715\) with \(\frac{1}{\log 2} \approx 1.4427\) to see that the binary search is about \(1.5051\) times faster than the digit-by-digit method.

The only advantage to use a digit-by-digit method is when calculating the function value of the next step can be done easier based on the function values of the previous steps.
Therefore, it's used in calculating the square root or the trigonometric functions (CORDIC).

However, I do not see any way to do this with an arbitrary function like the one given in the video:

\(f(x)=\left (\frac{e \ln(\pi)}{\ln(x)} \right )^x-e^\pi\)

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Small Solver Program - Gamo - 02-14-2019, 05:25 AM
RE: Small Solver Program - Thomas Klemm - 02-14-2019, 07:06 AM
RE: Small Solver Program - Albert Chan - 02-15-2019, 12:07 AM
RE: Small Solver Program - Thomas Klemm - 02-15-2019, 06:26 PM
RE: Small Solver Program - Albert Chan - 02-15-2019, 09:16 PM
RE: Small Solver Program - Thomas Klemm - 02-16-2019, 03:58 AM
RE: Small Solver Program - Albert Chan - 11-03-2019, 03:14 PM
RE: Small Solver Program - Albert Chan - 11-10-2019, 07:02 PM
RE: Small Solver Program - Albert Chan - 12-01-2019, 12:13 AM
RE: Small Solver Program - Csaba Tizedes - 02-16-2019, 12:24 PM
RE: Small Solver Program - Thomas Klemm - 02-16-2019, 01:42 PM
RE: Small Solver Program - Csaba Tizedes - 02-16-2019, 03:24 PM
RE: Small Solver Program - Gamo - 02-17-2019, 02:57 AM
RE: Small Solver Program - Thomas Klemm - 02-17-2019, 09:06 AM
RE: Small Solver Program - Gamo - 02-17-2019, 02:33 PM
RE: Small Solver Program - Thomas Klemm - 02-17-2019, 04:57 PM
RE: Small Solver Program - Gamo - 02-18-2019, 03:49 AM
RE: Small Solver Program - Thomas Klemm - 02-18-2019, 05:20 AM
RE: Small Solver Program - Dieter - 02-18-2019, 07:46 PM
RE: Small Solver Program - Thomas Klemm - 02-18-2019, 10:22 PM
RE: Small Solver Program - Albert Chan - 02-19-2019, 01:10 AM
RE: Small Solver Program - Csaba Tizedes - 02-19-2019, 08:39 AM
RE: Small Solver Program - Thomas Klemm - 02-20-2019, 05:31 AM
RE: Small Solver Program - Csaba Tizedes - 02-25-2019, 08:39 PM
RE: Small Solver Program - Thomas Klemm - 02-20-2019, 07:22 AM
RE: Small Solver Program - Thomas Klemm - 02-24-2019, 09:21 AM
RE: Small Solver Program - Thomas Klemm - 02-25-2019 11:00 PM
RE: Small Solver Program - Albert Chan - 01-04-2020, 07:49 PM



User(s) browsing this thread: 1 Guest(s)