Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 10 submissions in the queue.
Journal by day of the dalek

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.

 

Reply to: Re:I finally figured out successive approximation!

    (Score: 0) by Anonymous Coward on Thursday September 05, @06:11AM

    by Anonymous Coward on Thursday September 05, @06:11AM (#1371329)

    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.

Post Comment

Edit Comment You are not logged in. You can log in now using the convenient form below, or Create an Account, or post as Anonymous Coward.

Public Terminal

Anonymous Coward [ Create an Account ]

Use the Preview Button! Check those URLs!


Logged-in users aren't forced to preview their comments. Create an Account!

Allowed HTML
<b|i|p|br|a|ol|ul|li|dl|dt|dd|em|strong|tt|blockquote|div|ecode|quote|sup|sub|abbr|sarc|sarcasm|user|spoiler|del>

URLs
<URL:http://example.com/> will auto-link a URL

Important Stuff

  • Please try to keep posts on topic.
  • Try to reply to other people's comments instead of starting new threads.
  • Read other people's messages before posting your own to avoid simply duplicating what has already been said.
  • Use a clear subject that describes what your message is about.
  • Offtopic, Inflammatory, Inappropriate, Illegal, or Offensive comments might be moderated. (You can read everything, even moderated posts, by adjusting your threshold on the User Preferences Page)
  • If you want replies to your comments sent to you, consider logging in or creating an account.

If you are having a problem with accounts or comment posting, please yell for help.