# User manual | Chapter 8 Families of Functions - Mathematical Sciences Computing

```Chapter 8
Families of Functions
One very important area of real analysis is the study of the properties of real valued
functions. We introduced the general properties of functions earlier in Chapter 6. In
this chapter we want to look at specific functions and families of functions to see what
properties really belong to the area of analysis separate from algebra or topology. We
will take on the functions in a somewhat orderly manner.
8.1
Polynomials
The polynomials in the study of functions play a similar role to the integers in our
study of numbers. They are our basic building blocks. Likewise, when we really start
looking at the family of polynomials most of the questions we have are really algebraic
in nature and not analytic, just like the study of integers.
In general a polynomial is an expression in which a finite number of constants
and variables are combined using only addition, subtraction, multiplication, and nonnegative whole number exponents (raising to a power).
A polynomial function is a function defined by evaluating a polynomial. For
example, the function f defined by f (x) = x3 −x is a polynomial function. Polynomial
functions are an important class of smooth functions — smooth meaning that they
are infinitely differentiable, i.e., they have derivatives of all finite orders.
Because of their simple structure, polynomials are easy to evaluate, and are used
extensively in numerical analysis for polynomial interpolation or to numerically integrate more complex functions. Computationally, they require only multiplication and
addition. Any division is division of coefficients and subtraction is just the addition
Polynomials have a number of nice properties.
• A sum of polynomials is a polynomial.
• A product of polynomials is a polynomial.
107
108
CHAPTER 8. FAMILIES OF FUNCTIONS
• The derivative of a polynomial is a polynomial.
• The integral of a polynomial is a polynomial
Polynomials are used to approximate other functions, such as sine, cosine, and exponential. We will characterize those functions that can be approximated by polynomials later.
All polynomials have an expanded form, in which the distributive law has been
used to remove all parentheses. (Some polynomials also have a factored form, in
which parentheses appear.) In expanded form, a term of a polynomial is a part of the
polynomial that is the product of a number (called the coefficient) and zero or more
variables, where a variable that appears more than once is expressed as a power of that
variable. Every polynomial in expanded form is a sum of terms, where subtraction is
carried out by addition of terms with negative coefficients.
Every polynomial in one variable is equivalent to a polynomial with the form
an xn + an−1 xn−1 + · · · + a1 x + a0 .
This form is sometimes taken as the definition of a polynomial in one variable.
A polynomial equation is an equation in the form of a polynomial equal to zero or
equal to another polynomial. The latter form is usually converted to the former by
subtracting the second polynomial from both sides of the equation. When written as
a polynomial equal to zero, the degree of the equation is the degree of the polynomial.
In elementary algebra, methods are given for solving all first degree and second
degree polynomial equations in one unknown. The number of solutions may equal the
degree, but it is necessary to consider multiplicity of solutions and complex numbers
for this to be universally true, as described in the Fundamental Theorem of Algebra.
Determining the roots of polynomials, or “solving algebraic equations”, is among
the oldest problems in mathematics. Some polynomials, such as f (x) = x2 + 1, do
not have any real roots. If, however, the set of allowed candidates is expanded to
the complex numbers, every (non-constant) polynomial has a root — in fact it has n
roots, counting multiplicity, if the degree of the polynomial is n. This is the statement
of the Fundamental Theorem of Algebra.
8.1.1
Polynomial functions
For given numerical constants a0 , . . . , an , n > 0, in some field (often Q, R or C), with
an non-zero, then a polynomial (function) of degree n is a function of the form
f (x) = a0 + a1 x + · · · + an−1 xn−1 + an xn .
More concisely, a polynomial function can be written in sigma notation as
n
X
ak xk .
k=0
MATH 6101-090
Fall 2006
8.1. POLYNOMIALS
109
The constants a0 , . . . , an are called the coefficients of the polynomial. a0 is called
the constant coefficient and an is called the leading coefficient. When the leading
coefficient is 1, the polynomial is said to be monic or normed.
Each summand ak xk of the polynomial is called a term. A polynomial with one,
two or three terms is called monomial, binomial or trinomial respectively.
8.1.2
Graphs
A polynomial function in one real variable can be represented by a graph.
• The graph of the zero polynomial f (x) = 0 is the x-axis.
• The graph of a degree 0 polynomial f (x) = a0 , where a0 6= 0, is a horizontal
line with y-intercept a0 .
• The graph of a degree 1 polynomial (or linear function) f (x) = a0 + a1 x , where
a1 6= 0, is an line with y-intercept a0 and slope a1 .
• The graph of a degree 2 or higher polynomial f (x) = a0 +a1 x+a2 x2 +· · ·+an xn ,
where an 6= 0 and n ≥ 2 is a continuous non-linear curve.
The best way to analyze the graph of a degree 2 or higher polynomial function is by
its end behavior, the number of x-intercepts and the number of turning points.
End behavior
There are four end behaviors which are direct results of whether an , the leading
coefficient, is positive or negative and whether n, the degree of the polynomial, is
even or odd.
1. If an is positive and n is even, the right end of the polynomial is in quadrant I
while the left end is in quadrant II.
2. If an is negative and n is even, the right end is in quadrant IV while the left
3. If an is positive and n is odd, the right end is in quadrant I while the left end
4. If an is negative and n is odd, the right end is in quadrant IV while the left end
MATH 6101-090
Fall 2006
110
CHAPTER 8. FAMILIES OF FUNCTIONS
Number of x-intercepts
From the Fundamental Theorem of Algebra, a polynomial of degree n has exactly n
complex roots, which may or may not be real. Therefore, the number of x-intercepts
cannot exceed n. It also follows from the Fundamental Theorem of Algebra that the
complex roots of a polynomial with real coefficients must exist in complex-conjugate
pairs. This in particular implies that an even-degree polynomial with real coefficients
may have no x-intercepts (because all its roots may be complex); an odd-degree polynomial with real coefficients, on the other hand, must have at least one x-intercept,
since any pairing of roots into complex-conjugate pairs will necessarily leave at least
one root unpaired for odd n. This (these) ”unpaired” root(s) must therefore be real.
Number of turning points
The number of turning points of an even-degree polynomial is any odd number less
than the degree, while the number of turning points of an odd-degree polynomial is
any even number less than the degree. For example, a degree 4 polynomial function
can have 1 or 3 turning points whereas a degree 5 polynomial function can have 0, 2,
or 4 turning points.
On your graphing calculator, graph the following examples of polynomials of low
degree.
1. f (x) = x2 − x − 2 = (x + 1)(x − 2)
2. f (x) =
x3 4x2 7x
1
+
−
− 2 = (x + 5)(x + 1)(x − 2)
5
5
5
5
3. f (x) =
1
(x
14
+ 4)(x + 1)(x − 1)(x − 3) + 0.5
4. f (x) =
1
(x
20
+ 4)(x + 2)(x + 1)(x − 1)(x − 3) + 2
5. f (x) = 13x4 − 7x3 + 32 x2 − 5x + 3
Roots
A root or zero of a polynomial p is a number r so that p(r) = 0. The Fundamental
Theorem of Algebra states that a polynomial of degree n over the complex numbers
has exactly n complex roots (not necessarily distinct ones). Therefore a polynomial
can be factored as
p(x) = an (x − r1 )(x − r2 ) · · · (x − rn ),
where each ri is a root of the polynomial p. For example, the polynomial x3 − x can
be factored as x(x−1)(x+1). An equation of the form p(x) = 0 is called a polynomial
equation in x. The solutions to the equation are the roots of the polynomial. The
real roots of a polynomial (without non-real coefficients) are the x-intercepts of the
graph of p(x) viewed as a polynomial function.
MATH 6101-090
Fall 2006
8.2. RATIONAL FUNCTIONS
111
One important aspect of calculus is the project of analyzing complicated functions
by means of approximating them with polynomials. The culmination of these efforts
is Taylor’s theorem, which roughly states that every differentiable function locally
looks like a polynomial, and the Stone-Weierstrass theorem, which states that every
continuous function defined on a compact interval of the real axis can be approximated
on the whole interval as closely as desired by a polynomial. Polynomials are also
frequently used to interpolate functions.
8.2
Rational Functions
A rational function is a function that is the quotient of two polynomial functions.
f (x) =
p(x)
,
q(x)
where p(x) and q(x) are polynomial functions, and q(x) is not identically equal zero.
Note that there is no condition that states p(x) and q(x) have no factors in common.
In fact, you must realize that the two functions
f (x) =
x2 − 1
x−1
and g(x) = x + 1
are different as functions, though the are algebraically identical. Note that the
domain of f does not contain 1, while 1 is in the domain of g. Usually, we will want
to consider the rational functions whose numerator and denominator have no factors
in common, because it will give us essentially the same function just with a larger
domain.
Example 8.1 Let
x2 + x − 20
.
x2 − 3x − 18
To understand the behavior of this rational function it is useful to see its constituent
polynomials in factored form. The polynomials in the numerator and the denominator
of the above function would factor like this:
f (x) =
f (x) =
8.2.1
(x + 5)(x − 4)
.
(x + 3)(x − 6)
The Domain
By considering the constituent polynomials in factored form, the roots of the denominator are obvious. In the above example they are x = −3 and x = 6. That is, if x
takes on either of these two values, the denominator becomes equal to zero. Since we
MATH 6101-090
Fall 2006
112
CHAPTER 8. FAMILIES OF FUNCTIONS
can not divide by zero, the function is not defined for these two values of x. We say
that the function is not defined at x = −3 and x = 6.
Other values for x do not cause the function to become undefined, so, we say that
the function is defined for all other values for x. In other words, all real numbers
except −3 and 6 are allowed as inputs to this function. The domain for the function
therefore is:
{x ∈ R | x 6= −3 or 6} = (−∞, −3) ∪ (−3, 6) ∪ (6, ∞).
The x-intercepts
8.2.2
The x-intercepts for this function would be where the output, or y-value, equals zero.
A rational function is a fraction, and a fraction is equal to zero when the numerator
is equal to zero. For the above rational function this happens at the roots of this
polynomial. The roots of the numerator polynomial are x = −5 and x = 4. That
is, when x takes on either of these two values the numerator becomes zero, and the
output of the function, or y-value, also becomes zero.
Notice that the function must be defined at these values. In our other example
x2 − 1
even though the numerator is zero at x = 1, the function is not defined
g(x) =
x−1
there. Thus, x = 1 cannot be an x-intercept.
8.2.3
The y-intercept
What about the y-intercept? Of course, this is where x = 0. As a matter of ease, it is
often easier for students to use the unfactored form when computing the y-intercept.
In the example above
f (0) =
8.2.4
The Graph
10
5
0
−10
02 + 0 − 20
−20
10
=
= .
2
x − 3 · 0 − 18
−18
9
−5
0
5
10
Consider a graph of this function in Figure 8.1. The
graph of the function breaks at x = −3 and at x = 6.
The function crosses the x-axis at x = −5 and x = 4.
These are the same as the values which we calculated
above for the x-intercepts. The function crosses the yaxis just a bit above 1, at about 1.1. This is the same
location as the calculated y-intercept above.
x
y −5
−10
Figure 8.1:
MATH 6101-090
8.2.5
End Behavior
The way that a function is shaped when the input approaches positive or negative infinity is called its end
Fall 2006
8.3. ALGEBRAIC FUNCTIONS
113
behavior. One might say that the end behavior of a function describes what the
function looks like from far away.
In our graph notice how the graph is leveling off to a height of about y = 1 as x
gets large positively or negatively. That is, at the left and right edge of the graph the
function starts to act like the function described f (x) = 1.
What would you consider to be the end behavior of the following two functions?
−10
10
10
5
5
0
0
−5
0
5
10
−5
0
y −5
y −5
−10
−10
Figure 8.2:
8.2.6
−10
5
10
x
x
x4 − 10x2 + 9
5x2 − 10x − 40
Figure 8.3:
x4 − 7x3 + 11x2 + 7x − 12
5x2 − 5x − 30
The Range
An examination of the graph above will indicate that all real numbers are available
for output. The left most fork of the graph looks like it will rise not quite to y = 1,
and the right most fork looks like it may not quite drop to y = 1; so, one might at
first suggest that y = 1 is not in the range. However, if you examine the central
portion of the graph, you can see that y = 1 is definitely a member of the range. So,
all real numbers are present in the range.
8.3
Algebraic Functions
A function which can be constructed using only a finite number of elementary operations — addition, subtraction, multiplication, division, and exponentiation — together with the inverses of functions capable of being so constructed is called an
algebraic function.
This class of functions contains polynomial functions and rational functions. It
includes more though, since it includes the root functions, such as the square root
MATH 6101-090
Fall 2006
114
CHAPTER 8. FAMILIES OF FUNCTIONS
and the cube root. Examples of algebraic functions not previously considered would
be functions like:
√
f (x) =
ax3 + bx2 + cx + d
√
3
g(x) =
x4 − 8
h(x) = ax1/2 + bx1/3 + cx1/4
√
√
√
√
2 + a2 ,
2 − a2 ,
2 − x2 ,
x
x
a
ax + b,
Functions
involving
expressions
such
as
√
2
and ax + bx + c are sometimes called irrational functions. These expressions often
arise in calculus in antidifferentiation problems. Long lists of antiderivatives exist for
them in multiple places. These, too, are algebraic functions.
Note that it is also possible to talk about an algebraic function that is implicitly
defined by an algebraic equation in 2 variables. You might not be able to have an
explicit representation of the function, but the values of the function, y(x), are determined by the values of x. This is not essentially different from the above definition,
but lends itself to generalizing to multiple variables.
8.4
Transcendental Functions
A function which is not algebraic is a transcendental function. This includes the exponential, logarithmic, and trigonometric functions — which we will discuss later. It also includes many, many more functions
called special functions. They are called this because
they normally arise is special situations and are not as
widely used as others. We will look at a few of these:
the Lambert W function and glog. Many others exist
that can be found in most Differential Equations and
Numerical Analysis texts. A very important part of
Real Analysis is finding ways to study and describe all
functions, and this includes special functions.
8.4.1
Exponential Functions
4
2
0
0.5
1
1.5
2
–2
–4
We are used to functions where the variable is raised
Figure 8.4: (−2)x for careto a fixed power. The exponential function reverses
fully chosen values of x ∈
the roles of the base and the exponent in power func[0, 2]
tions. To carefully define the exponential function we
will need a number of things that we have not yet proven or derived. However, you
can remember some of the properties from your earlier courses.
A function of the form f (x) = ax for a 6= 1 and a > 0 is called and exponential
function. If we were to take a = 1 then this is just the constant function, which is
MATH 6101-090
Fall 2006
8.4. TRANSCENDENTAL FUNCTIONS
115
already contained in the set of polynomials. If we take a < 0, then the function is
not defined for all real numbers. For example, if we consider the expression (−2)x
and graph this over the interval from 0 to 2 we might get a graph like the following:
ex is always strictly positive for any x, so the domain of the function is the set of
real numbers and the codomain is the set of positive real numbers. The exponential
function obeys all of the normal laws of exponents i.e.
(a)
(b)
(c)
(d)
ex ey = ex+y .
ex+y = ex ey .
e−x = e1x .
x
ex−y = eey .
In fact, we could start with the condition that f (x + y) = f (x)f (y). Notice then
that this makes f (0) = [f (0)]2 so either f (0) = 0 or f (0) = 1. Since f (x) = f (0+x) =
f (0)f (x), if f (0) = 0, then we would have that f (x) = 0 for all x and this is not that
interesting. Therefore, f (0) = 1.
Note that this now implies that f (−x) = 1/f (x), since
f (−x)f (x) = f (−x + x) = f (0) = 1.
It then follows that f (x − y) = f (x)/f (y).
Now, let f (1) = α. Then for any positive integer n, f (n) = αn by induction, just
like the homework. Then we can see that f (−n) = 1/αn = α−n . Let r be a rational
number and let r = pq . Then
p
p
αp = f (p) = f (q · ) = f ( )q .
q
q
From this it follows that f ( pq ) = αp/q . Now, if we knew that f were continuous, we
could then show that f (x) = αx for all real numbers x. This tells us that any continuous, real-valued function that satisfies f (x + y) = f (x)f (y) must be an exponential
function. What kind of function would satisfy f (xy) = f (x) + f (y)?
What can we say about α? We know that if α = 1, then f (x) = 1 and this would
be a constant function. √
If we want this to be a real-valued function, then since we
1
have shown that f ( 2 ) = α, we would want to keep α from being negative. If on the
other hand we allowed complex values as output, then that restriction need not be
applied. Also, if we were to have α = 0, then f (x) would be undefined for all x < 0.
Thus, we will have the restrictions that α > 0 and α 6= 1.
Is this function a one-to-one function? What happens if f (x) = f (y)?
f (x)
αx
αx−y
x−y
x
MATH 6101-090
=
=
=
=
=
f (y)
αy
1
0
y
Fall 2006
116
CHAPTER 8. FAMILIES OF FUNCTIONS
Thus, the exponential function is one-to-one.
8.4.2
Logarithmic Functions
Since the exponential function is one-to-one, it then has an inverse function defined
for x > 0 since the range of the exponential function is all positive reals.
The logarithm is the mathematical operation that is the inverse of exponentiation
(raising a constant, the base, to a power). The logarithm of a number x in base b is
the number n such that x = bn . Thus, we have that
logb (x) = n ⇔ bn = x.
Logarithms reduce multiplication operations to addition, division to subtraction,
exponentiation to multiplication, and roots to division. Therefore, logarithms are
useful for making lengthy numerical operations easier to perform and, before the advent of electronic computers, they were widely used for this purpose in fields such as
astronomy, engineering, navigation, and cartography. They have important mathematical properties and are still used in many ways.
The most widely used bases for logarithms are 10, 2 and the Euler constant e ∼
2.718281828459045.... When log is written without a base, i.e. the b is missing from
logb , the intent can usually be determined from context:
• natural logarithm (loge ) in mathematical analysis,
• common logarithm (log10 ) in engineering and when logarithm tables are used
to simplify hand calculations,
• binary logarithm (log2 ) in information theory1 and musical intervals
The notation ln(x) almost always means loge (x), i.e., the natural logarithm of x,
but the implied base for log(x) varies by discipline:
• Mathematicians generally understand both ln(x) and log(x) to mean loge (x)
and write log10 (x) when the base-10 logarithm of x is intended. Sometimes the
term lg(x) is used for the base-2 logarithm of x.
1
Information theory is a discipline in applied mathematics involving the quantification of data
with the goal of enabling as much data as possible to be reliably stored on a medium and/or communicated over a channel. The measure of data, known as information entropy, is usually expressed
by the average number of bits needed for storage or communication. Applications of fundamental
topics of information theory include ZIP files (lossless data compression), MP3s (lossy data compression), and DSL (channel coding). The field is at the crossroads of mathematics, statistics, computer
science, physics and electrical engineering, and its impact has been crucial to success of the Voyager
missions to deep space, the invention of the CD, the feasibility of mobile phones, the development
of the Internet, the study of linguistics and of human perception, the understanding of black holes,
and numerous other fields.
MATH 6101-090
Fall 2006
8.4. TRANSCENDENTAL FUNCTIONS
117
• Engineers, biologists, and some others write only ln(x) or loge (x) when they
mean the natural logarithm of x, and take log(x) to mean log10 (x) or, sometimes
in the context of computing, log2 (x).
• On most calculators, the LOG button is log10 (x) and LN is loge (x). However,
in most commonly used computer programming languages, including C, C++,
Java, Fortran, and BASIC, the log function returns the natural logarithm. The
base-10 function, if it is available, is generally log10.
• Some people use Log(x) (capital L) to mean log10 (x), and use log(x) with a
lowercase l to mean loge (x).
• The notation Log(x) is also used by mathematicians to denote the principal
branch of the (natural) logarithm function.
• Also frequently used is the notation blog(x) instead of logb (x).
This chaos, historically, originates from the fact that the natural logarithm has
nice mathematical properties (such as its derivative being 1/x, and having a simple
definition), while, back when logarithms were used to speed computations, the decimal
logarithms were far better for that, so natural logarithms where unknown outside
calculus classes while decimal logarithms were widely used in a variety of disciplines.
In computer science, the base 2 logarithm is sometimes written as lg(x) to avoid
confusion. This usage was suggested by Edward Reingold and popularized by Donald
Knuth. However, in Russian literature, the notation lg(x) is generally used for the
base 10 logarithm, so even this usage is not without its perils.
While there are several useful identities, the most important for calculator use lets
one find logarithms with bases other than those built into the calculator (usually loge
and log10 ). To find a logarithm with base b using any other base a:
n = logb x ⇔ bn = x
loga (bn ) = loga x
n · loga b = loga x
loga x
n =
loga b
loga x
logb x =
loga b
Logarithms are useful in solving equations in which exponents are unknown. They
have simple derivatives, so they are often used in the solution of integrals. The
logarithm is one of three closely related functions. In the equation bn = x, b can be
determined with radicals, n with logarithms, and x with exponentials.
Various quantities in science are expressed as logarithms of other quantities.
1. The negative of the base-10 logarithm is used in chemistry, where it expresses
the concentration of hydronium ions (pH). The concentration of hydronium ions
in neutral water is 10−7 at 25◦ C, hence a pH of 7.
MATH 6101-090
Fall 2006
118
CHAPTER 8. FAMILIES OF FUNCTIONS
2. The bel (symbol B) is a unit of measure which is the base-10 logarithm of ratios,
such as power levels and voltage levels. It is mostly used in telecommunication,
electronics, and acoustics. It is used, in part, because the ear responds logarithmically to acoustic power. Invented by engineers of the Bell Telephone Laboratory to quantify the reduction in audio level over a 1 mile (1.6 km) length
of standard telephone cable, it was originally called the transmission unit or
TU, but was renamed in 1923 or 1924 in honor of the laboratory’s founder and
telecommunications pioneer Alexander Graham Bell. The bel was too large for
everyday use, so the decibel (dB), equal to 0.1 bel (B), became more commonly
used.
3. The neper is a similar unit which uses the natural logarithm of a ratio. It is
not an international system unit but is accepted for use alongside that system.
It is used to express ratios, such as gain to loss and voltage and current, and
relative values. value of a ratio in nepers, Np, is given by
NP = ln
x1
= ln x1 − ln x2 .
x2
4. The Richter scale measures earthquake intensity on a base-10 logarithmic scale.
5. In spectrometry and optics, the absorbance unit used to measure optical density
is equivalent to -1 B.
6. In astronomy, the apparent magnitude measures the brightness of stars logarithmically, since the eye also responds logarithmically to brightness.
The discovery of logarithms just before Newton’s era had an impact in the scientific
world which can be compared with the invention of the computer in the 20th century,
because many calculations which were too laborious became feasible.
When the chronometer was invented in the 18th century, logarithms allowed all
calculations needed for astronomical navigation to be reduced to just additions, speeding the process by one or two orders or magnitude. A table of logarithms with five
decimals, plus logarithms of trigonometric functions, was enough for most astronomical navigation calculations, and those tables fit in a small book.
To compute powers or roots of a number, the common logarithm of that number
was looked up and multiplied or divided by the radix. Interpolation could be used
for still higher precision. Slide rules used logarithms to perform the same operations
more rapidly, but with much less precision than using tables. Other tools for performing multiplications before the invention of the calculator include Napier’s bones
and mechanical calculators.
History of Logarithms
In the 17th century, Joost Bürgi, a Swiss clockmaker employed by the Duke of HesseKassel, first discovered logarithms as a computational tool. He did not publish his
MATH 6101-090
Fall 2006
8.4. TRANSCENDENTAL FUNCTIONS
119
discovery, however, until 1620. The method of logarithms was first publicly propounded in 1614, in a book entitled Mirifici Logarithmorum Canonis Descriptio, by
John Napier, Baron of Merchiston in Scotland, four years after the publication of
his memorable discovery. This method contributed to the advance of science, and
especially of astronomy, by making some difficult calculations possible. Prior to the
advent of calculators and computers, it was used constantly in surveying, navigation, and other branches of practical mathematics. It supplanted the more involved
prosthaphaeresis, which relied on trigonometric identities, as a quick method of computing products. Besides their usefulness in computation, logarithms also filled an
important place in the higher theoretical mathematics.
At first, Napier called logarithms artificial numbers and antilogarithms natural
numbers. Later, Napier formed the word logarithm to mean a number that indicates
a ratio from the Greek λoγoσ (logos) meaning proportion, and αριθµoσ (arithmos)
meaning number. Napier chose that because the difference of two logarithms determines the ratio of the numbers for which they stand, so that an arithmetic series of
logarithms corresponds to a geometric series of numbers. The term antilogarithm was
introduced in the late 17th century and, while never used extensively in mathematics,
persisted in collections of tables until they fell out of favor with the advent of the
electronic calculator.
Napier did not use a base as we now understand it, but his logarithms were,
up to a scaling factor, effectively to base 1/e. For interpolation purposes and ease
of calculation, it is useful to make the ratio r in the geometric series close to 1.
Napier chose r = 1 − 10−7 = 0.999999, and Bürgi chose r = 1 + 10−4 = 1.0001.
Napier’s original logarithms did not have log 1 = 0 but rather log 107 = 0. Thus if
N is a number and L is its logarithm as calculated by Napier, N = 107 (1 − 10−7 )L.
7
Since (1 − 10−7 )10 is approximately 1/e, this makes L/107 approximately equal to
log1/e N/107 .
Prior to the advent of computers and calculators, using logarithms meant using
tables of logarithms, which had to be created manually. Base-10 logarithms are useful
in computations when electronic means are not available.
In 1617, Henry Briggs published the first installment of his own table of common
logarithms, containing the logarithms of all integers below 1000 to eight decimal
places. This he followed, in 1624, by his Arithmetica Logarithmica, containing the
logarithms of all integers from 1 to 20,000 and from 90,000 to 100,000 to fourteen
places of decimals, together with a learned introduction, in which the theory and use
of logarithms are fully developed. The interval from 20,000 to 90,000 was filled up
by Adriaan Vlacq, a Dutch computer; but in his table, which appeared in 1628, the
logarithms were given to only ten places of decimals.
Vlacq’s table was later found to contain 603 errors, but that was not regarded as
a great number of errors “when it is considered that the table was the result of an
original calculation, and that more than 2,100,000 printed figures are liable to error.”2
2
Athenaeum, 15 June 1872. See also the Monthly Notices of the Royal Astronomical Society for
MATH 6101-090
Fall 2006
120
CHAPTER 8. FAMILIES OF FUNCTIONS
An edition of Vlacq’s work, containing many corrections, was issued at Leipzig in 1794
under the title Thesaurus Logarithmorum Completus by Jurij Vega.
Callet’s seven-place table in 1795 gave the eight-place logarithms of the numbers
between 100,000 and 108,000, in order to diminish the errors of interpolation, which
were greatest in the early part of the table. The only important published extension
of Vlacq’s table was made by Mr. Sang 1871, whose table contained the seven-place
logarithms of all numbers below 200,000.
Briggs and Vlacq also published original tables of the logarithms of the trigonometric functions.
Besides the tables mentioned above, a great collection, called Tables du Cadastre,
was constructed under the direction of Gaspard de Prony, by an original computation,
under the auspices of the French republican government of the 1700’s. The work
contained the logarithms of all numbers up to 100,000 to nineteen places, and of
the numbers between 100,000 and 200,000 to twenty-four places. It exists only in
manuscript, however, “in seventeen enormous folios,” at the Observatory of Paris. It
was begun in 1792 and was completed in two years.
8.5
Trigonometric Functions
The trigonometric functions have a long history in mathematics. The study of trigonometric functions dates back to Babylonian times, and a considerable amount of fundamental work was done by Persian and Greek mathematicians. In modern mathematics, they are functions of an angle; they are important when studying triangles
and modeling periodic phenomena.
In Geometry we will commonly define them as ratios of two sides of a right triangle
containing the angle, and later we equivalently define them as the lengths of various
line segments from a unit circle. Mathematics has found many equivalent ways of
defining them such as expressing them as infinite series or as solutions of certain
differential equations, allowing their extension to positive and negative values and
even to complex numbers.
In modern usage, there are six basic trigonometric functions. Especially in the case
of the last four, these relations are often taken as the definitions of those functions,
but one can define them equally well geometrically or by other means and then derive
these relations. A few other functions were common historically (and appeared in
the earliest tables), but are now seldom used, such as the versine (1 − cos θ) and the
exsecant (sec θ − 1).
May 1872.
MATH 6101-090
Fall 2006
8.5. TRIGONOMETRIC FUNCTIONS
121
Function
Abbreviation
Relationships
Sine
sin
sin θ = cos
π
2
−θ
Cosine
cos
cos θ = sin
π
2
−θ
Tangent
tan
tan θ =
Cotangent
cot
Secant
sec
Cosecant
csc
1
sin θ
=
= cot
cot θ
cos θ
cos θ
1
cot θ =
=
= tan
tan θ
sin θ
1
sec θ =
= csc π2 − θ
cos θ
1
csc θ =
= sec π2 − θ
sin θ
π
2
−θ
π
2
−θ
History
The earliest use of sine appears in the Sulba Sutras written in ancient India from the
8th century BCE to the 6th century BCE. Trigonometric functions were later studied
by Hipparchus of Nicaea (180-125 BCE), Ptolemy, Aryabhata (476550), Varahamihira, Brahmagupta, Muhammad ibn Musa al-Kwarizmi, Abu’l-Wafa, Omar Khayyam,
Bhaskara II, Nasir al-Din Tusi, Ghiyath al-Kashi (14th century), Ulugh Beg (14th
century), Regiomontanus (1464), Rheticus, and Rheticus’ student Valentin Otho.
Madhava (c. 1400) made early strides in the analysis of trigonometric functions in
terms of infinite series. Leonhard Euler’s Introductio in analysin infinitorum in 1748
was mostly responsible for establishing the analytic treatment of trigonometric functions in Europe, also defining them as infinite series and presenting Euler’s formula,
as well as the near-modern abbreviations sin., cos., tang., cot., sec., and cosec.
The use of trigonometric functions arises from the early connection between mathematics and astronomy. Early work with spherical triangles was as important as plane
triangles.
The first work on trigonometric functions related to chords of a circle. Given a
circle of fixed radius, 60 units were often used in early calculations, then the problem
was to find the length of the chord subtended by a given angle. For a circle of
unit radius the length of the chord subtended by the angle x was 2 sin(x/2). The
first known table of chords was produced by the Greek mathematician Hipparchus in
about 140 BCE. Although these tables have not survived, it is claimed that twelve
books of tables of chords were written by Hipparchus. This makes Hipparchus the
founder of trigonometry in Europe.
The next Greek mathematician to produce a table of chords was Menelaus in
about 100 AD. Menelaus worked in Rome producing six books of tables of chords
which have been lost but his work on spherics has survived and is the earliest known
MATH 6101-090
Fall 2006
122
CHAPTER 8. FAMILIES OF FUNCTIONS
work on spherical trigonometry. Menelaus proved a property of plane triangles and
the corresponding spherical triangle property known the regula sex quantitatum.
Ptolemy was the next author of a book of chords, showing the same Babylonian
influence as Hipparchus, dividing the circle into 360 and the diameter into 120 parts.
The suggestion here is that he was following earlier practice when the approximation
3 for π was used. Ptolemy, together with the earlier writers, used a form of the
relation sin2 x + cos2 x = 1, although of course they did not actually use sines and
cosines but chords.
Similarly, in terms of chords rather than sine and cosine, Ptolemy knew the formulas
sin(x + y) = sin x cos y + cos x sin y
b
c
a
=
=
.
sin A
sin B
sin C
Ptolemy calculated chords by first inscribing regular polygons of 3, 4, 5, 6 and
10 sides in a circle. This allowed him to calculate the chord subtended by angles of
36◦ , 72◦ , 60◦ , 90◦ and 120◦ . He then found a method of finding the cord subtended
by half the arc of a known chord and this, together with interpolation allowed him
to calculate chords with a good degree of accuracy. Using these methods Ptolemy
found that sin 30′ (30′ = half of 1◦ ) which is the chord of 1◦ was, as a number in base
60, 0 31′ 25”. Converted to decimals this is 0.0087268 which is correct to 6 decimal
places, the answer to 7 decimal places being 0.0087265.
The first actual appearance of the sine of an angle appears in the work of the
Hindus. Aryabhata, in about 500, gave tables of half chords which now really are
sine tables and used jya for our sin. This same table was reproduced in the work of
Brahmagupta (in 628) and detailed method for constructing a table of sines for any
angle were give by Bhaskara in 1150.
The Arabs worked with sines and cosines and by 980 Abu’l-Wafa knew that
sin 2x = 2 sin x cos x
although it could have easily have been deduced from Ptolemy’s formula
sin(x + y) = sin x cos y + cos x sin y
with x = y.
The Hindu word jya for the sine was adopted by the Arabs who called the sine
jiba, a meaningless word with the same sound as jya. Now jiba became jaib in later
Arab writings and this word does have a meaning, namely a ‘fold’. When European
authors translated the Arabic mathematical works into Latin they translated jaib
into the word sinus meaning ‘fold’ in Latin. In particular Fibonacci’s use of the term
sinus rectus arcus soon encouraged the universal use of sine.
Chapters of Copernicus’s book giving all the trigonometry relevant to astronomy
was published in 1542 by Rheticus. Rheticus also produced substantial tables of sines
MATH 6101-090
Fall 2006
8.5. TRIGONOMETRIC FUNCTIONS
123
and cosines which were published after his death. In 1533 Regiomontanus’s work De
triangulis omnimodis was published. This contained work on planar and spherical
trigonometry originally done much earlier in about 1464. The book is particularly
strong on the sine and its inverse.
The term sine certainly was not accepted straight away as the standard notation
by all authors. In times when mathematical notation was in itself a new idea many
used their own notation. Edmund Gunter was the first to use the abbreviation sin
in 1624 in a drawing. The first use of sin in a book was in 1634 by the French
mathematician Hérigone while Cavalieri used Si and Oughtred S.
It is perhaps surprising that the second most important trigonometrical function
during the period we have discussed was the versed sine, a function now hardly used
at all. The versine is related to the sine by the formula
versin x = 1 − cos x.
It is just the sine turned (versed) through 90◦ .
The cosine follows a similar course of development in notation as the sine. Viète
used the term sinus residuae for the cosine, Gunter (1620) suggested co-sinus. The
notation Si.2 was used by Cavalieri, s co arc by Oughtred and S by Wallis.
Viète knew formulas for sin nx in terms of sin x and cos x. He gave explicitly the
formulas (due to Pitiscus)
sin 3x = 3 cos2 x sin x − sin3 x
cos 3x = cos3 x − 3 sin2 x cos x.
The tangent and cotangent came via a different route from the chord approach
of the sine. These developed together and were not at first associated with angles.
They became important for calculating heights from the length of the shadow that
the object cast. The length of shadows was also of importance in the sundial. Thales
used the lengths of shadows to calculate the heights of pyramids.
The first known tables of shadows were produced by the Arabs around 860 and
used two measures translated into Latin as umbra recta and umbra versa. Viète used
the terms amsinus and prosinus. The name tangent was first used by Thomas Fincke
in 1583. The term cotangens was first used by Edmund Gunter in 1620.
Abbreviations for the tangent and cotangent followed a similar development to
those of the sine and cosine. Cavalieri used Ta and Ta.2, Oughtred used t arc and
t co arc while Wallis used T and t. The common abbreviation used today was used
by Albert Girard in 1626, but tan was written over the angle. The abbreviation cot
was first used by Jonas Moore in 1674.
The secant and cosecant were not used by the early astronomers or surveyors.
These came into their own when navigators around the 15th Century started to
prepare tables. Copernicus knew of the secant which he called the hypotenusa. Viète
MATH 6101-090
Fall 2006
124
CHAPTER 8. FAMILIES OF FUNCTIONS
knew the results
csc x
1
= cot x =
sec x
tan x
cos x
1
=
= sin x.
csc x
cot x
The abbreviations used by various authors were similar to the trigonometric functions already discussed. Cavalieri used Se and Se.2, Oughtred used se arc and sec co
arc while Wallis used s and σ. Albert Girard used sec, written above the angle as he
did for the tangent.
The term trigonometry first appears as the title of a book Trigonometria by
Pitiscus, published in 1595. Pitiscus also discovered the formulas for sin 2x, sin 3x,
cos 2x, and cos 3x.
The 18th Century saw trigonometric functions of a complex variable being studied.
Johann Bernoulli found the relation between sin−1 z and log z in 1702 while Cotes, in
a work published in 1722 after his death, showed that
ix = log(cos x + i sin x).
De Moivre published his famous theorem
(cos x + i sin x)n = cos nx + i sin nx
in 1722 while Euler, in 1748, gave the formula (equivalent to that of Cotes)
exp(ix) = cos x + i sin x.
The hyperbolic trigonometric functions were introduced by Lambert.
Once we know something about similarity in triangles we should see some standard
correspondence between the length of the sides of a triangle and the angles of the
triangle. It is just these ratios that the trigonometric functions express, geometrically.
Just as we defined the exponential function above in terms of certain functional
equations, we can define the trigonometric functions using functional equations based
on properties like the sum and difference formulas. If we take these formulas and
the Pythagorean identity as given then we can prove that only two real functions
satisfy those conditions. Symbolically, we say that there exists exactly one pair of
real functions s and c such that for all real numbers x and y, the following equations
hold:
s(x)2 + c(x)2 = 1,
s(x + y) = s(x)c(y) + c(x)s(y),
c(x + y) = c(x)c(y) − s(x)s(y),
0 < xc(x) < s(x) < x for 0 < x < 1.
Other derivations, starting from other functional equations, are also possible, and
such derivations can be extended to the complex numbers.
MATH 6101-090
Fall 2006
8.5. TRIGONOMETRIC FUNCTIONS
125
Properties of Trigonometric Functions
The Law of Sines for an arbitrary triangle states
sin B
sin C
sin A
=
=
.
a
b
c
Now, it is also known in the formulation:
a
b
c
=
=
= 2R.
sin A
sin B
sin C
The common number a/ sin A occurring in the theorem is the diameter of the circumcircle through the three points A, B and C. The Law of Sines is useful for computing
the lengths of the unknown sides in a triangle if two angles and one side are known.
This is a common situation occurring in triangulation, a technique to determine unknown distances by measuring two angles and an accessible enclosed distance.
The Law of Cosines is merely an extension of the Pythagorean theorem
c2 = a2 + b2 − 2ab cos C,
or
a2 + b2 − c2
.
2ab
The Law of Cosines is useful to determine the unknown data of a triangle if two sides
and an angle are known. If the angle is not contained between the two sides, the
triangle may not be unique.
cos C =
There is also a Law of Tangents:
tan 12 (A + B)
a+b
.
=
a−b
tan 12 (A − B)
Geometric Realizations
For the functions of the unit circle, note that each of the six functions of the angle
correspond to certain segments associated with that angle in the unit circle.
If ∠BOA = θ, then OA = OB = 1, OD = EB = cos θ (the x-coordinate of
the point B) and OE = BD = sin θ (the y-coordinate of the point B). Now, AC
lies on the tangent to the circle at A and is, hence, perpendicular to OA. Also,
△BOD ∼ △COA, so
AC =
MATH 6101-090
AC
BD
sin θ
=
=
= tan θ.
OA
OD
cos θ
Fall 2006
126
CHAPTER 8. FAMILIES OF FUNCTIONS
Y
F
G
C
E
O
B
D
A X
Figure 8.5: Unit Circle Realizations of trigonometric values
Also, from this similarity we have that
OC
OB
1
=
=
= sec θ.
OA
OD
cos θ
Likewise, △GF O ∼ △BEO, and
OC =
FG =
FG
BE
cos θ
=
=
= cot θ,
OF
OE
sin θ
and
OG
OB
1
=
=
= csc θ.
OF
EB
sin θ
Thus, we have the following geometric realizations of the six functions:
OG =
Function
sin θ
cos θ
tan θ
cot θ
sec θ
csc θ
Segment
BD = OE
OD = BE
AC
GF
OC
OG
Note that if we look at the tangent to the circle at B, then we have points X
where the tangent intersects OA and Y where it intersects OF . The triangle △XBO
is similar to △BDO, so from this we get that XB = tan θ and OX = sec θ. Likewise
△OBY ∼ △BDO and this gives us that BY = cot θ and OY = csc θ.
MATH 6101-090
Fall 2006
8.6. CORDIC ALGORITHM
8.6
127
CORDIC Algorithm
We mentioned how we used to use log tables and trig tables to find the values of the
exponential, logarithmic, and trigonometric functions before the advent of electronic
calculators. It used to be someone job to calculate a lot of these formulas by hand
— and they were called computers. Now, we have computers and calculators that
are faster and more efficient. How do we know that they are more accurate? How
do the electronic machines calculate that the sine of 22◦ is sin(22◦ ) = 0.3746065934
and why should we believe
√ that it is correct? How do computers/calculators evaluate
x
functions such as e , x, sin(x) and arctan(x), to name just a few? How accurate
are these calculations?
Years ago, if you used BASICA on an IBM computer to evaluate the natural
log of 1.001, it would return ln(1.001) = 9.994461 × 10−4 while the actual value
is 9.995003331 × 10−4. The computer was only getting the first 3 digits correct, while
at that same time the TI-82 was returning all 10 digits correct. Clearly they are not
using the same algorithm for computing the logarithm of a number.
Since on a computing device the operations of addition, subtraction, multiplication
and division are relatively easy, while exponentiation is hard, it is best to try to
replace the elementary functions by polynomials that will approximate the original
function “well enough” on the given interval. That leaves plenty of questions: what
polynomials? what is “well enough”?
The usual culprits that are used to approximate the elementary functions are
•
•
•
•
•
Taylor series and Maclaurin series,
Fourier series,
Chebyshev series,
Let’s look at how we might compute the values of the tangent of a real number
between −1 and 1.
Taylor Series Let’s look at the Taylor series for tan(x) centered at x = 0. From
Calculus we know that
tan(x) ≈
∞
X
n=0
dn
(tan(x)|x=0
dxn
xn
n!
If we take n = 10 in this series we get the following polynomial to approximate tan(x):
1
2
7 7
62 9
P9 (x) = x + x3 + x5 +
x +
x.
3
15
315
2835
Chebyshev Series At the same time the Chebyshev series for tan(x) takes the
following form. The Chebyshev polynomials, Tn (x), are solutions to Chebyshev’s
MATH 6101-090
Fall 2006
128
CHAPTER 8. FAMILIES OF FUNCTIONS
equation:
(1 − x2 )y ′′ − xy ′ + n2 y = 0,
and satisfy the recurrence relation
T0 (x) = 1, T1 (x) = x, . . . Tn+1 (x) = 2x · Tn (x) − Tn−1 x,
for n > 0. The Chebyshev polynomials √
are orthogonal on the interval [−1, 1] with
respect to the weight function w(x) = 1/ 1 − x2 . This means that
Z 1
Tn (x) · Tm (x) · w(x) dx = 0, if m 6= n.
−1
For such a family of orthogonal functions, we can write another function, say f (x) in
terms of our orthogonal family by
f (x) =
∞
X
cn Tn (x),
n=0
where
cn =
R1
−1
f (x) · Tn (x) · w(x) dx
R1
−1
′
(Tn (x))2 · w(x) dx
This is how we get the following 9th order Chebyshev polynomial for tan(x).
T9 (x) = 1.0040x + 0.325610x3 + 0.173344x5 − 0.026645x7 + 0.0846426x9.
P
Padé Approximant If we are given a power series f (x) =
cn xn , then a Padé
approximant is a rational function
[L/M] =
a0 + a1 x + · · · + aL xL
1 + b1 x + · · · + bM xM
whose Maclaurin series agrees with the given power series at least through order
L + M. If it converges, it should converge faster than the original power series. For
example if
1
1
f (x) = 1 − x + x2 + . . .
2
3
1
[1/0] = 1 − x
2
1
[0/1] =
1 + 12 x
[1/1] =
MATH 6101-090
1 + 16 x
1 + 23 x
Fall 2006
8.6. CORDIC ALGORITHM
129
The [5/5] Padé approximant for the tangent function is
1
x5
x − 19 x3 + 945
P[5/5] (x) =
1 4 .
1 − 94 x2 + 63
x
rational function p(x)/q(x) with deg(p(x)) ≤ m and deg(q(x)) ≤ n such that the
Chebyshev series expansion of p(x)/q(x) has maximal initial agreement with the
Chebyshev series expansion of f , usually through degree m + n. For the tangent
function this is:
CP[5/5] (x) =
1.27604x − 0.141986x3 + 0.00136920x5
.
1.27604 − 0.567336x2 + 0.0203367x4
So, we have the following four approximations to the tangent function
1
2
7 7
62 9
P9 (x) = x + x3 + x5 +
x +
x
3
15
315
2835
T9 (x) = 1.0040x + 0.325610x3 + 0.173344x5 − 0.026645x7 + 0.0846426x9
1
x − 19 x3 + 945
x5
P[5/5] (x) =
1 4
1 − 49 x2 + 63
x
1.27604x − 0.141986x3 + 0.00136920x5
CP[5/5] (x) =
1.27604 − 0.567336x2 + 0.0203367x4
We can look at the error between these approximations and the actual values
of the tangent function by graphing the absolute value of the error on the interval
[−1, 1]. Let
ET (x)
EC(x)
EP (x)
ECP (x)
=
=
=
=
|P9 (x) − tan(x)|
|T9 (x) − tan(x)|
|P[5/5] (x) − tan(x)|
|CP5/5] (x) − tan(x)|
The graph below is a graph of the absolute value of the error of each of these
approximations on the interval [−1, 1]. The red curve is the error in the Chebyshev
series approximation, the blue curve is error in the Padé approximant, the green curve
is the error in the Taylor series approximation, and the magenta is the error in the
For x = 0.25 consider the following values:
P9 (0.25)
T9 (0.25)
P[5/5] (0.25)
CP[5/5] (0.25)
tan(0.25)
MATH 6101-090
=
=
=
=
=
0.25534191905295
0.25535748371491
0.25534192122101
0.25534196284698
0.25534192122104
Fall 2006
130
CHAPTER 8. FAMILIES OF FUNCTIONS
0.0001
0.00008
0.00006
y
0.00004
0.00002
–1 –0.8 –0.6 –0.4 –0.2
0
0.2
0.4
0.6
0.8
1
x
Figure 8.6: Errors to approximations to tangent
Note that all are good to 4 decimal places and the Padé approximant is good to 13
decimal places.
8.6.1
CORDIC Algorithm
In 1959 James Volder developed the CORDIC algorithm in order to solve navigational
problems with onboard computers in large military planes. He was allowed to use
addition, subtraction, multiplication, division and a shift algorithm. With these he
had to be able to compute angles and their functions. Later this was used to find the
values of most of the elementary functions.
CORDIC stands for COordinate Rotation DIgital Computer. The algorithm uses
formulas for functions of a sum as a basis for a sequence of recursive computations.
This algorithm is used by Casio, TI, Sharp, and all current calculator manufacturers
and by Intel and Motorola for their coprocessors.
The idea of the CORDIC algorithm was to evaluate the tangent of an angle or
the arctangent of a real number. From there one can find the other functions.
Let’s see how the CORDIC algorithm is used to compute tan(θ). This is done in
several steps. Take an angle θ and rotate a vector over this angle towards zero in a
series of steps such that
1. the sum of all the steps taken equals θ, and
2. accumulate the corresponding x and y increments at each step so that in the
end xy = tan θ.
MATH 6101-090
Fall 2006
8.6. CORDIC ALGORITHM
131
To make the arithmetic simple and fast, you choose a set of angles φ(k) =
arctan(10−k ). The TI 82 used 14 digit arithmetic, so on that calculator we would
store the following 15 entry table:
k
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
10−k
1.
.1
.01
.001
.0001
.00001
.000001
.0000001
.00000001
.000000001
.0000000001
.00000000001
.000000000001
.0000000000001
.00000000000001
arctan(10−k )
.78539816339745
.09966865249116
.00999966668667
.00099999966667
.00009999999967
.00001000000000
.00000100000000
.00000010000000
.00000001000000
.00000000100000
.00000000010000
.00000000001000
.00000000000100
.00000000000010
.00000000000001
[13 digits]
index
.7853981633974
1
.0996686524912
2
.0099996666867
3
.0009999996667
4
.0000999999997
5
.0000100000000
6
.0000010000000
7
.0000001000000
8
.0000000100000
9
.0000000010000
10
.0000000001000
11
.0000000000100
12
.0000000000010
13
.00000000000010
14
15
The algorithm now is outlined as: Take θ to be between 0 and π/2 radians. To
compute Z = tan(θ)
set K=0
set X=1
set Y=0
while (θ 6= 0)
while(θ < arctan(10−k ))
K = K + 1
end while
θ=θ-arctan(10−k )
TEMP=X
X=X-10−k × Y
Y=Y+10−k × TEMP
end while
Z=Y/X
Why does this work? Well, the input angle, θ, defines a vector from the origin
whose length is fixed. The rotated coordinates X ′ and Y ′ as the vector rotates from
MATH 6101-090
Fall 2006
132
CHAPTER 8. FAMILIES OF FUNCTIONS
an initial position given by (X, Y ) are given by:
X ′ = X cos(θ) + Y sin(θ)
Y ′ = Y cos(θ) − X sin(θ)
X′
= X + tan(θ) × Y
cos(θ)
Y′
= Y − tan(θ) × X
cos(θ)
Now, we broke θ into successively smaller parts and stored the arctangent, arctan(10−k ),
for each part.
Now, the sine and cosine function come from the identities:
tan(θ)
sin(θ) = p
1 + tan2 (θ)
1
cos(θ) = p
1 + tan2 (θ)
Inverse Trigonometric Functions: To get the inverse tangent use the same constants as above. Enter with Y as the argument.
set K=0
set X=1
set θ=0
while (Y6= 0)
while(Y < 10−k × X)
K = K + 1
end while
θ=θ-arctan(10−k )
TEMP=X
X=X-10−k × Y
Y=Y+10−k × TEMP
end while
return
Exponential Functions: Use the constants: log(1 + 10−k ), k = 0, 1, 2 . . . . Then to
find the exponential value Y = exp(X), use the following algorithm with X as the
argument.
set K=0
set Y=1
while(K < 14)
Z=ln(1+10−k )
while X ≥ Z
X=X-Z
MATH 6101-090
Fall 2006
8.6. CORDIC ALGORITHM
133
Y=Y+10−k × Y
end while
K=K+1
end while
return Y
There are numerous references to the CORDIC algorithm on the Internet.
8.6.2
Alternative Method
There are many implementations of the CORDIC algorithm.
(X 3,Y 3)
(X 2,Y 2)
(X 2,Y 2)
w 2R 1
w 2X 1
R2
w 2Y 1
R1
Y 1=w 1R 0
α2
α1
(X 1,Y 1)
(X 1,Y 1)
α3
α2
X 1=R 0
(X 0,Y 0)=(1,0)
α1
(X 0,Y 0)
Suppose you want to find the trigonometric functions of a positive angle θ of less
than 360◦ . The algorithm finds acute angles α1 , . . . , αn so that θ ≈ α1 + α2 + · · · + αn ,
puts wi = tanαi and then performs the following calculations
X0 = 1, Y0 = 0,
Xi = Xi−1 − wi Yi−1 ,
Yi = Yi−1 + wi Xi−1 ,
for i = 1, 2, . . . , n. The situation for n = 3 is illustrated above. When this calculation is completed, the trigonometric functions of θ can be calculated using the usual
trigonometric formulas applied to the coordinates (Xn , Yn ). Note that (Xn , Yn ) is
probably not on the unit circle.
MATH 6101-090
Fall 2006
134
CHAPTER 8. FAMILIES OF FUNCTIONS
The computational power of the algorithm is enhanced by choosing α1 , α2 , . . . , αn
so that w1 , w2 , . . . , wn are simple one-significant digit numbers. Since most calculators
use decimal digits, each wi will be 10−k for some nonnegative integer k. For example if
Xi−1 = 0.4214 and Yi−1 = 0.6582 and wi = 0.0010, then the computations necessary
to compute Xi and Yi involve multiplication by 0.0010 which can be considered a shift
operation and addition or subtraction. If each wi is 10−k for some k, then αi must be
arctan(10−k . (In a binary computer each wk is 2−k and αk is arctan(2−k ) for some k.)
The approximate values for the numbers arctan 10−k for k = 0, 1, 2, . . . , m are stored
in the calculator where m is chosen with consideration to the number of digits of the
calculator.
To choose the particular αi for each given θ, the following procedure is often used.
Find the largest nonnegative integer q0 so that q0 arctan 1 < θ. If q0 is greater than
or equal to 1, then let α1 = α2 = · · · = αq0 = 45◦ (= arctan 1). Now find the largest
nonnegative integer ql so that
q0 arctan 1 + ql arctan 0.l ≤ θ.
If ql is greater than or equal to 1, then let all the αi from q0 + 1 to q0 + ql be arctan 0.l
which
5.71◦ . This process is continued until θ is approximately equal
Pk is approximately
to j=0 qj arctan 10−j .
Let’s apply this algorithm to compute tan 51◦ . First we need the basic values of
the αi ’s.
k
arctan 10−k
0
45◦
1
5.711◦
2
0.573◦
3
0.057◦
4
0.006◦
Now, 51◦ ≈ 45 ◦ +5.711 ◦ +0(.573◦) + 5(0.057◦) + 0(0.006◦), so we have that
q0 = 1, q1 = 1, q2 = 0, q3 = 5 and q4 = 0. Now, the computations are given in the
following table following the rules Xi = Xi−1 − wi Yi−1 and Yi = Yi−1 + wi Xi−1 :
i
0
1
2
3
4
5
6
7
αi
45◦
5.711◦
0.057◦
0.057◦
0.057◦
0.057◦
0.057◦
P
αi
45.000◦
50.711◦
50.768◦
50.825◦
50.882◦
50.939◦
50.996◦
wi
1
0.1
0.001
0.001
0.001
0.001
0.001
Xi
1.0000
1.0000
0.9000
0.8989
0.8978
0.8967
0.8956
0.8945
Yi
0.0000
1.0000
1.1000
1.1009
1.1018
1.1027
1.1036
1.1045
Now we can compute tan 51◦ ≈ Y7 /X7 = 1.1045/0.8945 ≈ 1.2348.
For angles greater than 360◦ or less than 0◦ , an appropriate (positive or negative)
multiple of 2π or 360◦ is added to the angle to bring it into the range of 0◦ to
MATH 6101-090
Fall 2006
8.6. CORDIC ALGORITHM
135
360◦ . Even though the algorithm has been described using degree measure, many
calculators and computers also compute with radian measure and many use only
radian measure internally. It turns out that many calculators do not accurately
compute the trigonometric functions of large numbers, greater than 1010 , because the
value of π used in the calculator to reduce the given number to between 0 and 2π is
only given to 10 to 13 significant figures.
Turning now to inverse trigonometric functions, suppose one of arcsin w, arccos w,
or arctan w is to be calculated, where there are restrictions on w for the first two. For
simplicity assume w is greater than 0. In each case there are nonnegative numbers x
and y so that x2 + y 2 = 1 and so that either y = w, x = w, or y/x = w, respectively.
In each case the measure of the angle θ whose tangent is y/x needs to be found.
One version of the algorithm does the following. Let (X0 , Y0) = (x, y), and calculate (X1 , Y1 ), (X2 , Y2), . . . , (Xn , Yn ) using the previous formulas where the αi are
chosen from the set {− arctan 1, arctan .1, − arctan .01, . . .} so that Yi gets small but
stays nonnegative. For example, if (x, y) = (X0 , Y0 ) = (.6, .8), αl = −45◦ , (X1 , Y1) =
(1.4, 0.2), α2 = − arctan .1 = −5.7◦ , (X2 , Y2 ) = (1.42, 0.06), α3 = − arctan 0.01,
etc. When the process is complete, θ = −(α1 +P
. . . αn ). Note that in this process
−j
nonnegative integers qi can be found so that θ ≈ m
j=0 qj arctan 10 .
Another version of the algorithm starts out with (X0 , Y0) = (1, 0) and computes
(Xi , Yi ) with a predetermined set of angles, except for sign, where the sign of each
angle is chosen by reference to the original coordinates (x, y). Knowing the length of
each (Xi , Yi) helps in the process.
For some other transcendental functions two different approaches are frequently
used. First an algorithm for hyperbolic trigonometric functions can be generated in
a similar manner to regular trigonometric functions. After hyperbolic trigonometric
functions are computed, exponentials and then logarithms can be generated using the
usual mathematical relationships.
ew = cosh w +
sinh w
1
w−1
log w = tanh−1
2
w+1
MATH 6101-090
Fall 2006
```