Skip to main content
Logo image

Chapter 5 Step functions

Section 5.1 Concept

Example 5.1.1. Inflating a raft.

You bring an inflatable raft on a trip to the lake, along with a portable air pump to inflate it. The air pump has three settings:
  • low (0.25 m3min)
  • medium (0.5 m3min)
  • high (0.75 m3min).
Notice that the specification for each of the three settings is given in volume-per-unit-time, so these are inflation rates.
You run the pump at medium for one minute, but it’s taking too long so you bump it up to high. After two minutes on high, the raft is nearly inflated but the pump seems like it’s getting a bit hot as it works to counter-act the tendency of the raft to want to deflate, so you switch it to low for one more minute before turning it off.
Graph modelling output of an air pump with three settings.
Figure 5.1.2. Graph modelling output of an air pump with three settings.
The model rate function graphed in Figure 5.1.2 is an example of a step function.

Definition 5.1.3. Step function.

A function that “steps” between constant values on non-overlapping intervals.
A function can only take on one output value at any given input value, which is why we have an open circle at the endpoint of each line segment in the graph in Figure 5.1.2. For example, if we call that inflation rate function \(r\text{,}\) then \(r(3) = 0.25\) but \(r(2.9999) = 0.75\text{.}\) Of course, this function is just a model of the behaviour of the air pump described in Example 5.1.1 — we could have put open circles at the beginnings of the line segments and closed ones at the ends instead, and it wouldn’t affect our analysis of the inflation of the raft.
To describe a step function, we use piecewise notation to specify the constant output values on different subdomains.

Example 5.1.4. Describing a step function.

Here is the graph of another step function.
Graph of an example step function.
Figure 5.1.5. An example step function.
There is no single constant value or formula that describes the function’s output values at every possible input value, so we describe the function’s output values using different output values on different subdomains.
\begin{equation*} f(t) = \begin{cases} 0 \amp t \lt 0 \\ 1 \amp 0 \le t \lt 1 \\ 2 \amp 1 \le t \lt 2 \\ 3 \amp 2 \le t \lt \pi \\ \sqrt{2} \amp \pi \le t \lt 4.5 \\ 0 \amp t \ge 4.5 \end{cases} \end{equation*}
Suppose we wanted to determine the output value \(f(\sqrt{3})\) without the graph in front of us. We would first scan the subdomains in the right column, and notice that the input \(t = \sqrt{3}\) falls into the subdomain \(1 \le t \lt 2\text{.}\) Matching up this subdomain with its specified output value, we find that \(f(\sqrt{3}) = 2\text{.}\)
The simplest situation to deal with is a step function that “steps” at regular intervals.

Definition 5.1.6. Regular step function.

A step function whose domain can be split into equal-length intervals so that the “steps” in output value only occur at boundaries between these intervals.
The step function in Example 5.1.4 is not regular — the steps in output value from \(1\) to \(2\) and from \(2\) to \(3\) both occur after intervals of length \(1\text{,}\) but the next two steps in output value occur after intervals of length greater than \(1\text{.}\) Because the irrational number \(\pi\) is involved in these longer two interval lengths, there is no way to subdivide all these intervals into equal-length intervals so that output-value changes only occur at interval boundaries.
On the other hand, the air pump model in Example 5.1.1 is regular because we can split the middle interval in half, and then changes in output-value still only occur at boundaries of these length-\(1\) intervals.
Graph modelling output of an air pump with three settings.
Figure 5.1.7. Graph modelling output of an air pump with three settings.

Section 5.2 Accumulation for a stepped rate function

Subsection 5.2.1 Calculation pattern

