# Expression Manipulation – Collects integer and non-integer powers simultaneously

Imagine we have an expression that contains both integers ($$y$$. $$y ^ 3$$. $$y ^ 8$$ etc.) and non-integer powers ($$y ^ {1+ alpha}$$. $$y ^ {2 , alpha}$$. $$y ^ {2 + 3 , alpha}$$) of the variables $$y$$, from where $$alpha in mathbb {R}$$. $$alpha> 0$$,

For example

``````expr=(-1 + (-1 + x) y + (-1 + x - x^2) y^2) ((1 + x)^4 (1 + y^2 a2(x) +
y^α sna(x))^2 ((1 + (-1 + x) y) (1 +
1/2 (-1 + x) x (-1 + (-1 + x) x (6 + x (-8 + 3 x))) y +
y^α sna(x)) (1 + 1/2 (-1 + x) x (1 + (-1 + x) x (-14 + x (-8 + 21 x))) y +
y^α sna(x)) + (1 +1/2 x (-1 + x (35 + x (-76 + x (23 + (46 - 27 x) x)))) y +
y^α sna(x)) (3 + 1/2 (-4 + 5 x - 3 x^2 - 20 x^3 + 73 x^4 - 78 x^5 + 27 x^6) y +
y^α (3 + 2 (-1 + x) y) sna(x))))
``````

and `sna(x)` is a real function of another variable `x` we do not care.

I just want `Collect` all powers of `y` – both integer and non-integer, so the final expression looks something like this

$$sum_ {n = 0} ^ {N} , a_n (x) , y ^ {n} + y ^ { alpha} , sum_ {k = 0} ^ {K} b_k (x) , y ^ k + y ^ {2 , alpha} , sum_ {j = 0} ^ {J} c_k (x) , y ^ k + …$$ and so on, depending on what is the highest multiple of $$alpha$$ in an exponent for some integers $$N$$. $$K$$. $$J$$,

I tried

``````Block({\$Assumptions = α > 0 && α ∈ Reals},
Collect(expr, y, Simplify))
``````

and

``````Block({\$Assumptions = α > 0 && α ∈ Reals},
Collect(expr, {y, y^α}, Simplify))
``````

but they do not work.