Skip to content

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 f(t) is defined as:

dfdt=f(t)=limΔt0f(t+Δt)f(t)Δt

The derivative represents the instantaneous rate of change of f with respect to t.

Derivative and integral illustration

Properties

Linearity:

ddt[af(t)+bg(t)]=adfdt+bdgdt

Product Rule:

ddt[f(t)g(t)]=f(t)g(t)+f(t)g(t)

Chain Rule:

ddt[f(g(t))]=f(g(t))g(t)

Common Derivatives

Function f(t)Derivative f(t)
c (constant)0
tnntn1
eataeat
sin(ωt)ωcos(ωt)
cos(ωt)ωsin(ωt)
ejωtjωejωt
ln(t)1/t

Python Implementation

python
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 f(t) from a to b is:

abf(t)dt=F(b)F(a)

where F(t) is the antiderivative (primitive) of f(t), i.e., F(t)=f(t).

The integral represents the signed area under the curve.

Integration as area

Properties

Linearity:

[af(t)+bg(t)]dt=af(t)dt+bg(t)dt

Additivity over intervals:

acf(t)dt=abf(t)dt+bcf(t)dt

Integration by parts:

udv=uvvdu

Common Integrals

Function f(t)Integral f(t)dt
tn (n1)tn+1n+1
1/tln|t|
eat1aeat
sin(ωt)1ωcos(ωt)
cos(ωt)1ωsin(ωt)
ejωt1jωejωt

Python Implementation

python
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

+eax2dx=πa,a>0

Sinc Integral

+sinc(t)dt=+sin(πt)πtdt=1

Exponential Integral

0eatdt=1a,a>00tneatdt=n!an+1,a>0

Python Implementation

python
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:

+f(t)dt=limalimb+abf(t)dt

Properties

Absolute Convergence: If |f(t)|dt<, then f(t)dt converges absolutely.

Energy Signals: A signal has finite energy if:

E=+|x(t)|2dt<

Python Implementation

python
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 f(t) about t=a is:

f(t)=n=0f(n)(a)n!(ta)n

When a=0, this is the Maclaurin series.

Properties

Important series expansions:

Exponential:

et=n=0tnn!=1+t+t22!+t33!+

Sine:

sin(t)=n=0(1)nt2n+1(2n+1)!=tt33!+t55!

Cosine:

cos(t)=n=0(1)nt2n(2n)!=1t22!+t44!

These series prove Euler's formula:

ejt=n=0(jt)nn!=cos(t)+jsin(t)

Python Implementation

python
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

RuleFormula
Constant(cf)=cf
Sum(f+g)=f+g
Product(fg)=fg+fg
Quotient(f/g)=(fgfg)/g2
Chain(f(g))=f(g)g

Key Integrals for Signal Processing

IntegralValue
eax2dxπ/a
0eatdt1/a
0teatdt1/a2
sinc(t)dt1
0Tsin2(ωt)dtT/2 (if ωT=2πn)