When a rate function is known to be constant, computing accumulation is easy:
\begin{equation*} \text{amount} = \text{rate} \times \text{duration} \text{.} \end{equation*}
When a quantity changes with a rate function that can be modelled by a step function, then the rate function is not constant over its entire domain because it is not always the same rate value for all time. However, a stepped rate function is constant over specific subdomains, so we can still apply the above formula on each of those subdomains and then total up all of those partial accumulations.
Example 5.2.1. Inflated raft.
For the situation described in Example 5.1.1, how much air has been pumped into the raft? To answer this question, we will split the inflation time period up.
During the first minute when the pump is run on the medium setting, pumping air at a rate of 0.5 m3min for one minute accumulates
\begin{equation*} (0.5 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min}) = 0.5 \unitsp \mathrm{m}^3 \end{equation*}
of air in the raft.
Over the next two minutes, when the air pump is on the high setting, we accumulate an additional
\begin{equation*} (0.75 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (2 \unitsp \mathrm{min}) = 1.5 \unitsp \mathrm{m}^3 \end{equation*}
of air in the raft.
Finally, over the final minute on the low setting, we accumulate an additional
\begin{equation*} (0.25 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min}) = 0.25 \unitsp \mathrm{m}^3 \end{equation*}
of air in the raft.
The total accumulation of air in the raft is the total of the calculations.
\begin{align*} \text{TOTAL} \amp = (0.5 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min})\\ \amp \phantom{=} + (0.75 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (2 \unitsp \mathrm{min})\\ \amp \phantom{=} + (0.25 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min})\\ \amp = (0.5 + 1.5 + 0.25) \unitsp \mathrm{m}^3 \\ \amp = 2.25 \unitsp \mathrm{m}^3 \text{.} \end{align*}
Remember that we can have a rate function where the independent variable represents something other than time.
Example 5.2.2. Accumulation of cost.
You are ordering a quantity of saffron, a very expensive spice, for your bulk food preparation business. The supplier offers a discount scheme based on the amount you order:
  • The first 500 g ordered is priced at $3.00 per gram.
  • Any additional amount ordered above 500 g is priced at $2.75 per gram, for orders up to 1 kg total. For example, if an order of 600 g is placed, then only the additional 100 g quantity is charged at $2.75 per gram, while the “initial” quantity of 500 g is still charged at $3.00 per gram.
  • Any additional amount above 1 kg is priced at $2.50 per gram.
The pricing model can be considered a rate function, where the inputs are in units of grams, and the outputs are in units of dollars-per-gram.
Graph for a saffron pricing model.
Figure 5.2.3. Graph for a saffron pricing model.
In this pricing model, the total “accumulated” cost of your order of 1.2 kg is
\begin{align*} \text{COST} \amp = (3.00 \unitsp \$ / \mathrm{g}) \times (500 \unitsp \mathrm{g})\\ \amp \phantom{=} + (2.75 \unitsp \$ / \mathrm{g}) \times (500 \unitsp \mathrm{g})\\ \amp \phantom{=} + (2.50 \unitsp \$ / \mathrm{g}) \times (200 \unitsp \mathrm{g})\\ \amp = \$ 1500 + \$ 1375 + \$ 500 \\ \amp = \$ 3375 \text{.} \end{align*}

Subsection 5.2.2 Geometric interpretation

