# Revision history [back]

### 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^2diff(f1(x), x, x) + epdiff(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^2diff(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.

 2 None tmonteil 25538 ●29 ●183 ●476 http://wiki.sagemath.o...

### arrange an expression in powers of a variable

I have the following code:

f0 = function('f0')(x) function('f0')(x)
f1 = function('f1')(x) var('ep') function('f1')(x)
var('ep')
y = f0+ep*f1 de=ep*diff(y,x,2)+diff(y,x) expand(de)f0+ep*f1
de=ep*diff(y,x,2)+diff(y,x)
expand(de)


which gives the output:

ep^2diff(f1(x),

ep^2*diff(f1(x), x, x) + epdiff(f0(x), ep*diff(f0(x), x, x) + ep*diff(f1(x), x) + diff(f0(x), x)x)


How can I rearrange this expression in powers of "ep" parameter? i.e

ep^2diff(f1(x),

ep^2*diff(f1(x), x, x) + ep( ep*( diff(f0(x), x, x) + diff(f1(x), x) ) + diff(f0(x), x)x)


Then I want to get the coefficient for each power (which is a differential eq) and then pass it to the desolve.