ANALYSIS TOOL BOX

Calculus

FindLimitOfFunction

Compute and visualize the limit of a mathematical function as its input approaches a specified point.

calculusderivativesintegralsoptimization

Introduction

Some quantities are only meaningful as an approach, not a value — a rate that is undefined exactly at a threshold, a model that breaks down at a boundary condition, a process trending toward (but never quite reaching) saturation. FindLimitOfFunction answers "what does this function settle toward as its input closes in on a point, even where the function itself isn't defined there?" — using SymPy to compute the limit symbolically, exactly, rather than approximating it numerically. Reach for it when the analytic question is about boundary behavior: does a risk estimate converge as evidence accumulates, does a rate stabilize, what happens right at an edge case the raw function can't tell you about directly.

Teaching Note

In calculus, a limit describes the value that a function's output approaches as its input gets arbitrarily close to a given point, even if the function is not defined at that point itself. Limits underpin many core ideas in analysis — including continuity, derivatives, and asymptotic behavior — and have practical interpretive value in analytic domains. This function:

  • Uses SymPy's symbolic limit capability to compute the limit of f_of_x as its independent variable approaches point.
  • Optionally plots the function near point and overlays a tangent line to illustrate the local approach behavior.
  • Returns the symbolic limit expression for programmatic inspection.

Parameters

ParameterTypeDefaultDescription
f_of_xrequiredA symbolic (SymPy) expression or a numeric callable (e.g., lambda) representing f(x).
pointrequiredThe input value that x approaches (e.g., 0, infinity, or a finite critical point).
stepfloat0.001Step size used for numerical approximation or plotting.
plot_functionboolFalseIf True, generate a matplotlib plot of f_of_x near point.
plot_tangent_lineboolFalseIf True, plot a tangent line at the point.
x_minimumfloatNoneThe lower bound of the range over which to plot f_of_x. If None, a default window around point is chosen.
x_maximumfloatNoneThe upper bound of the range over which to plot f_of_x. If None, a default window around point is chosen.
nint500Number of points used for plotting.
tangent_line_windowfloat1.0Width of the window around point over which the tangent line is drawn.
**plot_kwargsAdditional keyword arguments passed to the plotting routine.

Returns

A symbolic SymPy expression representing the limit of f_of_x as x approaches point.

Example

python
from analysistoolbox.calculus import FindLimitOfFunction
import sympy

# Find the limit of sin(x)/x as x approaches 0 (a classic indeterminate form)
x = sympy.symbols('x')
FindLimitOfFunction(sympy.sin(x) / x, point=0, plot_function=True)