Say we wish to expand the following:
Expand[(1 -
1/S) (b - \[Beta] \[Tau] S f[
i_] - (\[CurlyPhi] + Subscript[c,
1] + \[Mu]) S + \[Theta] V + \[Eta] R) + (1 -
1/V) (\[CurlyPhi] S - (\[Theta] + Subscript[c,
2] + \[Mu]) V) + (1 -
1/i) (\[Beta] \[Tau] S f[
i_] - (Subscript[\[Alpha], 1] + Subscript[c,
3] + \[Gamma] + \[Mu]) i) + (1 - 1/Q) (Subscript[c, 1] S +
Subscript[c, 2] V +
Subscript[c, 3]
i - (\[Psi] + Subscript[\[Alpha], 2] + \[Mu]) Q) + (1 -
1/R) (\[Psi] Q + \[Gamma] i - (\[Eta] + \[Mu]) R)]
Doing so results in:
b - b/S + \[Gamma] - (i \[Gamma])/R + \[Eta] - (
R \[Eta])/S + \[Theta] - (V \[Theta])/S + 5 \[Mu] - i \[Mu] -
Q \[Mu] - R \[Mu] - S \[Mu] - V \[Mu] + \[CurlyPhi] - (
S \[CurlyPhi])/V + \[Psi] - (Q \[Psi])/R + \[Beta] \[Tau] f[i_] - (
S \[Beta] \[Tau] f[i_])/i + Subscript[c, 1] - (
S Subscript[c, 1])/Q + Subscript[c, 2] - (
V Subscript[c, 2])/Q + Subscript[c, 3] - (
i Subscript[c, 3])/Q + Subscript[\[Alpha], 1] -
i Subscript[\[Alpha], 1] + Subscript[\[Alpha], 2] -
Q Subscript[\[Alpha], 2]
The terms are all "jumbled" so my question is: how would we expand it in order they appear? That is, expand the first bracket $\big((1-1/s)(...)\big)$ then the second etc such that the final result is in chronology.
_
in your variable namesf[i_]
$\endgroup$Plus
isOrderless
. You can't usePlus
as the head, if you wish to maintain a custom order. You can use other things, such asInactive[Plus]
as the head. You could tryInactive[Plus] @@ Expand[List @@ expr]
-- maybe you'd like the result, maybe not. $\endgroup$