According to Kepler’s laws of planetary motion, a planet revolving around the Sun follows an elliptical orbit, with the Sun at one focus of the ellipse, as in Figure 8.2.1. The distance \(d\) between the planet and the Sun varies over the ellipse, reaching a minimum distance and a maximum distance (by the Extreme Value Theorem). How would you find the average distance between the planet and the Sun over one complete orbit? The idea is to generalize the usual notion of an average of numbers.
Recall that for \(n\) numbers \(x_1\), \(x_2\), \(\ldots\) , \(x_n\) the average, denoted by \(\bar{x}\), is simply the sum of the numbers divided by how many numbers there are, namely
In statistics \(\bar{x}\) is called the mean of \(x_1\), \(x_2\), \(\ldots\) , \(x_n\). This definition makes sense for a finite set of numbers, but in the case of a planet revolving around the Sun, there are an uncountably infinite number of distances between the planet and the Sun, making the above definition impossible to use. A way of taking a sum over an infinite continuum of values is needed instead. Such a method has already been encountered: the definite integral, which is merely a sum of a continuum of infinitesimal quantities.
To motivate the definition of the average value of a function \(f\) over a closed interval \(\ival{a}{b}\), denoted by \(\avg{f}\), consider a partition
that divides \(\ival{a}{b}\) into \(n\) subintervals \(\ival{x_{i-1}}{x_i}\) of equal length \(\Delta x_i = x_i-x_{i-1} = (b-a)/n\), as in Figure 8.2.2. The \(n\) function values \(f(x_1)\), \(f(x_2)\), \(\ldots\) , \(f(x_n)\) constitute only a finite subset of all the function values \(f(x)\) over \(\ival{a}{b}\), so their average would be an approximation of the true function average \(\avg{f}\), namely:
By properties of summations, divide the entire sum by the constant \(b-a\) and multiply each term in the sum by \(b-a\) to get:
Note that the last summation on the right is just a Riemann sum for the definite integral \(\int_a^b f(x)\,\dx\), with the points \(x_i^*\) chosen to be the right endpoints of the intervals \(\ival{x_{i-1}}{x_i}\) for \(i=1\) to \(n\). Thus, taking the limit of that sum as \(n \to \infty\) (which means including more and more function values in the average) yields the following definition:
Definition 8.1
The average value \(\avg{f}\) of a function \(f\) over a closed interval \(\ival{a}{b}\) is:[1]
Example 8.8
Find the average value of \(f(x)=x^2\) over \(\ival{0}{1}\).
Solution: By definition, with \(a=0\) and \(b=1\),
Note that this says that if you took all the numbers between 0 and 1 and squared them, then the average of those squares would be 1/3.
Example 8.9
Find the average value of \(f(x)=x^2\) over \(\ival{-1}{1}\).
Solution: By definition, with \(a=-1\) and \(b=1\),
Note that this is the same as the average over \(\ival{0}{1}\), as shown in the previous example. This should make sense, since the function \(f(x)=x^2\) is symmetric about the \(y\)-axis, so the values of \(f(x)\) from \(\ival{-1}{0}\) are the same as those from \(\ival{0}{1}\). The values from \(\ival{-1}{1}\) just duplicate the values from \(\ival{0}{1}\) and hence do not change the average.
Example 8.10
Find the average value of \(f(x)=\sin\,x\) over \(\ival{0}{\pi}\).
Solution: By definition, with \(a=0\) and \(b=\pi\),
Example 8.11
Find the average distance from the ellipse \(\frac{x^2}{25} + \frac{y^2}{9} = 1\) to the point \((4,0)\).
Solution: Let \(d\) represent the distance from any point \((x,y)\) on the ellipse to the point \((4,0)\), as in Figure 8.2.3. If \((x,y)\) is on the ellipse \(\frac{x^2}{25} + \frac{y^2}{9} = 1\) then \(y^2 = 9(1 - \frac{x^2}{25}) = \frac{9}{25}(25-x^2)\). So by the distance formula, \(d\) is given by
for \(-5 \le x \le 5\), since \(d = (4x-25)/5 < 0\) on \(\ival{-5}{5}\) and the distance cannot be negative. Note that by symmetry of the ellipse about the \(x\)-axis, only the upper half of the ellipse is needed for the average distance, since the lower half just duplicates the distances. Hence, the average distance is
Notice that the point \((4,0)\) is a focus of the ellipse \(\frac{x^2}{25} + \frac{y^2}{9} = 1\) (why?), which as it turns out makes the calculation of the average distance fairly simple.
What if you wanted the average value of a function \(f\) that is not easily integrable? One alternative to numerical integration techniques is the Monte Carlo method. The idea behind it is simple: go back to the usual definition of an average, by taking a large number \(N\) of random numbers \(x_1\), \(x_2\), \(\ldots\) , \(x_N\) in \(\ival{a}{b}\) and then using the approximation
This might seem like taking a step backward from calculus, and it is, but it is surprisingly useful, as well as simple to implement with a computer. In addition, it can be shown that as the number of random points in \(\ival{a}{b}\) increases, the approximations converge to the actual average.
Example 8.12
The Monte Carlo method is easy to implement in Octave/MATLAB. Typically only a “one-liner” is needed, owing to Octave’s vectorization—i.e. the ability to perform mathematical operations on entire arrays of objects all at once.
For example, recall from Example 8.8 that the average
value of \(f(x)=x^2\) over \(\ival{0}{1}\) is \(1/3 = 0.33333\ldots\,\). Approximate
the average value using an array of 100 million (\(10^8\)) random numbers in
\(\ival{0}{1}\):
octave> mean(rand(1,1e8).^2)
ans = 0.3333292094741531rand(1,1e8).2 command applies
the squaring operation ( 2) to each of the \(10^8\)
random numbers in the array returned by the rand(1,1e8) command. The
aggregate mean function then calculates the array’s mean.
Trigonometric, exponential and other functions can be applied to arrays, with
the function evaluating each array element individually. In general the
command \((b-a)\).*rand(1,N)+\(a\) will return an array of N
random numbers in the interval \((a,b)\).
For example, the function \(f(x)=\sin\,(x^2)\) cannot be integrated in a
closed form, but its average value over \(\ival{\pi}{2\pi}\) can be
approximated easily in Octave (actual average = -0.04154374531416104):
octave> mean(sin((pi.*rand(1,1e8)+pi).^2))
ans = -0.04153426177596753
A
For Exercises 1-9, find the average value of the function \(f(x)\) over the given interval.
3
\(f(x)=1\), over \(\ival{0}{3}\)
\(f(x)=x\), over \(\ival{0}{1}\)
\(f(x)=x^2\), over \(\ival{0}{2}\)
3
\(f(x)=x^3\), over \(\ival{0}{2}\)
\(f(x)=\sin\,2x\), over \(\ival{0}{\pi/2}\)
\(f(x)=e^x\), over \(\ival{-1}{4}\)
3
\(f(x)=x^3\), over \(\ival{-1}{1}\vphantom{\dfrac{1}{x}}\)
\(f(x)=\sin\,x\), over \(\ival{-\pi/2}{\pi/2}\vphantom{\dfrac{1}{x}}\)
\(f(x)= \dfrac{1}{x}\), over \(\ival{1}{3}\)
Electrical signals are commonly represented by a periodic waveform \(x(t)\), which is a function of time \(t\) and has period \(T\) (i.e. \(T\) is the smallest positive number such that \(x(t+T) = x(t)\) for all \(t\)). The average power of the waveform is defined as the average value of its square over a single period:
\[ \Avg{x^2(t)} ~=~ \frac{1}{T}\,\int_0^T\,x^2(t)~\dt ~. \]Find the average power of the waveform \(x(t) = A \cos (\omega t + \phi)\), where \(A >0\) and \(\omega > 0\) and \(\phi\) are all constants.
The root mean square of a waveform, abbreviated as rms, is the square root of the average power. Calculate the rms of the waveform from part (a). Write your answer in decimal form as a percentage of the amplitude \(A\).
[r]
An electric circuit with a supplied voltage (electromotive force) \(E\), a capacitor with capacitance \(C\), and a resistor with resistance \(R\), is shown in the picture on the right. When a switch \(s\) in the circuit is opened at time \(t=0\) the current \(I\) through the circuit begins to decrease exponentially as a function of time \(t\) (measured in seconds after the switch is opened), given by
\[ I ~=~ \frac{E}{R}\,e^{-t/RC} \]for \(t \ge 0\).
Sketch a rough graph of \(I\) as a function of \(t\).
Note that at time \(t=0\) the current is \(I = \frac{E}{R}\) (measured in amperes), which is the familiar formula from Ohm’s Law. That is the peak value of \(I\). What is the current \(I\) at time \(t=5RC\)? Write your answer in decimal form as a percentage of the peak current \(\frac{E}{R}\) (e.g. \(0.42 \frac{E}{R}\), which would be \(42\%\) of the peak current).
Find the average current in the circuit over the time interval \(\ival{0}{5RC}\). Write your answer in decimal form as a percentage of the peak current.
A spring with spring constant \(k\) and damping constant \(\nu\) connects two point particles with mass \(m\) in a gravitational wave detector. A gravitational wave passes through the detector at time \(t=0\) and induces oscillation in the spring, with a period of \(2\pi/\Omega\) and energy \(E\) at time \(t \ge 0\) given by
\[ E(t) ~=~ \frac{1}{4}mR^2\,\left(\Omega^2\,\sin^2\,(\Omega t + \phi) ~+~ \omega_0^2\,\cos^2\,(\Omega t + \phi)\right) ~, \]where \(\omega_0^2 = 2k/m\), \(\phi = \tan^{-1}\,(2\nu\Omega/(m(\omega_0^2 - \Omega^2))\), and \(R\) is a constant.
Show that the average energy \(\avg{E}\) over one period \(\ival{0}{2\pi/\Omega}\) of oscillation is
\[ \avg{E} ~=~ \frac{1}{8}mR^2\,(\omega_0^2 ~+~ \Omega^2) ~. \]Suppose a large number of identical detectors of this type are uniformly distributed in a planar array at a density of \(\sigma\) detectors per unit area. The energy \(E_\sigma(t)\) imparted to each detector at time \(t \ge 0\) by a gravitational wave is
\[ E_\sigma(t) ~=~ \nu \Omega^2 R^2\,\sin^2\,(\Omega t + \phi) ~. \]Show that the average energy \(\avg{E_\sigma}\) over one period \(\ival{0}{2\pi/\Omega}\) of oscillation is
\[ \avg{E_\sigma} ~=~ \frac{1}{2}\nu \Omega^2 R^2 ~. \]
B
For the ellipse \(\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1\), with \(a > b > 0\), the foci are the points \((c,0)\) and \((-c,0)\), where \(c = \sqrt{a^2 - b^2}\). Find the average distance from the ellipse to either of its foci in terms of the constants \(a\), \(b\), and \(c\).
Write a computer program to use the Monte Carlo method with 1 million random points to approximate the average distance from the ellipse \(\frac{x^2}{25} + \frac{y^2}{9} = 1\) to the point \((0,0)\). Use symmetry to choose the smallest interval for the points. Could you have used formula (8.3) instead? Explain.
- In some statistics or mathematics texts you might see the notation \(\bar{f}\) for the average value. ↩