home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #23 / NN_1992_23.iso / spool / sci / math / 13317 < prev    next >
Encoding:
Text File  |  1992-10-16  |  1.8 KB  |  45 lines

  1. Newsgroups: sci.math
  2. Path: sparky!uunet!news.univie.ac.at!chx400!ira.uka.de!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!sgiblab!daver!cylink!tedh
  3. From: tedh@cylink.COM (Ted Hadley)
  4. Subject: Real -> fraction algorithm needed
  5. Message-ID: <1992Oct16.171046.13025@cylink.COM>
  6. Sender: tedh@cylink.COM (Ted Hadley)
  7. Organization: Cylink Corp.
  8. Date: Fri, 16 Oct 92 17:10:46 GMT
  9. Lines: 34
  10.  
  11. Greetings. I need an algorithm which I can code in 'C' which performs the
  12. following task. This, I feel, is the best place to ask. If this is a common
  13. request, please skip the details and cite a reference. Much appreciated. Here
  14. goes:
  15.  
  16. Part 1: General case:
  17.  
  18. Given an real number X, compute to integers A and B such that A/B most
  19. closely approximate X
  20.  
  21. Part 2: First constraint:
  22.  
  23. Repeat (1) such that the error, defined as the fractional part of A/(BX), is
  24. within a certain bound (say +/- E) AND A and B are minimized (i.e., the
  25. smallest possible values which produce a quotient with acceptible error).
  26.  
  27. Part 3: Second contraint: (this is the preferred form)
  28.  
  29. Given X, E, and Amax and Bmax, where Amax and Bmax are the maximum allowable
  30. integers for A and B, respectively, compute all values of A and B for which
  31. the error E is acceptible. For example: |A| < Amax and |B| < Bmax and some
  32. value for E, list all possible {A, B} for which |fract(A/(BX))| < E.
  33.  
  34.  
  35. ANY information is appreciated. I am not, however, a mathematician, and my
  36. math skills are quite rusty. I have no idea how to approach the problem in
  37. order to derive my own solution.
  38.  
  39. Please E-mail responses. If there are other requests, I will post the
  40. responses. Thanks again.
  41. -- 
  42. Ted A. Hadley  tedh@cylink.COM         "Credo qvia absvrdvm est" -- Tertullian
  43. Cylink Corporation, 310 N. Mary Ave., Sunnyvale, CA 94086  USA    408-735-5847
  44. All opinions expressed are my own, and probably not liked by my employer.
  45.