4. The pantheon of functions

Here we will take a broad tour of the types of functions that come up in typical applications.

4.1. Broad categories

A list of categories with some simple examples.

polynomials
\[f(x) = a_0 + a_1 x + a_2 x^2 + \dots + a_n x^n\]
rational functions
\[f(x) = \frac{a_0 + a_1 x + a_2 x^2 + \dots + a_n x^n} {b_0 + b_1 x + b_2 x^2 + \dots + b_k x^k}\]
algebraic functions
\begin{eqnarray} f(x) = & & \sqrt[n_1]{\frac{a_0 + a_1 x + a_2 x^2 + \dots + a_{i_1} x^{i_1}} {b_0 + b_1 x + b_2 x^2 + \dots + b_{j_1} x^{j_1}}} \\ & + & \sqrt[n_2]{\frac{c_0 + c_1 x + c_2 x^2 + \dots + c_{i_2} x^{i_2}} {d_0 + d_1 x + d_2 x^2 + \dots + d_{j_2} x^{j_2}}} \\ & + & \dots \end{eqnarray}
elementary transcendental functions
exp/log:

\(e^x\), \(a^x\), \(\log(x)\), …

trig:

\(\sin(\theta)\), \(\cos(\theta)\), \(\tan(\theta)\), …

inverse trig:

arcsin(x), arccos(x), arctan(x)

hyperbolic:

\(\sinh(x)\), \(\cosh(x)\), \(\tanh(x)\), …

inverse hyperbolic:

arcsinh(x), arccosh(x), arctanh(x)

special functions

Gamma function \(\Gamma(x)\), Bessel functions \(J_n(x)\), Dirac delta function \(\delta(x)\), error function \({\rm erf}(x)\)

arithmetic functions (argument is an integer)

Prime-counting function \(\pi(n)\)

4.2. Polynomials

We have already seen many examples of polynomials, so here we only list a couple of plotting examples. First for gnuplot locally on your computer:

# for gnuplot
gnuplot
# then at the gnuplot> prompt type:
set grid
set xrange [-3:3]
plot x**3 - 3*x
replot x**3 - 3*x**2 - 4*x + 12

The same formulas for a web calculator like GeoGebra or Desmos:

x^3 - 3 x
x^3 - 3 x^2 - 4 x + 12

4.3. Rational functions

Rational functions are ratios of polynomials. Let us start plotting an example:

\[f(x) = \frac{x^2 - 4 x + 2} {x^3 - 3 x}\]
gnuplot
# then at the gnuplot> prompt type:
reset
set grid
set samples 1000
set yrange [-100:100]
set xrange [-5:5]
f(x) = (x**2 - 4*x + 2) / (x**3 - 3*x)
plot f(x)

And in web graphical calculators:

(x^2 - 4 x + 2) / (x^3 - 3 x)

Let us now unpack what we have been looking at.

First of all, the function is not defined everywhere! The denominator is zero in three places \((-\sqrt{3}, 0, \sqrt{3})\) which means that the overall function is not defined (or, as we often say, it “blows up”) at those three points. This is clear in the graph.

The function also has asymptotic behavior, the behavior when \(x\) goes very far in the positive or negative direction (or, as we often say, when \(x\) goes to plus or minus infinity: \(x \rightarrow \pm\infty\)).

Asymptotic behavior is a matter of seeing whether the numerator or denominator dominates, which depends on which has the higher power.

Now in class we experiment with rational functions that have higher, lower, or equal powers in the numerator versus the denominator.

One way to do that is to change \(x^2\) (in the numerator polynomial) to \(x^3\) and observe the asymptotic behavior. Then go to \(x^4\) and observe it again.

Another example would be:

\[f(x) = \frac{3x^3 - 5 x + 1} {-2x^3 + x + 1}\]
gnuplot
# then at the gnuplot> prompt type:
reset
set grid
set samples 1000
set yrange [-100:100]
set xrange [-5:5]
f(x) = (3*x**3 - 5*x + 1) / (-2*x**3 + x + 1)
plot f(x)

And in web graphical calculators:

(3 x^3 - 5 x + 1) / (-2 x^3 + x + 1)

I like to state a couple of take-home messages when I teach this material:

  1. The “close-by” behavior, around the origin, has two main features: roots (where we cross the x axis) and singularities (places where the function blows up). The roots are determined by zeros in the numerator, while the singularities are determined by roots in the denominator.

  2. The asymptotic behavior, as \(x \rightarrow \pm\infty\), is determined by ignoring all but the highest power of x, both above and below. Our first fraction \(f(x) = \frac{x^2 - 4 x + 2} {x^3 - 3 x}\) then becomes:

    \[f(x) \approx \frac{x^2}{x^3}\]

    which converges to zero at both plus and minus infinity. The second one \(f(x) = \frac{3x^3 - 5 x + 1}{-2x^3 + x + 1}\) becomes:

    \[f(x) \approx \frac{3x^3}{-2x^3} = -\frac{3}{2}\]

    which converges to \(-3/2\) in both directions.

This has shown us a horizontal asymptote that is flat but not zero.

Next: increase the leading power on the numerator to get \(x^4\) and visualize the diagonal asymptotic behavior to the straight line \(y = -(3/2) x\).

Finally: increase that power again to \(x^5\) and look at how the function asymptotiaclly approaches the parabola \(y = -(3/2)x^2\) when \(x \rightarrow \pm\infty\).

4.4. Algebraic functions

These can have roots in addition to all the rational function components.

We can plot \(y = \sqrt{x}\) and discuss its behavior, then moving to \(\sqrt{x^3 - 3 x}\), just to see what they look like. There is no particular insight here, but it is worth mentioning that \(\sqrt{x}\) does grow to infinity, but it slows down a lot compared to \(x\).

An interesting plot to examine next is:

\[y = \sqrt{3 + x^2}\]

After discussing what happens when x gets very big (i.e. you can neglect the 3), you can then comment on how at \(x = 0\) we seem to have curvy behavior, but then the line seems to straighten out. We can graph the following three separately:

sqrt(3 + x^2)
x
-x

to see a neat effect.

4.5. Elementary transcendental functions

Start with a discussion of why they are called transcendental, possibly mentioning what the distinction is between algebraic and transcendental numbers.

Then get in to examples and pictures!

4.5.1. Exponentials and logarithms

The big challenge here is: how do you get people to understand logarithms well? You can give the definition, but it might not stick in someone’s mind.

The way I approach it when I teach is to start with the exponential and flesh that discussion out a bit more.

4.5.1.1. Real number exponents

In learning about taking powers we have gone through the following phases:

digraph "sphinx-ext=graphviz" {
   rankdir="LR";
   remincross = false;      # needed so we don't re-order nodes
   newrank = true;

   node [shape=box fillcolor="red:yellow" style="filled" gradientangle=90];

   edge [lblstyle="sloped"];
   "Natural number exponents (positive integers)"
   ->
   "All integers (including 0 and negative integers)"
   ->
   "Rational numbers (related to roots)"
   ;
}

We now need to move on to allowing any real number \(x\) in the expression \(a^x\).

I might remind them of how we built up from postitive integer exponents to then allow zero (\(x^0 = 1\)) and negative integer (\(b^{-3} = 1/b^3\)) exponents.

Then we built up fractional epxonents: \(a^{m/n}=\sqrt[n]{a^m}\). There were good reasons for all of these new notations, and we discussed it in detail at the start of the course in the section The “why” of messy exponents

Now we come to having real number exponents: \(a^x\) (for any real number \(x\), in particular the irrational values that cannot be written as \(m/n\)). How do we justify and calculate this? We can take a moment to discuss an important math principle:

Even though an irrational number \(x\) cannot be written as a fraction \(m/n\), you can approximate \(x\) arbitrarily closely with rational numbers.

An example of this is \(pi\). You can start with:

\[\pi \approx 3.14\]

and note that \(314 = 314 / 100\):

\[\pi \approx 3.14 = \frac{314}{100}\]

This idea can be taken far and can make arbitrarily good approximations:

\begin{eqnarray} \pi & \approx & 3.14159 = \frac{314159}{100000} \\ \pi & \approx & 3.1415926 = \frac{31414159265}{10000000000} \\ \pi & \approx & 3.14159265358979323846 = \frac{314159265358979323846}{100000000000000000000} \\ \end{eqnarray}

This gives us a reasonable way of thinking of \(a^x\) for irrational values of \(x\): we can come arbitrarily close to it using fractions that get closer and closer to \(x\).

4.5.1.2. Bases for exponential

Discuss base 10 (humans have 10 fingers), base 2 (transistor-based latches have 2 states), and \(e\) (the mathematically intrinsic base).

The first two bases are straightforward to introduce and discuss - I mention that in base 10 we have those preferred multiple-of-three bases:

\(10^3\)

one thousand - kilo

\(10^6\)

one million - mega

\(10^9\)

one billion - giga

\(10^{12}\)

one trillion - tera

\(10^{15}\)

one thousand trillion - peta

The other thing to notice is that the exponents stay small when the numbers get huge. We will refer to this “Chekhov’s factoid” when we introduce logarithms.

4.5.1.3. How do they grow?

How fast to they grow? Compare polynomial growth with exponential growth in a web graphing calculator:

x^2
x^5
2^x
e^x

After exploring how these overtake each other, we add \(x^7\) to the plot and see how long it takes for the exponential to overtake that. We can also throw \(10^x\) in for comparison. Those two polynomials and two exponentials should be enough to develop an intuition for exponential versus polynomial growth.

You can then add \(x!\) and \(1.1^x\) for extra fun and exploration.

4.5.1.4. A brief digression on polynomial approximations to the exponential

Plot the following:

e^x
1
1 + x
1 + x + x^2/2!
1 + x + x^2/2! + x^3/3!
1 + x + x^2/2! + x^3/3! + x^4/4!
1 + x + x^2/2! + x^3/3! + x^4/4! + x^5/5!

4.5.1.5. What phenomena are expressed with exponentials?

Unbounded population growth

If \(P_0\) is the initial population, and \(r\) is the growth rate (think of fertility), then:

\[P(t) = P_0 e^{r t}\]

Caution

Don’t ever believe such a simplistic formula! It is based on the assumption that you have (a) no predators, (b) infinite food, (c) no crowding.

Realistic growth

The formula for more realistic growth is called the logistic formula and looks like this:

\[P(t) = \frac{K}{1 + \left(\frac{K-P_0}{P_0}\right)e^{-rt}}\]

This curve has a sigmoid shape. Initially it seems to have exponential growth, but at a certain point realistic damping factors set in and the growth tapers off. The parameter \(K\) is the “carrying capacity” of the ecosystem - the maximum that the population could reach given food, space, and predator constraints.

Advanced peek

Unbounded exponential population growth and logi comes from these differential equations:

\begin{eqnarray} \frac{d P(t)}{dt} & = & r P(t) \\ \frac{d P(t)}{dt} & = & r P(t) \left(1 - \frac{P(t)}{K}\right) \end{eqnarray}

4.5.1.6. The logarithm - inverting the exponential

This is the introduction that needs to be done carefully. I like to explain it by writing down:

\begin{eqnarray} 2^4 = 16 \\ 2^5 = 32 \\ 2^8 = 256 \\ 2^{10} = 1024 \\ 2^{16} = 65536 \end{eqnarray}

Then I write:

\begin{eqnarray} 2^? = 16 \\ 2^? = 32 \\ 2^? = 256 \\ 2^? = 1024 \\ 2^? = 65535 \end{eqnarray}

and I ask what exponent would be needed to get those (sometimes big) numbers on the right hand side.

This then tells us that:

\[\log_2 1024 = 10\]

and so forth.

One use for logarithms is to compress the axis in a plot. To motivate the use of log in plots:

What if you have something that grows fast. Look at internet sites:

https://web.archive.org/web/20110614121350/http://www.isc.org/solutions/survey/history

https://www.isc.org/survey/

https://en.wikipedia.org/wiki/List_of_sovereign_states_by_number_of_Internet_hosts

