# Find Generalized Series with Symbolic Variable

CoefficientList[Series[Exp[x], {x, a, 3}], x]


Gives the following expression, $$\left\{-\frac{1}{6} e^a a^3+\frac{e^a a^2}{2}-e^a a+e^a,\frac{e^a a^2}{2}-e^a a+e^a,\frac{e^a}{2}-\frac{a e^a}{2},\frac{e^a}{6}\right\}$$ However, I'd like to be able to find what the generalized coefficient formula should be for any number of terms. Sadly, I cannot give Series a symbolic argument for n and SeriesCoefficient doesn't seem like what I'm looking for either.

The values should match the original expression, so if $$a=0.5$$ then: $${0.996102, 1.03045, 0.41218, 0.274787}$$

I want to find a closed form for the collected coefficients.

I'm assuming you want the "formula" for what CoefficientList[Series[f[x], {x, a, n}], x] gives. If you want the term associated with $$x^j$$, that is the following:

c[j_, n_] := Sum[Binomial[k, j] (-1)^(k - j) a^(k - j) (D[f[x], {x, k}] /. x -> a)/k!, {k, j, n}]


Here is a specific example:

f[x_] := Exp[x]
n = 3;

CoefficientList[Series[f[x], {x, a, 3}], x]
(* {E^a - a E^a + (a^2 E^a)/2 - (a^3 E^a)/6, E^a - a E^a + (a^2 E^a)/2, E^a/2 - (a E^a)/2, E^a/6} *)

c[j_, n_] := Sum[Binomial[k, j] a^(k - j) (D[f[x], {x, k}] /. x -> a)/k!, {k, j, n}]
Table[c[j, n], {j, 0, n}]
(* {E^a - a E^a + (a^2 E^a)/2 - (a^3 E^a)/6, E^a - a E^a + (a^2 E^a)/2, E^a/2 - (a E^a)/2, E^a/6} *)


This just uses the definition of a Taylor series and the binomial theorem.

But if you just want the "formula" for what Series does, then the following is maybe what you want:

n = 3
Series[f[x], {x, a, n}] // Normal
(* E^a + E^a (-a + x) + 1/2 E^a (-a + x)^2 + 1/6 E^a (-a + x)^3 *)
c[j_, n_] := (x - a)^j (D[f[x], {x, j}] /. x -> a)/j!
Table[c[j, n], {j, 0, n}]
(* {E^a, E^a (-a + x), 1/2 E^a (-a + x)^2, 1/6 E^a (-a + x)^3} *)

• Table[c[j, n], {j, 0, 2}] and CoefficientList[Series[f[x], {x, a, 2}], x] look different to me Nov 25 at 7:32
• You are correct. I forgot to include the (-1)^(k - j) term. I'll correct that now.
– JimB
Nov 25 at 15:52

With SeriesCoefficient, the order and expansion point can be symbolic.

\$Version

(* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *)

Clear["Global*"]

coef[n_] = SeriesCoefficient[Exp[x], {x, a, n}] Verification,

Sum[coef[n]*(x - a)^n, {n, 0, Infinity}]

(* E^x *)


EDIT:

Comparing CoefficientLists

m = 20;

CoefficientList[Sum[coef[n]*(x - a)^n, {n, 0, m}], x] ==
CoefficientList[Series[Exp[x], {x, a, m}], x]

(* True *)

• Much nicer, I have to admit (+1)!
– bmf
Nov 21 at 6:39
• I know I sound crazy, but I don't think this matches CoefficientList because it isn't monomials? Nov 21 at 6:42

If I understand correctly what you want the following is your friend

Table[CoefficientList[Series[Exp[x], {x, a, placeholder}], x] //
First, {placeholder, 0, 17}] //
FindSequenceFunction[#, order + 1] &


Gamma[1 + order, -a]/Gamma[1 + order]

• Thanks so much! Is there anyway to get rid of the incomplete gamma function? Nov 21 at 6:22
• @Torkoal You are very welcome. To answer the question, FullSimplify` should do the trick I think, modulo assumptions that you would perhaps need to feed into it.
– bmf
Nov 21 at 6:33
• Hm, it doesn't seem to match the values of the original expression (I've listed them in the question) Nov 21 at 6:50
• @Torkoal this does not make sense, since I am taking the command you wrote and keep the highest term in the expansion. Then I just found the pattern. I did not change anything
– bmf
Nov 21 at 6:58
• @Torkoal oh I see now. My mistake. I did not realize this at first. I thought you wanted the leading term for arbitrary order.
– bmf
Nov 21 at 7:44