Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Formulas of the form (1+epsilon)-1

  1. Aug 16, 2013 #1
    I was fooling around with spreadsheet formulas, and created a series of rational approximations for the square root of 3: 7/4, 26/15, 97/56 etc. This is based on the continued fraction expansion for square roots. Each ratio N/D has the property that N^2 is one more than 3*(D^2)=K. I was curious to see how the error values behave. The straightforward formula ((N/D)/sqrt(3))-1 works fine for the first few entries, but eventually turns into zero, as the string of zeroes between the 1. and the epsilon exceeds the storage capacity for floating point numbers. Alternately, the simpler formula 1/(2K) becomes more and more accurate, but is inaccurate for the first few entries. So, my workaround is to use a conditional formula which uses one expression or the other, based on the magnitude of K. But I'm not sure how much accuracy I really get this way for a range of "middle" values. I'm not sure where the cutoff point should be for a given floating point standard.

    I tried to express epsilon in a way that could be calculated more accurately, so far without success. Could someone point me to a (hopefully free) resource that addresses these basic numerical analysis issues? General or specific help would be welcome. Thanks for your time.
  2. jcsd
  3. Aug 17, 2013 #2

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    The transition point is roughly ##1/K=\sqrt{\epsilon}##, where epsilon is the machine epsilon for the data type at hand. Machine epsilon for some data type (e.g., float, double, long double) is defined as the smallest positive number ##\epsilon## such that ##(1.0+\epsilon)-1.0## is not zero.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Formulas of the form (1+epsilon)-1