nerdamer/calculus
Differentiation, integration, limits, sums, products, and Laplace transforms.
nerdamer/calculus. For the functions you write inside nerdamer('...'), see the function reference.Functions
C(x: ExpressionInput): ExpressionFunctionComputes the normalized Fresnel cosine integral C(x) = integral(cos(pi*t^2/2), t, 0, x). Numeric real arguments are evaluated numerically. Symbolic arguments remain as C(x).
defint(f: ExpressionInput, dx: ExpressionInput, from: ExpressionInput, to: ExpressionInput): ExpressionFunctionCalculates the definite integral numerically when the bounds are numbers, with Decimal arithmetic at the configured precision. Setting USE_NATIVE_DEFINT uses adaptive Simpson with native JS numbers instead, which is faster but limited to about 16 digits.
diff(x: ExpressionInput, variable?: ExpressionInput, n?: number | Expression): ExpressionFunctionDifferentiates an expression symbolically. The chain, product, sum, and power rules are applied recursively, together with the built-in derivative table for recognized functions. An omitted variable is inferred as the first variable in the expression. Existing Expression input is reused during normalization.
ilaplace(expr: ExpressionInput, s: ExpressionInput, t: ExpressionInput): ExpressionFunctionComputes a symbolic inverse Laplace transform from a transform variable to a time variable. The strategy applies linearity, extracts constants, consults the inverse transform table, normalizes supported shifted quadratics and exponential delays, and finally tries partial-fraction decomposition.
integrate(input: ExpressionInput, dx?: ExpressionInput, depth: number): ExpressionFunctionExperimental integration controller, independent of the public integrate() API. Recursive table rules call back into this controller with a bounded depth.
laplace(expr: ExpressionInput, t: ExpressionInput, s: ExpressionInput): ExpressionFunctionComputes a symbolic Laplace transform from a time variable to a transform variable. The expression is expanded, linear sums are transformed term by term, constants independent of the time variable are extracted, and the remaining expression is matched against the transform table. Supported exponential factors also shift the transform variable when the remainder is transformable.
limit(expr: ExpressionInput, x: ExpressionInput, val: ExpressionInput, dir: LimitDir, depth: number): ExpressionFunctionComputes a symbolic finite or infinite limit. The implementation combines direct substitution, side-aware pole analysis, simplification, bounded L'Hopital recursion, indeterminate-form rewrites, composition rules, dominant-growth analysis at infinity, and a table of known limits.
product(expr: ExpressionInput, index: ExpressionInput, lower: ExpressionInput, upper: ExpressionInput): ExpressionFunctionComputes a finite product: product(expr, k, a, b) = Π_{k=a}^{b} expr. - If bounds are integers and the number of terms ≤ Settings.MAX_PRODUCT_AND_SUMMATION_ITERATION, evaluates by multiplying each term. - If lower > upper, returns 1 (empty product). - If expr does not depend on the index variable, simplifies to expr^(b − a + 1). - Otherwise returns a symbolic product(expr, k, a, b) node.
S(x: ExpressionInput): ExpressionFunctionComputes the normalized Fresnel sine integral S(x) = integral(sin(pi*t^2/2), t, 0, x). Numeric real arguments are evaluated numerically. Symbolic arguments remain as S(x).
sum(expr: ExpressionInput, index: ExpressionInput, lower: ExpressionInput, upper: ExpressionInput): ExpressionFunctionComputes a finite summation: sum(expr, k, a, b) = Σ_{k=a}^{b} expr. - If bounds are integers and the number of terms ≤ Settings.MAX_PRODUCT_AND_SUMMATION_ITERATION, evaluates by accumulating each term. - If lower > upper, returns 0 (empty range). - If expr does not depend on the index variable, simplifies to expr · (b − a + 1). - Otherwise returns a symbolic sum(expr, k, a, b) node.
taylor(input: ExpressionInput, variable: ExpressionInput, center: ExpressionInput, order: ExpressionInput): ExpressionFunctionConstructs a finite Taylor polynomial about a center, through the specified degree. Derivatives and coefficients are computed symbolically. If a derivative cannot be resolved, a coefficient is undefined, or the work budget is exhausted, the entire call is preserved as an unevaluated taylor(...) rather than returning a partial series.
