# convert to partial fraction;

toparfrac(x_/(c_+x_)):= 1-c/(c+x);
toparfrac(1/(c_+x_^2)):= If(c==x, 1/x-1/(x+1), 1/2/((x-sqrt(-c))*sqrt(-c))-1/2/((sqrt(-c)+x)*sqrt(-c)) );
toparfrac(1/(c_-x_^2)):= If(c==x, 1/x+1/(1-x), 1/2/((x+sqrt(c))*sqrt(c))-1/2/((sqrt(c)-x)*sqrt(c)) );