SeriesData¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
SeriesData[x, x0, {a0, a1, ...}, nmin, nmax, den]
represents a power series in the variable x about the point x0. The ai are the coefficients in the power series. The powers of (x - x0) that appear are nmin/den, (nmin+1)/den, ..., (nmax-1)/den, and an O[x - x0]^(nmax/den) term represents the omitted higher-order terms.
Normal[expr] converts a SeriesData object into a normal expression, dropping the O-term.
Notes
SeriesData objects are generated by Series. SeriesData objects print as sums of coefficients multiplied by powers of x - x0; InputForm prints the literal SeriesData\[...\] form instead.Examples (18)¶
Every input below was run against the current Mathilda build and its output recorded.
Basic examples (5)¶
In[1]:= SeriesData[x, 0, {1, 1, 1/2, 1/6, 1/24, 1/120}, 0, 6, 1]
Out[1]= 1 + x + 1/2 x^2 + 1/6 x^3 + 1/24 x^4 + 1/120 x^5 + O[x]^6
In[2]:= InputForm[%]
Out[2]= Out[-1]
In[3]:= SeriesData[x, 0, Table[i^2, {i, 10}], 0, 10, 1]
Out[3]= 1 + 4 x + 9 x^2 + 16 x^3 + 25 x^4 + 36 x^5 + 49 x^6 + 64 x^7 + 81 x^8 + 100 x^9 + O[x]^10
In[4]:= SeriesData[x, 2, {a, b, c}, 0, 3, 1]
Out[4]= a + b (x - 2) + c (x - 2)^2 + O[x - 2]^3
In[5]:= SeriesData[x, 0, {1, 2, 3}, 1, 7, 2]
Out[5]= Sqrt[x] + 2 x + 3 x^(3/2) + O[x]^(7/2)
Scope (8)¶
In[6]:= Integrate[Series[Exp[x], {x, 0, 8}], x]
Out[6]= x + 1/2 x^2 + 1/6 x^3 + 1/24 x^4 + 1/120 x^5 + 1/720 x^6 + 1/5040 x^7 + 1/40320 x^8 + 1/362880 x^9 + O[x]^10
In[7]:= D[Series[Exp[x], {x, 0, 8}], x]
Out[7]= 1 + x + 1/2 x^2 + 1/6 x^3 + 1/24 x^4 + 1/120 x^5 + 1/720 x^6 + 1/5040 x^7 + O[x]^8
In[8]:= Integrate[Series[1/x^2 + 1, {x, 0, 3}], x]
Out[8]= -1/x + x + O[x]^5
In[9]:= Series[Exp[x], {x, 0, 2}] + 1
Out[9]= 2 + x + 1/2 x^2 + O[x]^3
In[10]:= x Series[Sin[x], {x, 0, 5}]
Out[10]= x^2 - 1/6 x^4 + 1/120 x^6 + O[x]^7
In[11]:= Series[Exp[x], {x, 0, 2}] Series[Exp[x], {x, 0, 3}]
Out[11]= 1 + 2 x + 2 x^2 + O[x]^3
In[12]:= Series[Exp[x], {x, 0, 2}]^3
Out[12]= 1 + 3 x + 9/2 x^2 + O[x]^3
In[13]:= 2^Series[x, {x, 0, 3}]
Out[13]= 1 + Log[2] x + 1/2 Log[2]^2 x^2 + 1/6 Log[2]^3 x^3 + O[x]^4
Applications (5)¶
In[14]:= SeriesData[x, 0, {1, 1, 1}, 0, 3, 1]
Out[14]= 1 + x + x^2 + O[x]^3
In[15]:= Normal[SeriesData[x, 0, {1, 1, 1}, 0, 3, 1]]
Out[15]= 1 + x + x^2
In[16]:= InputForm[Series[Sin[x], {x, 0, 4}]]
Out[16]= SeriesData[x, 0, {0, 1, 0, -1/6, 0}, 0, 5, 1]
In[17]:= InputForm[Series[1/(Exp[x] - 1), {x, 0, 3}]]
Out[17]= SeriesData[x, 0, {1, -1/2, 1/12, 0, -1/720}, -1, 4, 1]
In[18]:= InputForm[Series[Sqrt[x] + x, {x, 0, 2}]]
Out[18]= SeriesData[x, 0, {0, 1, 1, 0, 0}, 0, 5, 2]
Options & behaviour¶
Calculus on SeriesData¶
D and Integrate operate on a SeriesData term-by-term, returning a new
SeriesData (matching Mathematica).
- Differentiation w.r.t. the series variable applies the power rule to each
term: the coefficient of
(x - x0)^((nmin+i)/den)is multiplied by(nmin+i)/denand the exponent drops by one. Bothnminandnmaxdecrease byden; the differentiated constant term becomes a leading zero and is trimmed. - Integration w.r.t. the series variable raises each term: the coefficient
is multiplied by
den/(nmin+i+den)and the exponent rises by one. Bothnminandnmaxincrease byden. The constant of integration is taken to be0. A genuine(x - x0)^-1term (nonzero residue) integrates to aLogthatSeriesDatacannot represent, soIntegrateis left unevaluated in that case. - With respect to a different variable (when the expansion point
x0is free of that variable),D/Integratethread into the coefficients and keep the powers of(x - x0)unchanged. This branch introduces no exponent shift, so a coefficient that becomes zero (e.g. thea-derivative of ana-independent term) is a genuine zero coefficient and is retained —nminis not raised — exactly asSerieskeeps genuine leading zeros. This makesD[Series[f, {x, x0, n}], a]equalSeries[D[f, a], {x, x0, n}]. (Only the same-variable power rule above trims a leading zero, because its exponent shift opens a phantom boundary slot.)
Arithmetic on SeriesData¶
Plus, Times, and Power combine SeriesData objects (and Divide /
Subtract, which reduce to Times[a, Power[b,-1]] and Plus[a, Times[-1,b]]).
All operands are converted to series about the common (x, x0) and folded with
the internal series algebra; the result is truncated to the minimum O-term
order of the operands.
- Operands that are not series are expanded about the same point and order:
a scalar (free of
x) folds into the constant (a0) coefficient; the bare variable, polynomials, and transcendental functions are series-expanded with the full engine. Mixed exact/approximate coefficients (integer, bigint, rational, machine real, MPFR) combine per-coefficient, so adding a real folds it intoa0while leaving the other coefficients exact, as in Mathematica. - Incompatible operands — series about a different variable or expansion
point — leave the
Plus/Times/Powerunevaluated (a symbolic sum or product of theSeriesDataobjects). - Power: integer exponents (including negative, via series inversion) and
exponents free of the series variable are handled directly. An exponent that
depends on the series variable, or an ordinary base raised to a series
exponent (e.g.
2^Series[...]), is computed asExp[exp*Log[base]].
Implementation notes¶
Data structures. SeriesData[x, x0, {a0, ..., a_{k-1}}, nmin, nmax, den] is
the data head representing a truncated power series produced by Series. The i-th
coefficient a_i multiplies (x - x0)^((nmin + i)/den), and the O[x - x0]^(nmax/den)
term captures the dropped higher-order tail. The integer den (>= 1) is the
common denominator of the exponents, so Laurent (nmin < 0) and Puiseux
(den > 1, fractional exponents) series are both representable. It carries only
ATTR_PROTECTED — there is no builtin_seriesdata handler; it is an inert
container constructed by so_to_expr from the internal SeriesObj and consumed
by Normal (which drops the O-term and rebuilds the explicit Plus of powers)
and by the printer. The same fields mirror the in-memory SeriesObj struct
(x, x0, owned coefficient array, nmin, order, den) used during
computation in series_expand.
Protected.SeriesDatais a pure data head; it has no evaluator and is normally produced bySeries.- Standard printing renders the series as an ordinary mathematical sum:
a0 + a1 (x - x0) + a2 (x - x0)^2 + ... + O[x - x0]^p. Zero coefficients are suppressed, andx0 == 0is displayed as simplyxwithout the subtraction. InputForm[...]switches to the literalSeriesData[x, x0, {...}, nmin, nmax, den]form, which round-trips through the parser.FullForm[...]shows the raw tree structure.
Attributes: Protected.
References¶
See also: Series, D, Integrate, Log, Plus, Times, Power, Divide
- Source:
src/calculus/series.c - Specification:
docs/spec/builtins/power-series.md - Tests:
tests/test_print.c - Tests:
tests/test_series.c - Tests:
tests/test_series_assumptions.c
Notes & additional examples¶
Notes¶
SeriesData[x, x0, {a0, a1, ...}, nmin, nmax, den] is the internal representation
of a power series in x about x0. The powers that appear are
nmin/den, (nmin+1)/den, ..., (nmax-1)/den, with a trailing O[x - x0]^(nmax/den)
term standing in for the omitted tail. The single uniform structure covers Taylor
(nmin >= 0, den = 1), Laurent (nmin < 0), and Puiseux (den > 1) series.
These objects are produced by Series; use Normal to convert one back to an
ordinary polynomial by discarding the O-term, and InputForm to see the literal
SeriesData[...] form instead of the pretty-printed sum.