Consider what the calculations in Example 5.2.1 represent on the graph of the inflation rate function. On each subdomain, we used the constant-rate accumulation formula
\begin{equation*} \text{amount} = \text{rate} \times \text{duration} \text{.} \end{equation*}
The rate represents the height of the graph on that particular subdomain, while the duration represents the length of time that this rate was in effect. Geometrically, the product of a height and a length represents the area of a rectangle:
\begin{equation*} \text{area} = \text{height} \times \text{length} \text{.} \end{equation*}
So each partial accumulation calculation in Example 5.2.1 corresponds to an area of a rectangle related to the graph of the stepped rate function. Let’s see exactly how.
First, suppose we actually turned the air pump off after the first minute of running on the medium setting. The accumulation formula
\begin{equation*} \text{air accumulation} = (0.5 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min}) \end{equation*}
corresponds to an area calculation for a rectangle of height \(0.5\) and length \(1\text{.}\)
Graph modelling output of an air pump for one minute.
Figure 5.2.4. Running the air pump on medium for one minute.
Now let’s take into account the additional two minutes running on high. The accumulation formula
\begin{equation*} \text{air accumulation} = (0.75 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (2 \unitsp \mathrm{min}) \end{equation*}
corresponds to an area calculation for a rectangle of height \(0.75\) and length \(2\text{.}\)
Graph modelling output of an air pump for another two minutes.
Figure 5.2.5. Running the air pump on high for another two minutes.
Finally, the accumulation formula
\begin{equation*} \text{air accumulation} = (0.25 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min}) \end{equation*}
for the final minute running on low corresponds to an area calculation for a rectangle of height \(0.25\) and length \(1\text{.}\)
Graph modelling output of an air pump for another one minute.
Figure 5.2.6. Running the air pump on high for the final minute.
For the total accumulation, we added up the results of these three calculations. Graphically, the total accumulation corresponds to the total area of the rectangles formed between the stepped rate function’s levels and the \(t\)-axis.
Graph modelling total accumulation pumped air.
Figure 5.2.7. Total accumulation over the time period.
Warning 5.2.8.
We talk above about accumulation corresponding to area, but the results of each of our accumulation calculations in Example 5.2.1 are in units of \(\mathrm{m}^3\text{,}\) not \(\mathrm{m}^2\) — why is that?
It is important to maintain a distinction between
  • the actual physical quantity whose accumulation we are determining (in Example 5.2.1, this is a volume of air in units of \(\mathrm{m}^3\))
  • the graphical area formed by creating rectangles under the different levels of the step function.
We are making a graphical connection between the two product calculations
\begin{gather*} \text{amount} = \text{rate} \times \text{duration} \\ \text{area} = \text{height} \times \text{length} \end{gather*}
by interpreting each rate value as a height and each time duration as a length on the rate graph. Through this correspondence between the two formulas above, the magnitudes of accumulation and graphical area will be the same, but their units of measurement will not coincide.
Example 5.2.9.
On a car trip from Camrose to Wetaskiwin, it takes the driver 6 min at the posted Camrose city speed limit of 50 kmh to get out onto the highway, then 24 min at the posted highway speed limit of 100 kmh to reach Wetaskiwin, and another 9 min at the posted Wetaskiwin city speed limit of 50 kmh to reach the final destination.
With this model, our rate function is stepped.
Graph of a rate-of-travel model.
Figure 5.2.10. Graph of a rate-of-travel model.
(Note that minutes have been converted into hours for the graph.)
Computing the total distance travelled is the same as calculating the total area of the three rectangles in Figure 5.2.10:
\begin{align*} \text{TOTAL DISTANCE} \amp = (50 \unitsp \mathrm{km} / \mathrm{hr}) \times (0.1 \unitsp \mathrm{hr})\\ \amp \phantom{=} + (100 \unitsp \mathrm{km} / \mathrm{hr}) \times (0.4 \unitsp \mathrm{hr})\\ \amp \phantom{=} + (50 \unitsp \mathrm{km} / \mathrm{hr}) \times (0.15 \unitsp \mathrm{hr})\\ \amp = (5 + 40 + 7.5) \unitsp \mathrm{km} \\ \amp = 52.5 \unitsp \mathrm{km} \text{.} \end{align*}
Remark 5.2.11.
Keep in mind that the stepped rate function in Example 5.2.9 is a simplified model. In reality, a car cannot change its rate of travel instantaneously, and so our rate graph should have periods of increasing speed (that is, acceleration) and periods of decreasing speed (that is, deceleration). Moreover, it is unlikely the car was travelling at exactly 50 kmh during the city portions of the trip, or at exactly 100 kmh during the highway portion — in reality there would have been dips and rises in the rate graph, as the car went up or down hills, around corners, or was stuck behind or pulled out to pass slower-moving vehicles. However, often a simplified model is good enough, and trying to take into account all of the little variations in velocity during the trip might be too complicated for the simple purpose of estimating the distance travelled.
In fact, we will learn in the next chapter how estimating accumulation using simplified models involving stepped rate functions can actually help us to calculate accumulation exactly for more complicated models.
Checkpoint 5.2.12. Accumulation of cost.
In Example 5.2.2, we analyzed a purchasing scenario with a rate function describing variation in cost per unit mass, (whereas our other examples have all involved variation per unit time). Do you see how the total cost calculation in that example corresponds to a sum of areas of rectangles on the rate function graph?

