Update: Sorry, my internet was sporadically on, mostly out, after I first posted.
V14.3 solution
Eventually, I hope to find the Q&A where this issue arose with a change in behavior of Series[] that @azerbajdzan alludes to, whether knowingly or not. After the comment, I recalled someone coming up with the following workaround. I may have been me, ironically. I include it in case someone coming across this Q&A is looking for a way to cull the up-to-linear terms of an expression that has only high-order terms.
Normal[(A /. v : Alternatives @@ Variables[A] :> v $t) +
O[$t]^2] /. $t -> 1
(* -1 + a + b *)
Normal[(a^4 /. v : Alternatives @@ Variables[A] :> v $t) +
O[$t]^2] /. $t -> 1
(* 0 *)
Here is one reference to the issue in V14.3 by @Acacia, with the above solution by me, tee-hee:
- Unexpected behavior of `Series` for version 14.3?
- This comment by @DanielLichtblau states it was an intentional change in behavior.
Early-version alternate solution
Here is the standard way (I think it's found in several places on site):
Normal@Series[
A /. v : Alternatives @@ Variables[A] :> v $t, {$t, 0,
1}] /. $t -> 1
(* -1 + a + b *)
Explanation
First, Variables[A] finds all variables in the expression:
Variables[A]
(* {a, b, c, d, e, f} *)
The code
v : Alternatives @@ Variables[A] :> v $t
(* v : a | b | c | d | e | f :> v $t *)
creates a replacement rule that can be understood as follows. First, v : ... gives an explicit name v to the stuff that follows. The expression a | b | c | d | e | f read roughly as a or b or c or d or e or f (although this isn't the logical operator Or; instead, this is what's used in pattern matching to indicate that any of those expressions match the pattern)
Thus, v : a | b | c | d | e | f reads as "If the expression is exactly the same as a or b or c or d or e or f, call that expression v". Then, the replacement rule means to take such a v and replace it with v*$t, where $t is just a place-holder variable name.
Finally, we apply the replacement rule using ReplaceAll (/.), and so
A /. v : Alternatives @@ Variables[A] :> v $t
replaces every instance of a or b or c or d or e or f that appears in A with the same variable but multiplied by $t.
Finally, we perform a Taylor series about $t=0 out to first order, which will keep only terms that have one instance of the variables. Finally, Normal cuts off the O[$t]^2 term so that we can turn this back into a standard expression, and we replace every instance of $t with 1 using ... /. $t ->1 to get back the original variables.