2
$\begingroup$
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.

$\endgroup$

3 Answers 3

1
$\begingroup$

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} *)
$\endgroup$
2
  • $\begingroup$ Table[c[j, n], {j, 0, 2}] and CoefficientList[Series[f[x], {x, a, 2}], x] look different to me $\endgroup$
    – Torkoal
    Nov 25 at 7:32
  • $\begingroup$ You are correct. I forgot to include the (-1)^(k - j) term. I'll correct that now. $\endgroup$
    – JimB
    Nov 25 at 15:52
5
$\begingroup$

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}]

enter image description here

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 *)
$\endgroup$
2
  • $\begingroup$ Much nicer, I have to admit (+1)! $\endgroup$
    – bmf
    Nov 21 at 6:39
  • $\begingroup$ I know I sound crazy, but I don't think this matches CoefficientList because it isn't monomials? $\endgroup$
    – Torkoal
    Nov 21 at 6:42
4
$\begingroup$

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]

$\endgroup$
7
  • $\begingroup$ Thanks so much! Is there anyway to get rid of the incomplete gamma function? $\endgroup$
    – Torkoal
    Nov 21 at 6:22
  • 1
    $\begingroup$ @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. $\endgroup$
    – bmf
    Nov 21 at 6:33
  • $\begingroup$ Hm, it doesn't seem to match the values of the original expression (I've listed them in the question) $\endgroup$
    – Torkoal
    Nov 21 at 6:50
  • $\begingroup$ @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 $\endgroup$
    – bmf
    Nov 21 at 6:58
  • 1
    $\begingroup$ @Torkoal oh I see now. My mistake. I did not realize this at first. I thought you wanted the leading term for arbitrary order. $\endgroup$
    – bmf
    Nov 21 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.