This is a formatting issue, that I think should be reported to WRI.
Quick and dirty workaround could be something like this:
Unprotect[SeriesData];
SeriesData /: MakeBoxes[
ser : SeriesData[
x_, x0_,
{__?(Function[Null, MiscDump`effectiveSign@HoldComplete[#] === "0", HoldAllComplete])},
nmin_Integer, nmax_Integer, den_Integer
],
fmt_
] :=
MakeBoxes[SeriesData[x, x0, {}, nmin, nmax, den], fmt]
Protect[SeriesData];
Now outputting held series data doesn't result in error messages.
SeriesData[t, 0, {0}, 0, 1, 1] // Hold
SeriesData[t, 0, {0.}, 0, 1, 1] // Hold
SeriesData[t, 0, {0 a}, 0, 1, 1] // Hold
SeriesData[t, 0, {Print["leak"] 0}, 0, 1, 1] // Hold
SeriesData[t, 0, {0, 0., 0 a, Print["leak"] 0}, 0, 1, 1] // Hold
(* Hold[O[t]^1] (in all cases) *)
In Function[t, SeriesData[t, 0, {0}, 0, 1, 1]]
expression SeriesData[t, 0, {0}, 0, 1, 1]
is not evaluated, but when this expression is outputted in the FrontEnd it is formatted.
Rules used for formatting of SeriesData
can be found in FormatValues[SeriesData]
. We can see there two rules: first for empty list of coefficients, second for non-empty. In second rule we can find DeleteCases[MiscDump`signsAndTerms, {"0", _}]
code followed by First[MiscDump`signsAndTerms]
, where MiscDump`signsAndTerms
is list containing certain special representation of series terms. Above DeleteCases
removes terms corresponding to 0
coefficients.
It seems that possibility that there will be only 0
coefficients was overlooked and in such case First[MiscDump`signsAndTerms]
receives empty list which results in First::nofirst
error.
Formatting of non-held SeriesData
expression with zero-only coefficients does not result in error, because such expression evaluates to SeriesData
with empty list of coefficients which is covered by first formatting rule.
SeriesData[t, 0, {0}, 0, 1, 1] // InputForm
(* SeriesData[t, 0, {}, 1, 1, 1] *)
SeriesData
expressions have the sameInputForm
, that isInputForm[SeriesData[t, 0, {}, 1, 2, 1]] === InputForm[SeriesData[t, 0, {0}, 1, 2, 1]]
evaluates toTrue
$\endgroup$Hold@SeriesData[t, 0, {}, 0, 1, 1]
does not give the error. Something about the internal representation ofSeriesData
when the coefficients are zero $\endgroup$Hold@SeriesData[t, 0, {0}, 0, 1, 1]
reports an error. TheFunction[ ]
thing is holding it, hence the error $\endgroup$