3.18 How to find the coefficients of a linear ode?

Given a linear ode of the form \(A y''+B y' + C y= f(x)\) how to find \(A,B,C,f(x)\) ?

ode:=diff(y(x),x$3)+ x*diff(y(x),x)+99*y(x)=sin(x); 
L:=DEtools:-convertAlg(ode,y(x)); #this only works on linear ode's
 
Gives L := [[99, x, 0, 1], sin(x)].

\(L\) is a list. The second entry is \(f(x)\) and the first entry of \(L\) is a list which gives the coefficients of the ode. Notice they are ordered from lowest order to highest order of the ode. Since this is third order ode, then there are \(4\) entries. The first is the coefficient of \(y(x)\), the second is the coefficient of \(y'\) and the third is the coefficient of \(y''\) and the fourth entry is the coefficient of \(y'''\). Notice that coefficient of \(y''\) is zero since \(y''\) is missing from the ode.

This function DEtools:-convertAlg only works on linear ode’s. Therefore we need to check if the ode is linear first before using. How to check for linear ode is given above.