Skip to content

SeriesCoefficient ​

The coefficient of (x−x0)n(x-x_0)^n in the Taylor series of ff about x0x_0, via f(n)(x0)n!\frac{f^{(n)}(x_0)}{n!}. Provided by @enumeratio/analytic.

✓ checked against that system · ! checked, with disagreements (hover a chip)FungrimSeriesCoefficientWolfram LanguageSeriesCoefficient!
SeriesCoefficient(f, {x, x0, n})the coefficient of (x−x0)n(x-x_0)^n, for nn a nonnegative integer and ff analytic at x0x_0 (an ordinary point).
Typed signatures
TypePackageApplies
(expression, list<any^3>) -> numberanalyticalways

Domain: Analytic

Details
  • Exact for the ordinary-point Taylor case: nn nonnegative integer, ff with no pole or branch point at x0x_0. Computed as Dn(f)D^n(f) evaluated at x0x_0, divided by n!n! — no series expansion is built, just repeated differentiation.
  • Also: c xmIν(kx)c\,x^m I_\nu(kx) and c xmJν(kx)c\,x^m J_\nu(kx) about 00 (ν\nu a nonnegative integer) at any index, symbolic nn included, read off the power series: a Piecewise that is zero unless n−m−νn-m-\nu is a nonnegative even number.
  • Also: c (bx+d)ac\,(bx+d)^a (a power, a root, a reciprocal) at a symbolic nn, read off the binomial series: c(an)bnu0a−nc\binom{a}{n} b^n u_0^{a-n} with u0u_0 the base at x0x_0, a Piecewise that is zero for negative nn. A real root (CubeRoot, an odd Root) keeps its real branch at a negative base. Wolfram writes the same sequence as a DifferenceRoot for a root.
  • Declined on purpose: nn negative or non-integer (a Laurent or Puiseux coefficient — the derivative formula doesn't apply past an ordinary point) and ff singular exactly at x0x_0 even where the singularity is removable (e.g. sin⁡(x)/x\sin(x)/x at 00) — the result is checked for a leftover free occurrence of the expansion variable or a non-finite value, and declined rather than trusted, whenever either shows up.

Examples

1 more kept as data, checked against the oracles
Basic #

[x2] ex[x^2]\, e^x about x0=1x_0=1 is e/2e/2

live ↗
InSeriesCoefficient(ex,[x,1,2])\mathrm{SeriesCoefficient}(e^{x}, \bigl\lbrack x, 1, 2\bigr\rbrack)Oute2\frac{e}{2}

[x5] sin⁡x=1120[x^5]\, \sin x = \frac{1}{120}

live ↗
InSeriesCoefficient(sin⁡(x),[x,0,5])\mathrm{SeriesCoefficient}(\sin(x), \bigl\lbrack x, 0, 5\bigr\rbrack)Out1120\frac{1}{120}

every coefficient of 11−x\frac{1}{1-x} about 00 is 11

live ↗
InSeriesCoefficient(11−x,[x,0,10])\mathrm{SeriesCoefficient}(\frac{1}{1-x}, \bigl\lbrack x, 0, 10\bigr\rbrack)Out11

[x4] ln⁡(1+x)=−14[x^4]\, \ln(1+x) = -\frac{1}{4}

live ↗
InSeriesCoefficient(ln⁡(1+x),[x,0,4])\mathrm{SeriesCoefficient}(\ln(1+x), \bigl\lbrack x, 0, 4\bigr\rbrack)Out−14-\frac{1}{4}
Scope #

With a symbolic index nn the coefficient is left to the rational function

live ↗
InSeriesCoefficient(xx−5,[x,0,n])\mathrm{SeriesCoefficient}(\frac{x}{x-5}, \bigl\lbrack x, 0, n\bigr\rbrack)OutSeriesCoefficient(xx−5,[x,0,n])\mathrm{SeriesCoefficient}(\frac{x}{x-5}, \bigl\lbrack x, 0, n\bigr\rbrack)

A rational function with three poles, coefficient left symbolic in nn

live ↗
InSeriesCoefficient(x3(x−3)(x−2)(x−1),[x,0,n])\mathrm{SeriesCoefficient}(\frac{x^3}{(x-3)(x-2)(x-1)}, \bigl\lbrack x, 0, n\bigr\rbrack)OutSeriesCoefficient(x3(x−3)(x−2)(x−1),[x,0,n])\mathrm{SeriesCoefficient}(\frac{x^3}{(x-3)(x-2)(x-1)}, \bigl\lbrack x, 0, n\bigr\rbrack)

The log of a reciprocal root is rewritten as −12ln⁡(1−5x2)-\frac12\ln(1-5x^2)

live ↗
InSeriesCoefficient(ln⁡(11−5x2),[x,0,n])\mathrm{SeriesCoefficient}(\ln(\frac{1}{\sqrt{1-5x^2}}), \bigl\lbrack x, 0, n\bigr\rbrack)OutSeriesCoefficient(ln⁡(11−5x2),[x,0,n])\mathrm{SeriesCoefficient}(\ln(\frac{1}{\sqrt{1-5x^2}}), \bigl\lbrack x, 0, n\bigr\rbrack)
live ↗
InSeriesCoefficient(ex1−x,[x,0,n])\mathrm{SeriesCoefficient}(\frac{e^{x}}{1-x}, \bigl\lbrack x, 0, n\bigr\rbrack)OutSeriesCoefficient(ex1−x,[x,0,n])\mathrm{SeriesCoefficient}(\frac{e^{x}}{1-x}, \bigl\lbrack x, 0, n\bigr\rbrack)
live ↗
InSeriesCoefficient(I⁡3(2x)x7,[x,0,n])\mathrm{SeriesCoefficient}(\frac{\operatorname{I}_{3}(2x)}{x^7}, \bigl\lbrack x, 0, n\bigr\rbrack)OutPiecewise([[1Γ(n/2+3)Γ(n/2+6),n mod 2=0∧−4≤n]],0)\mathrm{Piecewise}(\bigl\lbrack\bigl\lbrack\frac{1}{Γ(n/2+3)Γ(n/2+6)}, n\bmod2=0∧-4≤n\bigr\rbrack\bigr\rbrack, 0)
Properties #

The same, with the sign of the quadratic flipped

live ↗
InSeriesCoefficient(ln⁡(15x2+1),[x,0,n])\mathrm{SeriesCoefficient}(\ln(\frac{1}{\sqrt{5x^2+1}}), \bigl\lbrack x, 0, n\bigr\rbrack)OutSeriesCoefficient(ln⁡(15x2+1),[x,0,n])\mathrm{SeriesCoefficient}(\ln(\frac{1}{\sqrt{5x^2+1}}), \bigl\lbrack x, 0, n\bigr\rbrack)
Possible issues #

the residue of 1/x1/x at 00 is a Laurent coefficient, past what the derivative formula covers — declined, not guessed

live ↗
InSeriesCoefficient(1x,[x,0,−1])\mathrm{SeriesCoefficient}(\frac{1}{x}, \bigl\lbrack x, 0, -1\bigr\rbrack)OutSeriesCoefficient(1x,[x,0,−1])\mathrm{SeriesCoefficient}(\frac{1}{x}, \bigl\lbrack x, 0, -1\bigr\rbrack)

sin⁡(x)/x\sin(x)/x is singular exactly at the expansion point (removably so) — declined rather than risk the wrong limit

live ↗
InSeriesCoefficient(sin⁡(x)x,[x,0,0])\mathrm{SeriesCoefficient}(\frac{\sin(x)}{x}, \bigl\lbrack x, 0, 0\bigr\rbrack)OutSeriesCoefficient(sin⁡(x)x,[x,0,0])\mathrm{SeriesCoefficient}(\frac{\sin(x)}{x}, \bigl\lbrack x, 0, 0\bigr\rbrack)
About
Examples13
Checked againstWolfram Language 5 agree8 differ
CrosswalkFungrimWolfram Language