arrange an expression in powers of a variable
I have the following code:
f0 = function('f0')(x)
f1 = function('f1')(x)
var('ep')
y = f0+ep*f1
de=ep*diff(y,x,2)+diff(y,x)
expand(de)
which gives the output:
ep^2*diff(f1(x), x, x) + ep*diff(f0(x), x, x) + ep*diff(f1(x), x) + diff(f0(x), x)
How can I rearrange this expression in powers of "ep" parameter? i.e
ep^2*diff(f1(x), x, x) + ep*( diff(f0(x), x, x) + diff(f1(x), x) ) + diff(f0(x), x)
Then I want to get the coefficient for each power (which is a differential eq) and then pass it to the desolve.