This journal is available for random discussion topics of interest to the community, with just a few rules:
1) No personal attacks, grumbling about site policy, or complaining about other users and the staff.
2) No racism, bigotry, or culture wars of any kind.
3) No politics of any kind. There are plenty of other places to discuss this topic. Policy discussion is okay, though, as long as it focuses on the issues instead of people or parties. Be sure to follow rule #2 here.
4) No random spamming. If you're an member of the site who intends to regularly contribute and participate, and you wish to discuss your personal projects, that's fine. If you're a drive-by spammer who's here just to promote your business or hosts file software, get lost.
5) Please be kind to each other.
Otherwise, you're welcome to discuss anything you'd like in this journal.
(Score: 0) by Anonymous Coward on Thursday September 05, @06:11AM
For those that don't know, that's not how successive approximation works. You are supposed to start with the general value and work your way towards the specific value. You can do that with a number of algorithms. There are ones that work specifically for different operations in better than worse case. However, what I really wanted to do was to inform everyone of my favorite one using the Farey Tree.
So to calculate answer to your operation you start with your lower and upper bound for your operation. You find the new of bounds with four steps. First, match fractions as a/c and b/d. Second, find the mediant ((a+b) / (c+d)). Third, test if your new fraction is higher or lower than the answer you seek. Finally, replace the respective bounds. Then keep going until the desired precision is reached or you get tired of waiting.
So for the square root of 2. The bounds of square root are 1 and the operand, 1/1 and 2/1. Calculate the mediant ((1+2)/(1+1)) == 3/2. 3/2 squared is 9/4 and is higher than 2 so the original fraction is higher than the square root of 2. So you replace the high bound. The bounds are now 1/1 and 3/2. The new mediant is 4/3rds. 4/3 squared is 16 / 9, which is lower than 2, so the lower bound is replaced and they are now 4/3 and 3/2. Keep going until you are close enough.
I like this one because I find it easier to understand and do than many of the alternatives. Yes, it often approaches worst case performance, but I find the ability to understand it, do it in my head quickly, and to start anywhere worth the trade off.