3
$\begingroup$

When I ask SeriesCoefficient[] to give me a general term, it outputs a response with head "Piecewise" that contains the general term in the first line and (every time I tried it) "0 True" in the second line. SeriesCoefficient[][[2]] brings back the '0' but not 'True'. There is no [[3]].

My hunch is that this device is used for many functions (answering, say, "Is there valid output at input '0'?) but tbh I have no idea. Thanks, TB

Example (from documentation):

SeriesCoefficient[Exp[-x], {x, 0, n}]

Output: enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ Are you asking what the second entry in piecewise means? It means for any other n, the result is zero. i.e. for n<0 the result is zero. True means for everything else. So in this case, everything else is n<0. To find the internal structure and levels of piecewise result, you can look at its FullForm. $\endgroup$
    – Nasser
    Commented 15 hours ago
  • $\begingroup$ In general, a series can start or end with any term. The Piecewise covers all possibilities. Look at f[x_] = Exp[-x]; Sum[SeriesCoefficient[f[x], {x, 0, n}] x^n, {n, -Infinity, Infinity}] == f[x] $\endgroup$
    – Bob Hanlon
    Commented 14 hours ago

1 Answer 1

4
$\begingroup$

Second argument stands for default value of the Piecewise function when none of the conditions holds. Such a behavior of SeriesCoefficient[...] might be helpful, e.g., for the successive summation

Sum[SeriesCoefficient[Exp[-x], {x, 0, n}], {n, -\[Infinity], \[Infinity]}] (*=>1/E*)

Still, this output of SeriesCoefficient[...] is a bit silly as the Piecewise evaluates to non-zero value even when n is non-integer positive. E.g. try

Sum[SeriesCoefficient[Exp[-x], {x, 0, n}] /. n -> k + 1/2, {k, -\[Infinity], \[Infinity]}]

If you want to avoid Piecewise, you can use

SeriesCoefficient[Exp[-x], {x, 0, n}, Assumptions->n>0] (*=> (-1)^n/n!*)
$\endgroup$
1
  • $\begingroup$ Thank you! I will explore these. TB $\endgroup$
    – Tom Barson
    Commented 14 hours ago

Your Answer

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

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