# 6. The pantheon of functions

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

## 6.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
- \[f(x) = \sqrt[n]{\frac{a_0 + a_1 x + a_2 x^2 + \dots + a_i x^i} {b_0 + b_1 x + b_2 x^2 + \dots + b_j x^j}}\]
- 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)\)

## 6.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
```

## 6.3. Rational functions

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

```
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:

```
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:

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.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 then becomes:\[f(x) \approx \frac{x^2}{x^3}\]which converges to zero at both plus and minus infinity. The second one becomes:

\[f(x) \approx \frac{3x^3}{-2x^3} = -\frac{3}{2}\]which converges to \(-3/2\) in both directions.

## 6.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 examione next is:

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.

## 6.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!

### 6.5.1. Exponentials and logarithms

Discussion of bases.

How fast to they grow? Compare polynomial growth with exponential growth:

```
gnuplot
# then at the gnuplot prompt:
reset
set grid
set xrange [0:4]
plot 10**x
replot x
replot x**2
replot x**3
replot x**4
replot x**5
replot x**6
replot x**7
```

in a web graphing calculator:

```
10^x
x
x^2
x^3
x^4
x^5
x^6
x^7
```

Then experiment with smaller bases for the exponential, and with longer ranges for x:

```
# in gnuplot:
reset
set grid
set xrange [-4:4]
plot 10**x
replot 2**x
# 2**x was tiny! how does it compare to polynomials?
plot 2**x
replot x**2
# zoom in closer:
set xrange [0:5]
plot 2**x
replot x**2
```

in a web graphing calculator:

```
2^x
x^2
```

And with very very small bases:

```
# in gnuplot:
set xrange [0:20]
plot 1.1**x
```

in a web graphing calculator:

```
x^1.1
1.1^x
```

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://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.

## 6.6. trigonometric functions

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

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

Then we discuss frequency, period, amplitude.

We then conclude with the resemblance that parts of sin and cos have with polynomials, and mention that in the future we will learn about Taylor series.

This discussion of approximation by polynomials allows us to point out that radians are the more natural unit of measure for angles.

## 6.7. Special functions

### 6.7.1. Gamma function

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:

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

### 6.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.