Chapter 9
Calculus and Continuous Mathematical Models
Bachelors Program in Computer Science Engineering
Mathematics for Computer Science
•
Bachelor
Calculus and Continuous Mathematical Models
Introduction
Computer systems are discrete at the level of bits, instructions and clock cycles, yet many useful models treat time, workload, energy, temperature and data flow as continuous quantities. Calculus provides the language for analyzing such models. Limits formalize approximation, derivatives measure sensitivity and rates of change, integrals accumulate quantities, multivariable calculus describes interacting inputs, and differential equations model systems that evolve over time.
Continuous models are approximations rather than literal descriptions of every computational event. They are valuable when system scales are large, measurements vary smoothly, or aggregate behavior matters more than individual events. Their validity depends on assumptions, units, data quality and numerical stability.
Learning Objectives
After studying this chapter, students should be able to:
evaluate and interpret limits;
determine whether a function is continuous;
calculate derivatives and apply the chain rule;
use the first- and second-derivative tests correctly;
interpret definite integrals as accumulated quantities;
apply the Fundamental Theorem of Calculus;
compute partial derivatives, gradients and directional derivatives;
solve basic unconstrained and constrained optimization problems;
formulate and solve elementary differential equations;
apply numerical methods to continuous computational models; and
evaluate the assumptions and limitations of calculus-based models.
1. Limits and Local Behavior
1.1 Definition of a limit
The statement \limx\to af(x)=L means that values of f(x) can be made arbitrarily close to L by taking x sufficiently close to, but not necessarily equal to, a. Formally:
Here, \varepsilon is an allowed output error and \delta specifies a sufficiently small input neighborhood. This definition is essential when a function is undefined at the point being approached or when numerical approximation must be justified.
A two-sided limit exists only when the left- and right-hand limits exist and agree:
\limx\to af(x)=L \quad\text{if and only if}\quad \limx\to a^-f(x)=\limx\to a^+f(x)=L.
Worked Example: Removable Discontinuity
Evaluate \limx\to3(x2-9)/(x-3). Direct substitution gives 0/0, an indeterminate form. For x\ne3, factorization gives
\frac{x2-9}{x-3}=\frac{(x-3)(x+3)}{x-3}=x+3.
Therefore,
\limx\to3\frac{x2-9}{x-3}=6.
The original expression remains undefined at x=3 unless the function is explicitly extended by assigning f(3)=6.
1.2 Limits at infinity and asymptotic behavior
A limit as x\to\infty describes long-run behavior. For example,
\limn\to\infty\frac{3n2+2n}{n2+5}=3.
Dividing numerator and denominator by n2 verifies the result. In algorithm analysis, such limits compare growth rates. If positive functions f(n) and g(n) satisfy
then they have the same asymptotic order: f(n)=\Theta(g(n)). This limit criterion is sufficient under the stated positivity and finite nonzero-limit conditions, but it is not the definition of Big-Theta notation.
2. Continuity
A function f is continuous at x=a if:
f(a) is defined;
\limx\to af(x) exists; and
\limx\to af(x)=f(a).
Polynomials are continuous everywhere. Rational functions are continuous wherever their denominators are nonzero. Sums, products and compositions of continuous functions are continuous wherever they are defined.
Discontinuities may be removable, jump, or infinite. A threshold controller, for example, may exhibit a jump discontinuity when it switches abruptly between two operating modes.
Intermediate Value Theorem
If f is continuous on the closed interval [a,b] and N lies between f(a) and f(b), then at least one c\in[a,b] satisfies f(c)=N.
The theorem guarantees existence, not uniqueness. Root-finding methods such as bisection exploit this result when endpoint function values have opposite signs.
3. Differentiation and Rates of Change
3.1 Derivative
The derivative of f at x is
f'(x)=\limh\to0\frac{f(x+h)-f(x)}{h},
provided the limit exists. It measures instantaneous output change per unit input change. If x is measured in seconds and f(x) in joules, then f'(x) has units joules per second, or watts.
Differentiability implies continuity, but continuity does not imply differentiability. For example, f(x)=|x| is continuous at zero but has no derivative there because its one-sided slopes differ.
3.2 Differentiation rules
For differentiable functions f and g and a constant c:
Rule
Formula
Linearity
(cf+g)'=cf'+g'
Product
(fg)'=f'g+fg'
Quotient
(f/g)'=(f'g-fg')/g2, where g\ne0
Chain
\frac{d}{dx}f(g(x))=f'(g(x))g'(x)
Power
\frac{d}{dx}xp=pxp-1, on a domain where the real power is defined
The chain rule is fundamental in neural-network training and automatic differentiation because a composed computation is differentiated by propagating local derivatives through its computational graph.
Worked Example: Chain Rule
Let C(t)=(1+3t2)5. Then
C'(t)=5(1+3t2)4(6t)=30t(1+3t2)4.
The outer derivative is evaluated at the inner expression, then multiplied by the derivative of that inner expression.
3.3 Linear approximation and error propagation
If f is differentiable near x=a, then for a small increment \Delta x,
f(a+\Delta x)\approx f(a)+f'(a)\Delta x.
Thus \Delta f\approx f'(a)\Delta x. This approximation estimates how measurement or parameter errors propagate. It is reliable only when \Delta x is sufficiently small and higher-order curvature is not dominant.
Taylor's theorem provides a more systematic local approximation. If f has n+1 continuous derivatives near a, then
f(x)=\sumk=0n\frac{f(k)(a)}{k!}(x-a)k+Rn(x),
where the Lagrange remainder is Rn(x)=f(n+1)(\xi)(x-a)n+1/(n+1)! for some \xi between a and x.
4. Optimization and Derivative Tests
A critical point is a point inside the domain where f'(x)=0 or where f' does not exist. A critical point is only a candidate for an extremum.
4.1 First-derivative test
Suppose c is a critical point and f is continuous at c and differentiable on intervals immediately to its left and right. Inspect the sign of f'(x):
If f' changes from positive to negative at c, then f changes from increasing to decreasing, so c is a local maximum.
If f' changes from negative to positive, then f changes from decreasing to increasing, so c is a local minimum.
If f' has the same sign on both sides, then c is neither a local maximum nor a local minimum.
Sign left of c
Sign right of c
Conclusion
Positive
Negative
Local maximum
Negative
Positive
Local minimum
Positive
Positive
Neither
Negative
Negative
Neither
These sign-change criteria also apply when the derivative is undefined at the critical point, provided the stated continuity and one-sided differentiability conditions hold.
4.2 Second-derivative test
If f'(c)=0 and f''(c) exists, then:
f''(c)>0 implies a strict local minimum;
f''(c)<0 implies a strict local maximum;
f''(c)=0 is inconclusive.
Worked Example: Balancing Two Costs
Consider the normalized cost model
L(x)=x+\frac{16}{x},\qquad x>0.
The terms are assumed to have been scaled into the same cost unit. Differentiation gives
L'(x)=1-\frac{16}{x2}.
The only critical point in the domain is x=4. For 0<x<4, L'(x)<0; for x>4, L'(x)>0. The derivative changes from negative to positive, so the first-derivative test identifies a minimum. Also,
L''(x)=\frac{32}{x3}>0\quad\text{for }x>0.
Therefore, x=4 is the unique global minimum on the positive domain, with L(4)=8 normalized cost units.
For optimization over a closed interval, one must compare all interior critical points with both endpoints—the closed-interval method.
5. Integration and Accumulation
5.1 Definite integral
For a bounded function f on [a,b], a Riemann sum has the form
\sumi=1nf(xi^*)\Delta xi.
If these sums approach a common limit as the maximum subinterval width approaches zero, that limit is the definite integral \intab f(x)\,dx. Continuous functions on closed intervals are integrable.
If r(t) is a processing rate in jobs per second, then
N=\intt0t1r(t)\,dt
is the total number of jobs predicted by the continuous model. The units are consistent: jobs/second multiplied by seconds gives jobs.
5.2 Fundamental Theorem of Calculus
If f is continuous on [a,b] and
F(x)=\intax f(t)\,dt,
then F'(x)=f(x). Furthermore, if G'(x)=f(x), then
\intab f(x)\,dx=G(b)-G(a).
This theorem links local rates with accumulated change.
Worked Example: Accumulated Throughput
Suppose a continuous approximation to processing rate is
r(t)=100+20t-2t2,
where t is in seconds and r is in jobs per second. Over the interval 0\le t\le5, the rate remains positive. The predicted number of completed jobs is
A physical system completes an integer number of jobs, so the noninteger result should be interpreted as an aggregate model prediction rather than a literal count.
When an antiderivative is unavailable or data are sampled, numerical quadrature is used. For equally spaced points with step h=(b-a)/n, the composite trapezoidal rule is
If f'' is continuous, the error magnitude is bounded by
|ET|\le\frac{(b-a)h2}{12}\maxa\le x\le b|f''(x)|.
Smaller steps usually improve accuracy, but also increase computation and may amplify floating-point or data noise effects.
6. Multivariable Calculus
Computational performance usually depends on several variables, such as workload, memory, processor frequency and temperature. For z=f(x,y), the partial derivatives \partial f/\partial x and \partial f/\partial y measure change in one coordinate while holding the other fixed.
For a differentiable function, the directional derivative in a unit direction \mathbf{u} is
D_{\mathbf{u}}f=\nabla f\cdot\mathbf{u}.
The gradient points in the direction of steepest local increase. At a regular point where \nabla f\ne\mathbf{0}, it is perpendicular to the level curve f(x,y)=c.
Gradient perpendicular to the ellipse x squared plus four y squared equals four at the point zero comma one
Figure: Gradient perpendicular to the ellipse x squared plus four y squared equals four at the point zero comma one
Figure: For f(x,y)=x2+4y2, the point P=(0,1) lies exactly on the level curve f=4. Its horizontal tangent is perpendicular to the vertical gradient (0,8).
Indeed, the level curve has implicit derivative 2x+8y(dy/dx)=0. At (0,1), its slope is zero, while the gradient is vertical.
6.1 Hessian and local extrema
For a twice continuously differentiable function of two variables, the Hessian is
Thus y=2x, giving x=4 and y=8. Because logarithms are strictly concave and the feasible set is convex, this feasible stationary point is the unique global maximum.
7. Differential Equations and Dynamic Systems
A differential equation relates an unknown function to its derivatives. An initial-value problem combines the equation with an initial state.
7.1 Exponential change
The model
\frac{dy}{dt}=ky,\qquad y(0)=y0,
has solution
y(t)=y0ekt.
Here k has units reciprocal to those of time. Positive k produces growth; negative k produces decay. The model assumes a rate proportional to the current state and a constant parameter.
7.2 First-order linear systems
A common model is
\frac{dy}{dt}+ay=b,
where a and b are constants and a\ne0. Its solution with y(0)=y0 is
y(t)=\frac{b}{a}+\left(y0-\frac{b}{a}\right)e-at.
If a>0, the equilibrium y=b/a is stable.
7.3 Logistic growth
Resource-limited growth may be represented by
\frac{dP}{dt}=rP\left(1-\frac{P}{K}\right),
where r>0 is the intrinsic growth rate and K>0 is the carrying capacity. For P(0)=P0>0,
This model is appropriate only when a fixed capacity and density-dependent growth are defensible assumptions.
7.4 Euler's numerical method
For y'=F(t,y) with y(t0)=y0, Euler's method uses
yn+1=yn+hF(tn,yn),\qquad tn+1=tn+h.
The step size h has units of time. For sufficiently smooth F over a fixed interval, explicit Euler has global error of order O(h). It can nevertheless become unstable for stiff equations or excessively large steps.
8. Illustrative Case: Thermal-Aware Server Control
Background
This fictional case models the temperature of a compute server operating under a sustained normalized utilization u, where 0\le u\le1. Excessive temperature can cause throttling, hardware degradation or shutdown.
Problem
The server starts at T(0)=35\ ^\circ\mathrm{C} in a room at Ta=25\ ^\circ\mathrm{C}. Engineers use the lumped thermal model
\frac{dT}{dt}=\alpha u-k(T-Ta),
where T is temperature in degrees Celsius, t is time in minutes, \alpha=18\ ^\circ\mathrm{C}/min is the full-utilization heating coefficient, and k=0.20\ min-1 is the cooling coefficient. Utilization is assumed constant during each modeled interval.
Both terms on the right have units ^\circ\mathrm{C}/min, so the equation is dimensionally consistent.
A nominal utilization cap of approximately 61.1% satisfies the simplified steady-state model. A production controller should use a lower cap to allow for uncertainty, delayed sensing, changing ambient temperature and heterogeneous workloads.
Outcome
The model predicts that 80% sustained utilization crosses the threshold after approximately 6.47 minutes, whereas a utilization at or below 61.1% has a modeled steady state no higher than the threshold.
Learning Points
Differential equations connect physical rates with computational control decisions.
Equilibrium analysis can provide a simple policy bound.
Parameter uncertainty and unmodeled delays require safety margins and empirical validation.
9. Modeling Practice, Limitations and Governance
A continuous model should be treated as a purposeful approximation. Good practice includes:
Define scope. Specify the time interval, operating regime and excluded effects.
Maintain units. Terms combined by addition must have compatible dimensions.
Check domains. Logarithms require positive arguments, denominators must be nonzero, and probabilities must remain within valid bounds.
Validate parameters. Estimate coefficients from representative measurements and report uncertainty.
Analyze sensitivity. Gradients and derivatives reveal which parameters most affect predictions.
Test numerical convergence. Repeat computations using smaller step sizes or higher-order methods.
Compare with data. Residual patterns may expose missing variables or structural errors.
Document assumptions. Users should know when a model is unsafe to extrapolate.
Automatic differentiation now enables exact derivative propagation up to floating-point effects, avoiding truncation errors associated with finite differences. Differentiable programming uses this capability in machine learning, simulation and optimization. However, gradients can still be misleading when objectives are nonsmooth, poorly conditioned, biased by unrepresentative data or disconnected from real social costs.
Governance matters when calculus-based models allocate cloud resources, control energy use or influence access to digital services. Optimization objectives should account for reliability, fairness, privacy and environmental costs rather than only throughput. Operators should retain audit logs, monitor model drift, enforce safety constraints and provide human override mechanisms for consequential automated control.
Chapter Summary
Limits describe local and asymptotic behavior and support rigorous definitions of continuity and derivatives. Continuity enables existence results such as the Intermediate Value Theorem. Derivatives quantify rates and sensitivity, while the chain rule differentiates composed systems. The first-derivative test classifies critical points through explicit sign changes: positive to negative indicates a local maximum, and negative to positive indicates a local minimum.
Definite integrals represent accumulation, and the Fundamental Theorem of Calculus connects accumulated quantities with local rates. Multivariable calculus extends sensitivity analysis through partial derivatives, gradients, Hessians and constrained optimization. Differential equations model changing system states, while numerical methods approximate models that lack convenient closed-form solutions. Reliable application requires unit consistency, validated assumptions, numerical error assessment and responsible governance.
Key Terms
Limit: The value approached by a function as its input approaches a specified point or infinity.
One-sided limit: A limit taken while approaching a point from only the left or right.
Continuity: The property that a function's limit at a point equals its defined value there.
Derivative: The instantaneous rate of change of a function.
Critical point: An interior domain point where the derivative is zero or does not exist.
First-derivative test: A classification method based on the sign of the derivative on either side of a critical point.
Chain rule: A rule for differentiating composed functions.
Taylor approximation: A polynomial approximation constructed from derivatives at a reference point.
Definite integral: The limit of Riemann sums representing signed accumulation over an interval.
Fundamental Theorem of Calculus: The theorem connecting differentiation and definite integration.
Partial derivative: A derivative with respect to one variable while other variables are held fixed.
Gradient: The vector of first partial derivatives of a scalar function.
Directional derivative: The rate of change of a function along a specified unit direction.
Level curve: A curve on which a function has a constant value.
Hessian: The matrix of second partial derivatives of a scalar function.
Lagrange multiplier: An auxiliary variable used to identify constrained stationary points.
Differential equation: An equation relating an unknown function to one or more derivatives.
Equilibrium: A state at which a dynamic model's rate of change is zero.
Euler's method: A first-order numerical method for approximating an initial-value problem.
Review Questions
Short Answer Questions
State the three conditions required for continuity at a point.
Explain why differentiability implies continuity but continuity does not imply differentiability.
State the sign-change criteria of the first-derivative test.
What does the gradient represent geometrically?
Explain the relationship between a rate function and its definite integral.
Long Answer Questions
Develop the derivative from its limit definition and explain its units in a computational performance model.
Explain the Fundamental Theorem of Calculus and illustrate both of its principal conclusions.
Compare the first- and second-derivative tests, including their assumptions and inconclusive cases.
Discuss gradients, directional derivatives, level curves and Hessians in multivariable optimization.
Derive the solution of y'+ay=b for constant a\ne0 and interpret its equilibrium when a>0.
Analytical / Application Questions
For C(x)=x+25/x, x>0, identify and classify every critical point using the first-derivative test. Interpret the optimum.
A service processes data at r(t)=40+6t MB/s for 0\le t\le10 seconds. Calculate the total data processed and the average rate, with units.
In the thermal case, recalculate the steady-state temperature and the time to reach 80\ ^\circ\mathrm{C} if utilization is reduced to u=0.70. State whether the threshold is eventually crossed.
Multiple Choice Questions with Answers
Question 1
Evaluate \limx\to3(x2-9)/(x-3).
A. 0
B. 3
C. 6
D. The limit does not exist
Correct Answer: C. 6
Question 2
Which set of conditions is sufficient for a function f to be continuous at x=a?
A. Only f(a) must be defined
B. The limit must exist, but it need not equal f(a)
C. f'(a) must equal zero
D. f(a) is defined, the limit exists, and the limit equals f(a)
Correct Answer: D. f(a) is defined, the limit exists, and the limit equals f(a)
Question 3
At a critical point, f'(x) changes from positive on the left to negative on the right. What does the first-derivative test conclude?
A. There is a local maximum
B. There is a local minimum
C. There is necessarily a saddle point
D. No conclusion is possible
Correct Answer: A. There is a local maximum
Question 4
For L(x)=x+16/x on x>0, where does the minimum occur?
A. x=2
B. x=4
C. x=8
D. x=16
Correct Answer: B. x=4
Question 5
A processing rate is r(t)=10+2t jobs/s. How many jobs does the continuous model predict over 0\le t\le3 seconds?
A. 33 jobs
B. 36 jobs
C. 39 jobs
D. 48 jobs
Correct Answer: C. 39 jobs
Question 6
For f(x,y)=x2+4y2, what is \nabla f(0,1)?
A. (0,4)
B. (0,8)
C. (2,4)
D. (2,8)
Correct Answer: B. (0,8)
Question 7
For f(x,y)=x2+y2, what is the directional derivative at (1,2) in the unit direction (3/5,4/5)?
A. 14/5
B. 18/5
C. 4
D. 22/5
Correct Answer: D. 22/5
Question 8
At a critical point of a twice continuously differentiable function, what does a positive-definite Hessian imply?
A. A strict local minimum
B. A strict local maximum
C. A saddle point
D. A discontinuity
Correct Answer: A. A strict local minimum
Question 9
What is the solution of y'=-2y with y(0)=3?
A. y=3e2t
B. y=2e-3t
C. y=3e-2t
D. y=3-2t
Correct Answer: C. y=3e-2t
Question 10
Using one Euler step with h=0.1 for y'=-y and y(0)=1, what is y1?