Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Unless they've discovered a better way to do it, I believe that approximate values for trig, logarithmic and exponential functions (for exponential growth and decay, for example) are generally calculated using arithmetic rules and <strong>Taylor Series</strong> expansions to produce an approximate result accurate to within the requested precision. (See any Calculus book for details on power series, Taylor series, and Maclaurin series expansions of functions.) Please note that it's been a while since I did any of this so I couldn't tell you, for example, exactly how to calculate the number of terms in the series you need to include guarantee an error that small enough to be negligible in a double-precision calculation.</p> <p>For example, the Taylor/Maclaurin series expansion for e^x is this:</p> <pre><code> +inf [ x^k ] x^2 x^3 x^4 x^5 e^x = SUM [ --- ] = 1 + x + --- + ----- + ------- + --------- + .... k=0 [ k! ] 2*1 3*2*1 4*3*2*1 5*4*3*2*1 </code></pre> <p>If you take all of the terms (k from 0 to infinity), this expansion is exact and complete (no error).</p> <p>However, if you don't take all the terms going to infinity, but you stop after say 5 terms or 50 terms or whatever, you produce an <strong>approximate</strong> result that differs from the actual e^x function value by a remainder which is fairly easy to calculate.</p> <p>The good news for exponentials is that it converges nicely and the terms of its polynomial expansion are fairly easy to code iteratively, so you <strong>might</strong> (repeat, <strong>MIGHT</strong> - remember, it's been a while) not even need to pre-calculate how many terms you need to guarantee your error is less than precision because you can test the size of the contribution at each iteration and stop when it becomes close enough to zero. In practice, I do not know if this strategy is viable or not - I'd have to try it. There are important details I have long since forgotten about. Stuff like: machine precision, machine error and rounding error, etc.</p> <p>Also, please note that if you are not using e^x, but you are doing growth/decay with another base like 2^x or 10^x, the approximating polynomial function changes. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload