home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / prog / ks94an.arj / __LOG.HDR < prev    next >
Text File  |  1994-04-24  |  3KB  |  87 lines

  1. /******************************************************************************
  2.                  The Klipper Library, for CA-Clipper 5.x
  3.         Copyright (c), 1994, Wallace Information Systems Engineering
  4.  
  5. FUNCTION:
  6.  
  7. _Logr(nNumber, nBase) --> nLog
  8.  
  9. PARAMETERS:
  10.  
  11. nNumber : number for which to derive logorithm
  12. nBase   : Log base (DEFAULT: Common Logarithm (Base 10))
  13.  
  14. SHORT:
  15.  
  16. Solve for any base log (not just the common log as Clipper's Log() does).
  17.  
  18. DESCRIPTION:
  19.  
  20. _Logr() is a logarithm function that solves for more than just the Common
  21. Log.  Any base can be specified.
  22.  
  23. _Logr() determines the logarithm of the given number in the given log base.
  24.  If nBase is not specified, _Log() calculates the Common Logarithm of
  25. the given number (base 10).
  26.  
  27. The accuracy is calculated far beyond most calculator's 8 decimal places,
  28. and greater than the accuracy obtained by using the natural log
  29. (Clipper's LOG()) multiplied by .4343.  Checking for peak accuracy at
  30. 8 decimal places is really more time consuming than simply letting the
  31. thing calculate the remaining digits.  You get the added precision to boot.
  32.  
  33. _Logr() will handle fractional logs (ie, _Logr(.00613))
  34.  
  35. Clipper's LOG() function returns the Natural Log of a number not it's
  36. Common Log.  For base 10 logs, you can quickly calculate the Common Log of
  37. any number by multiplying the Natural Log by .4343, however _Logr() will
  38. yield greater accuracy.
  39.  
  40. If you need the Natural Logarithm, use Clipper's LOG() function. If you need
  41. the Common Log, it is probably quicker to use the Clipper (log()*.4343).  If
  42. you have logs with variable bases, this is the one.
  43.  
  44.  
  45. The results from _Logr(n,10) can be converted to natural log by multiplying
  46. by 2.3026.
  47.  
  48. NOTE:
  49.  
  50. Do not confuse the Common Log with the Natural Log.
  51.  
  52. DISCUSSION: For those of you new to logarithms:
  53.  
  54. Logs are strange.  You are asked to find the question for a given answer.
  55. Not unlike playing Jeopardy!  In a Log, the givens are: The base of the log
  56. (n - which if not specified is 10 [or the common logarithm] by default)
  57. which will be used as the number being raised to some power.
  58.  
  59. If Log(10) x, then the equation is going to contain 10 ^(some power)
  60.  
  61. Exactly WHAT power is dependant on the given number (x).  This second given
  62. is the number that is the end result of raising the base of the log (n) to
  63. the "some power".  So what we are solving for is "what power?"
  64.  
  65. Stated: Solve for the exponent of the base of the log that results in
  66. the given number.
  67.  
  68. Simple, right?
  69.  
  70. Stated again:  The base (n) of the log raised to what power equals the
  71. given number (x)?
  72.  
  73. EXAMPLE:
  74.  
  75. ? _Logr(256)    // 2.408239965
  76. ? _Logr(256,10) // 2.408239965
  77. ? _Logr(256,2)  // 8.000000000
  78. ? _Logr(256,5)  // 3.445412465
  79. ? _Logr(256,9)  // 2.523719014
  80.  
  81. In the above examples, higher precision can be displayed by using a picture
  82. of some sort:
  83.  
  84. TRANSFORM(_Logr(256),'99.999999999999')
  85.  
  86. ******************************************************************************/
  87.