for i in r.keys():
if not isinstance(i, str) and i >= 0:
chareq += (r[i]*diff(x**symbol, x, i)*x**-symbol).expand()
(this is for converting a differential eq to polynomial and then simplifying it by replacing f(x) by x**symbol, where symbol = Dummy('x'))
homogeneous eq: a*x^2*f(x).diff(x,2) + b*x*f(x).diff(x) + c*f(x) = 0
non homogeneous eq: a*x^2*f(x).diff(x,2) + b*x*f(x).diff(x) + c*f(x) = g(x)
this is the code under "ode_nth_linear_euler_eq_homogeneous" under L3178
I am using the same code for non homogeneous but there I have extra g(x) term and I am unable to decide what r.keys() has in itself for g(x) as g(x) has x**(power) term.