Subsection 5.2.3 Oriented area

What if the rate is sometimes negative?
Example 5.2.13. Punctured raft.
One minute after inflating your raft (as in Example 5.1.1), a previously patched leak begins leaking again at a rate of 0.2 m3min, and three minutes pass before you notice, quickly slap a piece of tape over the leak, and turn the air pump back on to medium for two minutes. (We’ll assume in our simplified model that all of this happens instantaneously.)
How much air is in the raft now? We just have to repeat the calculation of Example 5.1.1, but take into account the periods of air-loss and re-inflation.
\begin{align*} \text{TOTAL} \amp = (0.5 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min})\\ \amp \phantom{=} + (0.75 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (2 \unitsp \mathrm{min})\\ \amp \phantom{=} + (0.25 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min})\\ \amp \phantom{=} - (0.2 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (3 \unitsp \mathrm{min})\\ \amp \phantom{=} + (0.5 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (2 \unitsp \mathrm{min})\\ \amp = (0.5 + 1.5 + 0.25 - 0.6 + 1) \unitsp \mathrm{m}^3 \\ \amp = 2.65 \unitsp \mathrm{m}^3 \text{.} \end{align*}
Can we still interpret the calculation in Example 5.2.13 as a sum of rectangle areas on the rate graph? While leaking air, the amount of accumulated air in the raft is decreasing, and so we should interpret the rate of air leakage as a negative rate of variance. The static period between the initial inflation and the start of the leakage could also be interpreted as a period with rate 0 m3min.
\begin{align*} \text{TOTAL} \amp = (0.5 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min})\\ \amp \phantom{=} + (0.75 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (2 \unitsp \mathrm{min})\\ \amp \phantom{=} + (0.25 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min})\\ \amp \phantom{=} {\color{red} + (0 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (1 \unitsp \mathrm{min}) }\\ \amp \phantom{=} {\color{red} + (-0.2 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (3 \unitsp \mathrm{min}) }\\ \amp \phantom{=} + (0.5 \unitsp \mathrm{m}^3 / \mathrm{min}) \times (2 \unitsp \mathrm{min})\\ \amp = \bigl( 0.5 + 1.5 + 0.25 + 0 + (-0.6) + 1 \bigr) \unitsp \mathrm{m}^3 \\ \amp = 2.65 \unitsp \mathrm{m}^3 \text{.} \end{align*}
If we allow rectangles to be assigned negative area and also consider a line segment along the horizontal axis as a rectangle with height \(0\text{,}\) then the above calculation is still a sum of rectangle areas.
Graph modelling inflating, partially deflating, and re-inflating an air raft.
Figure 5.2.14. Inflating and re-inflating an air raft.
Definition 5.2.15. Positively-oriented area.
If a function is positive on a domain, then the area bounded between the graph of the function and the horizontal axis over that domain is positively-oriented and we assign positive number to that area.
A diagram of a positively-oriented area under the graph of a function.
Figure 5.2.16. A positively-oriented area.
Definition 5.2.17. Negatively-oriented area.
If a function is negative on a domain, then the area bounded between the graph of the function and the horizontal axis over that domain is negatively-oriented and we assign a negative number to that area.
A diagram of a negatively-oriented area under the graph of a function.
Figure 5.2.18. A negatively-oriented area.

Section 5.3 Sigma notation

Subsection 5.3.1 Summing patterns

In the examples in this section, total accumulation was calculated as a sum of products. The situation of calculating a sum where each term in the sum follows a pattern comes up a lot in mathematics, so mathematicians have developed a special notation for it.
Sigma notation.
If we write \(P(k)\) to mean a calculation formula or pattern in the variable \(k\text{,}\) then we can write
\begin{equation*} \sum_{k = 1}^n P(k) \end{equation*}
to represent the sum
\begin{equation*} P(1) + P(2) + P(3) + \dotsb + P(n) \text{.} \end{equation*}
The Greek letter \(\Sigma\) stands for “Sum”, the variable \(k\) is called the index variable for the sum, and the “start” and “end” values \(1\) and \(n\) are called the lower bound and upper bound, respectively, for the summation.
Note 5.3.1.
The Greek letter \(\Sigma, \sigma\) is called “sigma”, where \(\Sigma\) is the uppercase version and \(\sigma\) is the lower case version. This letter corresponds to the letter S in the English alphabet, hence its use to represent a Sum.
Example 5.3.2. Sum of squares.
Consider the sum-of-squares formula
\begin{equation*} 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 \text{.} \end{equation*}
Recognizing each term in the sum as a square number, we can express each term as the result of the pattern
\begin{equation*} P(k) = k^2 \end{equation*}
for increasing integer values of the variable \(k\text{:}\)
\begin{equation*} 1^2 + 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + 7^2 + 8^2 + 9^2 + {10}^2 \text{.} \end{equation*}
Based on this pattern, we can compactly express the above sum of squares using Sigma notation:
\begin{equation*} \sum_{k = 1}^{10} k^2 \text{.} \end{equation*}
While we used the value \(k = 1\) as sort of a “default” start value in the definition of Sigma notation above, we can use any start value we like, according to the summation pattern we are trying to describe.
Example 5.3.3. Different starting value.
Here is another sum-of-squares formula:
\begin{equation*} 16 + 25 + 36 + 49 + 64 + 81 + 100 \text{.} \end{equation*}
Since this summation pattern begins at the square of \(4\text{,}\) our Sigma-notation version of this sum is
\begin{equation*} \sum_{k = 4}^{10} k^2 \text{.} \end{equation*}
Example 5.3.4. Summing a constant value.
Summing a constant value is, by definition, the same as multiplication (which is why we say “times”).
\begin{align*} \sum_{k = 1}^{6} 2 \amp = 2 + 2 + 2 + 2 + 2 + 2 \\ \amp = 6 \times 2 \\ \amp = 12 \end{align*}
Take care when counting an indexed collection: the number of objects is
\begin{equation*} (\text{ending index value}) - (\text{starting index value}) + 1 \text{.} \end{equation*}
The “\(+ 1\)” is required because in the subtraction we have “taken away” every object up to and including the one indexed by the “starting index value,” but we actually want to include that “starting” object in the collection being counted. For example, if we have a sum indexed from \(k = 1\) to \(k = n\text{,}\) then we are adding up \(n\) terms, not \(n - 1\) terms.

Subsection 5.3.2 Properties of Sigma notation

Keep in mind that calculating with Sigma notation is really just addition, so every algebra rule for addition can be applied to Sigma notation.
Example 5.3.6. Sum of evens.
Suppose we want to sum a collection of even numbers:
\begin{equation*} 2 + 4 + 6 + 8 + 10 \text{.} \end{equation*}
While there are variations of Sigma notation where the index variable may “step” by more than \(1\text{,}\) we can avoid that by expressing each of our even numbers as \(2\) times a number that increases by only \(1\) from term to term:
\begin{equation*} 2 \cdot 1 + 2 \cdot 2 + 2 \cdot 3 + 2 \cdot 4 + 2 \cdot 5 \text{.} \end{equation*}
In Sigma notation, this sum can be expressed as
\begin{equation*} \sum_{k = 1}^{5} 2 k \text{.} \end{equation*}
However, we also know that a common factor can be factored out of a sum:
\begin{equation*} 2 (1 + 2 + 3 + 4 + 5) \text{.} \end{equation*}
This formula is \(2\) times a sum, so we can express it as \(2\) times a Sigma expression:
\begin{equation*} 2 \sum_{k = 1}^{5} k \text{.} \end{equation*}
Warning 5.3.8.
Only a constant may be factored out of Sigma notation — any expression involving the index variable \(k\) cannot be factored out, because if the sum were written out that variable part would be different from term to term and so would not actually be a common factor.
As well as factoring out of sums, we also know that we may perform a series of additions in any order and with any groupings we wish.
Example 5.3.9. Summing two patterns.
Consider the sum
\begin{equation*} 2 + 6 + 12 + 20 + 30 + 42 + 56 + 72 + 90 + 110 \text{.} \end{equation*}
It may not be obvious at first glance, but is the summation from Example 5.3.2 with each term increased by its index:
\begin{equation*} (1^2 + 1) + (2^2 + 2) + (3^2 + 3) + \dotsb + (10^2 + 10) \text{.} \end{equation*}
In Sigma notation, this can be written
\begin{equation*} \sum_{k = 1}^{10} (k^2 + k) \text{.} \end{equation*}
But we would come to the same result if we added all the squares first, and then added to that result the sum of the extra bits:
\begin{equation*} (1^2 + 2^2 + 3^2 + \dotsb + 10^2) + (1 + 2 + 3 + \dotsb + 10) \text{.} \end{equation*}
We can write each of the bracketed Sigma expressions in Sigma notation separately:
\begin{equation*} \sum_{k = 1}^{10} k^2 + \sum_{k = 1}^{10} k \text{.} \end{equation*}
Example 5.3.11. Breaking up a sum.
Again consider the sum-of-squares pattern
\begin{equation*} 1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100 \text{.} \end{equation*}
We can put brackets around any portions of the sum without changing the result:
\begin{equation*} (1 + 4 + 9 + 16 + 25 + 36) + (49 + 64 + 81 + 100) \text{.} \end{equation*}
So this same sum that we expressed in Example 5.3.2 using a single Sigma expression can be re-expressed using two Sigma expressions, if we had some particular reason for wanting to do so:
\begin{equation*} \sum_{k = 1}^{6} k^2 + \sum_{k = 7}^{10} k^2 \text{.} \end{equation*}

Subsection 5.3.3 Summing in Sage

Summation based on a pattern can be performed in Sage. The syntax is below.
	sum(pattern, variable, start, end)

For example, the summation
\begin{equation*} \sum_{k=1}^{5} 2 k + 1 \end{equation*}
becomes Sage input
	sum(2*k + 1, k, 1, 5)

However, remember that by default the only letter that Sage treats as a variable is x, so if we want to use k for our index variable as we’ve been doing in our Sigma notation, we have to first tell Sage that we want k to be treated as a variable.
Example 5.3.13. Summing in Sage.
Let’s try the example command above.
Checkpoint 5.3.14. Try it yourself.
Use the blank Sage cell below to compute the sum
\begin{equation*} \sum_{k = 1}^{17} k^2 \text{.} \end{equation*}
(If you’ve already evaluated the example Sage cell above, you won’t need the var('k') command.)

Section 5.4 Riemann sums

When we sum up the (oriented) areas of rectangles formed by a step function, the sum is called a Riemann sum.

Definition 5.4.1. Riemann sum.

Suppose \(s(t)\) is a step function that takes on values
\begin{equation*} s(t) = \begin{cases} h_1 \amp t_0 \le t \lt t_1 \\ h_2 \amp t_1 \le t \lt t_2 \\ h_3 \amp t_2 \le t \lt t_3 \\ \amp \vdots \\ h_n \amp t_{n - 1} \le t \lt t_n \end{cases}\text{.} \end{equation*}
If we write \(\change{t_k}\) to represent the length of the subdomain \(t_{k - 1} \le t \lt t_k\) so that
\begin{equation*} \change{t_k} = t_k - t_{k - 1} \text{,} \end{equation*}
then the sum of (oriented) rectangle areas
\begin{equation*} \sum_{k = 1}^{n} h_k \change{t_k} \end{equation*}
is called the Riemann sum for \(s(t)\) over the domain \(t_0 \le t \le t_n\text{.}\)

Example 5.4.2. Riemann sum for the air pump.

Let’s unpack the notation of the definition above for the inflate-deflate-reinflate model from Example 5.2.13. The step function in the model “steps” output values at the following input values.
\begin{align*} t_0 \amp = 0 \amp t_2 \amp = 3 \amp t_4 \amp = 5 \amp t_6 \amp = 10 \\ t_1 \amp = 1 \amp t_3 \amp = 4 \amp t_5 \amp = 8 \end{align*}
The corresponding output height values between these stepping input values are:
\begin{align*} h_1 \amp = 0.5 \amp h_3 \amp = 0.25 \amp h_5 \amp = -0.2 \\ h_2 \amp = 0.75 \amp h_4 \amp = 0 \amp h_6 \amp = 0.5 \text{.} \end{align*}
Graph modelling inflating, partially deflating, and re-inflating an air raft.
Figure 5.4.3. Riemann sum parameters for inflating and re-inflating an air raft.
The subdomain lengths are as follows.
\begin{align*} \change{t_1} \amp = t_1 - t_0 = 1 \\ \change{t_2} \amp = t_2 - t_1 = 2 \\ \change{t_3} \amp = t_3 - t_2 = 1 \\ \change{t_4} \amp = t_4 - t_3 = 1 \\ \change{t_5} \amp = t_5 - t_4 = 3 \\ \change{t_6} \amp = t_6 - t_5 = 2 \end{align*}
Then our Riemann sum is
\begin{align*} \sum_{k = 1}^{6} h_k \change{t_k} \amp = h_1 \change{t_1} + h_2 \change{t_2} + h_3 \change{t_3} + h_4 \change{t_4} + h_5 \change{t_5} + h_6 \change{t_6}\\ \amp = 0.5 \cdot 1 + 0.75 \cdot 2 + 0.25 \cdot 1 + 0 \cdot 1 + (-0.2) \cdot 3 + 0.5 \cdot 2\text{,} \end{align*}
just as in our previous calculation, and each term in the sum represents an oriented rectangle area, as pictured in Figure 5.2.14 (though one of the rectangles has height \(0\) and can’t be seen in that diagram).

Example 5.4.5. Riemann sum for the air pump using a regular step function.

Let’s redo Example 5.4.2 but interpreting the rate function as a regular step function.
Graph modelling inflating, partially deflating, and re-inflating an air raft.
Figure 5.4.6. Regular Riemann sum parameters for inflating and re-inflating an air raft.
We have more subdomains this time, because we have split the longer subdomains up so that each subdomain has the same length.
Factoring out the common subdomain length, we have
\begin{align*} \sum_{k = 1}^{10} h_k \change{t} \amp = \left(\sum_{k = 1}^{10} h_k\right) \change{t}\\ \amp = (h_1 + h_2 + h_3 + h_4 + h_5 + h_6 + h_7 + h_8 + h_9 + h_{10}) \change{t}\\ \amp = (0.5 + 0.75 + 0.75 + 0.25 + 0 + (-0.2) + (-0.2) + (-0.2) + 0.5 + 0.5) \cdot 1\text{.} \end{align*}
This Riemann sum corresponds to the net (oriented) area of ten rectangles (though again one of the rectangles has height \(0\) and can’t be seen).
Graph modelling inflating, partially deflating, and re-inflating an air raft.
Figure 5.4.7. Inflating and re-inflating an air raft.

Remark 5.4.8.

It may seem that summing ten rectangle areas in Example 5.4.5 is more work than summing six rectangle areas in Example 5.4.2. But when programming a computer to do such sums, the regularly-spaced ten rectangles is easier to program then the irregularly-spaced six rectangles, and computers don’t care how many rectangle areas you ask them to sum (unless the number of rectangles is very, very large).