Module substitution

Module substitution 

Source
Expand description

U-substitution for integration

Implements automatic u-substitution detection and execution for composite functions. Handles patterns like f’(g(x)) * g’(x) by substituting u = g(x).

§Algorithm

  1. Identify candidate substitutions u = g(x) from the integrand structure
  2. Compute du = g’(x) dx for each candidate
  3. Check if integrand can be rewritten as f(u) * du (possibly with constant factor)
  4. Integrate f(u) with respect to u
  5. Substitute back u = g(x) in the result

§Supported Patterns

  • Polynomial inner functions: ∫2x*sin(x²) dx = -cos(x²)
  • Exponential compositions: ∫e^x*sin(e^x) dx = -cos(e^x)
  • Logarithmic patterns: ∫1/(x*ln(x)) dx = ln|ln(x)|
  • Rational functions: ∫x/(x²+1) dx = (1/2)*ln(x²+1)
  • Linear inner functions: ∫sqrt(x+1) dx = (2/3)(x+1)^(3/2)

§Patterns Recognized

Pattern 1: f'(x)·g(f(x)) - Exact derivative match

  • Example: 2x·e^(x²) where u = x², du = 2x dx

Pattern 2: c·f'(x)·g(f(x)) - Derivative with coefficient

  • Example: x·sin(x²) where u = x², du = 2x dx, coefficient = 1/2

Pattern 3: f^n(x)·f'(x) - Power of function times derivative

  • Example: sin³(x)·cos(x) where u = sin(x), du = cos(x) dx

Pattern 4: f(ax+b) - Constant derivative (linear inner function)

  • Example: sqrt(x+1) where u = x+1, du = 1 dx (constant derivative)

Functions§

try_substitution
Try to integrate using u-substitution