Numerical Limits
Limits
The limit is the foundation of calculus. Informally, means: as gets arbitrarily close to , gets arbitrarily close to .
Why Limits Matter
Limits let us deal with quantities we can't compute directly — like the slope of a curve at a single point, or the sum of infinitely many terms.
Numerical Approximation
We can approximate a limit numerically by evaluating at points very close to , approaching from both sides:
For a smooth function, this central average is very accurate when is small (e.g., h = 1e-7).
Examples
| Function | Point | Limit |
|---|---|---|
The third example is famous: is undefined (division by zero), but the limit exists.
Removable Discontinuities
When is undefined but the limit exists, the point is called a removable discontinuity. The function has a hole at , but the limit is .
Your Task
Implement double limit(double (*f)(double), double x, double h) that approximates the limit of at using step size .