Those of you that haven’t taken calculus, feel free to sit this one out.
Several times in my engineering education, I have been confronted with a problem where I must differentiate an integral with a time-varying limit of integration. This is a different problem altogether from when the upper limit of integration is simply , in which case we can use the Fundamental Theorem of Calculus to differentiate the integral.
The purpose of this blog post is to give the reader a concrete example of where the application of Leibniz’s Rule is useful and labor-saving.
Here is a problem that was given to some undergraduate students in the control theory course I was a teaching assistant for. Consider the problem diagram below. We have a spherical tank that is being filled with a liquid at the top. The fluid level is rising due the accumulation of the mass in the tank.
The exact problem was a little lengthier, but a key part solving the problem was writing the differential equation for the mass balance. From this mass balance, we can find our true objective, which is a differential equation for the fluid level in the tank. The mass balance equation is written as:
The spherical tank is being filled with a liquid. Since it is only being filled, and no fluid is leaving the tank, we have . The mass flowrate into the control volume is simply the fluid density times the volumetric flowrate, or mathematically, .
The total fluid mass in the spherical tank, , can be found by integrating over the volume of the liquid in the vessel.
Let’s focus now on the integral term that is being differentiated. As you might remember from calculus II or III, you can take a volume integral by adding up infinitesimal slices. We can calculate the volume of the fluid in the spherical container by integrating from the base of the sphere up to the fluid level, , where the height is an unknown function of time.
The volume of the liquid is the integral of the cross-sectional area of the fluid surface times an infinitesimal height, .
Using our skills in analytic geometry, we can figure out what the cross-sectional area term is. The fluid surface in the sphere is always a circle, of radius as shown in the figure. Using the Pythagorean Theorem and a little algebra, we compute the cross-sectional area term as:
(Verify this for yourself mentally. What happens to at the midpoint, where ? What happens to at when the sphere is completely full, at ?)
Substituting the cross-sectional area term into our previous integral now yields the differential equation:
This integral isn’t anything particularly terrifying. We could just compute the integral directly using the power rule, substitute in the limits of integration, and then differentiate it. But Mr. von Leibniz did some moderately heavy lifting for us, and computed a useful formula (page 393) we can use for differentiating integrals with time-varying limits of integration:
Applying the formula to our integral is a snap. Since the lower limit of integration is zero, the subtrahend on the right hand side is zero, since both evaluated at is zero, and . The minuend of the right hand side is simply:
Which means the differential equation transforms into:
or, when cast in standard form:
Which yields a differential equation for the fluid level, , in the spherical tank, as desired.