Formulas of the form (1+epsilon)-1

  • Thread starter Thread starter Twixtfanatic
  • Start date Start date
  • Tags Tags
    Form Formulas
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
1 reply · 3K views
Twixtfanatic
Messages
2
Reaction score
0
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.
 
Physics news on Phys.org
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.