Compute the Taylor series expansion of f(x) about a given point up to degree n.
Computes the Taylor series T(x) = Σ f⁽ᵏ⁾(a)/k! · (x−a)ᵏ for k=0 to n. The coefficients f⁽ᵏ⁾(a) are estimated numerically using finite differences. The result is the polynomial approximation evaluated at the requested x, along with a comparison to the exact function value.
Taylor series
T(x) = Σ [f^(k)(a) / k!] · (x - a)^k, for k = 0 to n
Accuracy improves with higher degree and proximity to the center a. The error is bounded by the (n+1)-th derivative term.
A Maclaurin series is simply a Taylor series centered at a = 0.