and possibly from Our World in Data.

Also look at history of human population.

An application of the logarithm is to note that it breaks down powers and multiplications into lower-order operations:

\begin{eqnarray} \log(a \times b) & = & \log a + \log b \\ \log x^n & = & n \log x \end{eqnarray}

This is what allowed people to create precomputed tables of logarithms, and use those to reduce powers to multiplication, and multiplication to addition. This was standard until electronic calculators came along.

4.6. trigonometric functions

A detour to talk about radians versus degrees. This is covered in Section 2.5.1.

We first learn to plot sin, cos, and tan. The others are not really important. We plot them over several periods.

The plotting allows us to point out that radians are the more natural unit of measure for angles.

Then we discuss frequency, period, amplitude.

We can then show the resemblance that parts of sin and cos have with polynomials, and mention that in the future we will learn about Taylor series. This will reinforce how radians are the ideal units.

4.6.1. What phenomena are expressed with trigonometric functions?

Simple harmonic oscillator

You have a mass \(m\) on a spring with spring constant \(k\)

../_images/mass-on-spring.png

Idealized simple harmonic oscillator.

Now you pull the mass a distance \(A\) away from its rest position and then let go. The position of the spring will follow this trajectory:

\[x(t) = A \cos\left(\sqrt{\frac{k}{m}} t\right)\]

Caution

Don’t ever believe such a simplistic formula! It is based on the assumption that you have no friction.

Damped harmonic oscillator

If you have friction then you often get the damped harmonic oscillator, which gives the solution:

\[x(t) = A e^{-\lambda t} cos(\omega t)\]

where \(\lambda\) relates to the friction, and \(\omega = \sqrt{(k/m)^2 - (\lambda/(2m))^2}\)

Advanced peek

\begin{eqnarray} \frac{d^2x(t)}{dt^2} & = & - \left(\frac{k}{m}\right) x(t) \\ \frac{d^2x(t)}{dt^2} & = & -\lambda \frac{d x(t)}{dt} - \left(\frac{k}{m}\right) x(t) \\ \end{eqnarray}

4.6.2. Trigonometric identities

\begin{eqnarray} & & \tan \theta = \frac{\sin x}{\cos x} \\ & & \sin^2 \theta + \cos^2 \theta = 1 \\ & & \;\;\;\; \textrm{which implies:} \rightarrow \;\;\; \sin\theta = \pm \sqrt{1-cos^2\theta} \\ & & \;\;\;\; \textrm{and:} \;\;\; \cos\theta = \pm \sqrt{1-\cos^2\theta} \\ & & \sin(\alpha + \beta) = \sin \alpha \cos \beta + \cos \alpha \sin \beta \\ & & \sin(\alpha - \beta) = \sin \alpha \cos \beta - \cos \alpha \sin \beta \\ & & \cos(\alpha + \beta) = \cos \alpha \cos \beta - \sin \alpha \sin \beta \\ & & \cos(\alpha - \beta) = \cos \alpha \cos \beta + \sin \alpha \sin \beta \\ ... \end{eqnarray}

More at:

https://en.wikipedia.org/wiki/List_of_trigonometric_identities

4.6.3. An important application: law of cosines

Generalize the pythagoras theorem:

\begin{eqnarray} h^2 & = & a^2 + b^2 \\ & \rightarrow & \\ h^2 & = & a^2 + b^2 - 2 a b \cos(\theta) \end{eqnarray}

Now do exercises from this chapter:

https://openstax.org/books/algebra-and-trigonometry-2e/pages/10-2-non-right-triangles-law-of-cosines

4.7. Special functions

4.7.1. Gamma function

\[\Gamma(n) = (n-1)!\]

The full definition of the gamma function for all real (and in fact complex) numbers is more advanced. I show it here, but it is a subject for much later on:

\[\Gamma(z) = \int_0^\infty x^{z-1} e^{-x} dx\]

Now discuss gamma function (and factorial) growth compared to polynomial and exponential. Refer to Section 2.4

4.7.2. Other special functions

Unfortunately it is hard to demonstrate these in the web graphing calculators, so we will leave it out for now.