1 | initial version |
Alternatively, you can use collect():
sage: de.collect(ep)
ep^2*diff(f1(x), x, x) + ep*(diff(f0(x), x, x) + diff(f1(x), x)) + diff(f0(x), x)
To get the coefficient of ep^2 you can do:
sage: de.coefficients(ep)[2][0]
diff(f1(x), x, x)
To get all the coefficients at once:
sage: de.coefficients()
[[diff(f0(x), x), 0],
[diff(f0(x), x, x) + diff(f1(x), x), 1],
[diff(f1(x), x, x), 2]]
2 | No.2 Revision |
Alternatively, you can use collect():
sage: de.collect(ep)
ep^2*diff(f1(x), x, x) + ep*(diff(f0(x), x, x) + diff(f1(x), x)) + diff(f0(x), x)
To get the coefficient of ep^2 you can do:
sage: de.coefficients(ep)[2][0]
diff(f1(x), x, x)
To get all the coefficients at once:
sage: de.coefficients()
[[diff(f0(x), x), 0],
[diff(f0(x), x, x) + diff(f1(x), x), 1],
[diff(f1(x), x, x), 2]]
If you define
sage: epcoeff = [de.coefficients(ep)[i][0] for i in range(len(de.coefficients()))]
you can access the coefficient of ep^n
using epcoeff[n]
, so that you can feed it to desolve
etc.