Calculus Essentials
Calculus is the mathematical language for describing change and accumulation. In signal processing, differentiation describes how signals change over time, while integration computes energy, averages, and transforms.
Differentiation
Definition
The derivative of a function
The derivative represents the instantaneous rate of change of

Properties
Linearity:
Product Rule:
Chain Rule:
Common Derivatives
| Function | Derivative |
|---|---|
Python Implementation
import numpy as np
import matplotlib.pyplot as plt
# Numerical differentiation
def numerical_derivative(f, t, dt=1e-6):
"""Compute derivative using central difference."""
return (f(t + dt) - f(t - dt)) / (2 * dt)
# Example: f(t) = sin(2πt)
t = np.linspace(0, 2, 200)
omega = 2 * np.pi
f = np.sin(omega * t)
df_analytical = omega * np.cos(omega * t)
df_numerical = numerical_derivative(lambda x: np.sin(omega * x), t)
plt.figure(figsize=(10, 4))
plt.plot(t, f, 'b-', linewidth=2, label=r'$f(t) = \sin(2\pi t)$')
plt.plot(t, df_analytical, 'r-', linewidth=2, label=r"$f'(t) = 2\pi\cos(2\pi t)$")
plt.plot(t, df_numerical, 'g--', linewidth=2, label='Numerical derivative')
plt.xlabel('t')
plt.ylabel('Amplitude')
plt.title('Function and Its Derivative')
plt.legend()
plt.grid(True)
plt.show()Integration
Definition
The definite integral of
where
The integral represents the signed area under the curve.

Properties
Linearity:
Additivity over intervals:
Integration by parts:
Common Integrals
| Function | Integral |
|---|---|
Python Implementation
import numpy as np
from scipy import integrate
# Numerical integration
def f(t):
return np.exp(-t)
# Definite integral from 0 to infinity
result, error = integrate.quad(f, 0, np.inf)
print(f"∫₀^∞ e^(-t) dt = {result:.6f} (analytical: 1)")
# Numerical integration using trapezoidal rule
t = np.linspace(0, 10, 1000)
dt = t[1] - t[0]
y = f(t)
integral_trapz = np.trapz(y, t)
print(f"Trapezoidal approximation: {integral_trapz:.6f}")
# Cumulative integral (running integral)
cumulative = integrate.cumulative_trapezoid(y, t, initial=0)
import matplotlib.pyplot as plt
plt.figure(figsize=(10, 4))
plt.subplot(1, 2, 1)
plt.plot(t, y, 'b-', linewidth=2)
plt.fill_between(t, y, alpha=0.3)
plt.xlabel('t')
plt.ylabel('f(t)')
plt.title(r'$f(t) = e^{-t}$')
plt.grid(True)
plt.subplot(1, 2, 2)
plt.plot(t, cumulative, 'r-', linewidth=2)
plt.xlabel('t')
plt.ylabel(r'$\int_0^t f(\tau) d\tau$')
plt.title('Cumulative Integral')
plt.grid(True)
plt.axhline(y=1, color='k', linestyle='--', label='Limit = 1')
plt.legend()
plt.tight_layout()
plt.show()Important Integrals in Signal Processing
Gaussian Integral
Sinc Integral
Exponential Integral
Python Implementation
import numpy as np
from scipy import integrate
# Gaussian integral: ∫ exp(-ax²) dx = √(π/a)
a = 2.0
result, _ = integrate.quad(lambda x: np.exp(-a * x**2), -np.inf, np.inf)
analytical = np.sqrt(np.pi / a)
print(f"Gaussian integral (a={a}): {result:.6f}, analytical: {analytical:.6f}")
# Sinc integral: ∫ sinc(t) dt = 1
result, _ = integrate.quad(np.sinc, -100, 100)
print(f"Sinc integral: {result:.6f} (analytical: 1)")
# Exponential moments: ∫₀^∞ t^n e^(-at) dt = n!/a^(n+1)
a = 1.0
for n in range(4):
result, _ = integrate.quad(lambda t: t**n * np.exp(-a * t), 0, np.inf)
analytical = np.math.factorial(n) / a**(n+1)
print(f"n={n}: ∫ t^{n} e^(-t) dt = {result:.4f} (analytical: {analytical:.4f})")Improper Integrals and Convergence
Definition
An improper integral has infinite limits or an unbounded integrand:
Properties
Absolute Convergence: If
Energy Signals: A signal has finite energy if:
Python Implementation
import numpy as np
from scipy import integrate
def signal_energy(x_func, t_min=-100, t_max=100):
"""Compute energy of a signal."""
integrand = lambda t: np.abs(x_func(t))**2
energy, _ = integrate.quad(integrand, t_min, t_max)
return energy
# Decaying exponential (energy signal)
x1 = lambda t: np.exp(-np.abs(t))
E1 = signal_energy(x1)
print(f"Energy of e^(-|t|): {E1:.4f} (analytical: 1)")
# Gaussian (energy signal)
x2 = lambda t: np.exp(-np.pi * t**2)
E2 = signal_energy(x2)
print(f"Energy of exp(-πt²): {E2:.4f} (analytical: 1/√2 ≈ {1/np.sqrt(2):.4f})")Taylor and Maclaurin Series
Definition
The Taylor series of
When
Properties
Important series expansions:
Exponential:
Sine:
Cosine:
These series prove Euler's formula:
Python Implementation
import numpy as np
import matplotlib.pyplot as plt
from math import factorial
def taylor_exp(t, n_terms):
"""Taylor series approximation of e^t."""
return sum(t**n / factorial(n) for n in range(n_terms))
def taylor_sin(t, n_terms):
"""Taylor series approximation of sin(t)."""
return sum((-1)**n * t**(2*n+1) / factorial(2*n+1) for n in range(n_terms))
t = np.linspace(-3, 3, 200)
plt.figure(figsize=(12, 4))
# Exponential approximation
plt.subplot(1, 2, 1)
plt.plot(t, np.exp(t), 'k-', linewidth=2, label='exp(t)')
for n in [1, 2, 3, 5]:
y = np.array([taylor_exp(ti, n) for ti in t])
plt.plot(t, y, '--', label=f'{n} terms')
plt.ylim([-1, 10])
plt.xlabel('t')
plt.ylabel('f(t)')
plt.title('Taylor Series of exp(t)')
plt.legend()
plt.grid(True)
# Sine approximation
plt.subplot(1, 2, 2)
plt.plot(t, np.sin(t), 'k-', linewidth=2, label='sin(t)')
for n in [1, 2, 3, 5]:
y = np.array([taylor_sin(ti, n) for ti in t])
plt.plot(t, y, '--', label=f'{n} terms')
plt.ylim([-2, 2])
plt.xlabel('t')
plt.ylabel('f(t)')
plt.title('Taylor Series of sin(t)')
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()Summary
Differentiation Rules
| Rule | Formula |
|---|---|
| Constant | |
| Sum | |
| Product | |
| Quotient | |
| Chain |
Key Integrals for Signal Processing
| Integral | Value |
|---|---|