###

### Problem Description

A Taylor series is a technique for estimating
many important functions to any desired degree of
accuracy. Here's a demo program that calculates ** e**^{x}
and **sine(x) ** as Taylor series expansions up to 19 significant digits.

### Background & Techniques

We recently published a Big Float
program which investigates techniques for performing basic arithmetic on
decimal numbers of arbitrary size. This raised the question of
how to emulate the trigonometric, log, and exponential functions available in
the Windows calculator program. The Taylor/Maclaurin power series
provide one answer - such series are probably close to the procedures used by
most hardware and software scientific calculators.

Power series are a topic in all 1st year
Calculus courses; I won't try to explain here how or why they
work. Let's just say that they are polynomials of infinite
length which converge to the true value of the functions which they
approximate. They exist for all functions with nice
smooth graphs without any breaks or square corners (or "continuously
differentiable" as a mathematician would say). Google returns 1.9 million hits for "Taylor
series" so there is no shortage of material for additional
reading. For our purposes, we'll be satisfied to successfully
evaluate a few examples just to see that they do indeed work!

The "Taylor" who loaned his name to the series referenced
here is Brook Taylor, an English
mathematician who developed the technique in the early 1700's and whose
handsome picture appears at the top of this page.

The exponential function, **e**^{x,
}can be expanded as **1 + x**^{2}/2! + x^{3}/3! + x^{4}/4!
+ x^{5}/5! ..... and the **sine** function as
**x - x**^{3}/3! + x^{5}/5! - x^{7}/7! + x^{9}/9! ........ I did not
include the Big Float unit into this program so for now, we'll be
satisfied to evaluate the target functions up the limit of accuracy
of Intel's internal **extended **data type (19 significant digits).

The program calculates the functions
step-by-step, comparing the returned value to Delphi's math library value
at each step.

**Note for programmers: ** While **extended**
data types should be accurate to at least 19 digits, Delphi's **Format**
statement does not seem to want to present more that 18 digits of
precision. A format string of **'%20.18f'** displays fine; **'%21.19f'**
displays only two digits to the right of the decimal
point! If any knows of any documentation about this, please
let me know.

### Running/Exploring the Program