Where \(n\) can not be \(1\). \(a\) can be missing but not \(b,c\). And \(a,b,c\) are scalars.
The parsing routing returns either FAIL or \(a,b,c,b\) if pattern is matched.
homog_c_parse:=proc(ode::`=`,func::function(name),$) local RHS; local y:=op(0,func); local x:=op(1,func); local la,a,b,c,n,p,the_power; try RHS:=timelimit(30,[solve(ode,diff(y(x),x))]); if nops(RHS)<>1 then RETURN(FAIL); fi; RHS:=simplify(RHS[1]); catch: RETURN(FAIL); end try; if patmatch(RHS,(p::anything)^(the_power::anything),'la') then assign(la); if the_power=1 then RETURN(FAIL); fi; if patmatch(p,a::anything+b::anything*x+c::anything*y(x),'la') then assign(la); if has(a,x) or has(a,y(x)) then RETURN(FAIL); fi; if has(b,x) or has(b,y(x)) then RETURN(FAIL); fi; if has(c,x) or has(c,y(x)) then RETURN(FAIL); fi; RETURN(a,b,c,the_power); else if patmatch(p,b::anything*x+c::anything*y(x),'la') then assign(la); if has(b,x) or has(b,y(x)) then RETURN(FAIL); fi; if has(c,x) or has(c,y(x)) then RETURN(FAIL); fi; RETURN(0,b,c,the_power); else RETURN(FAIL); fi; fi; else RETURN(FAIL); fi; end proc:
Examples usages
ode:=diff(y(x),x)=(3+9*x+8*y(x))^(1/2): homog_c_parse(ode,y(x)); DEtools:-odeadvisor(ode); 1 3, 9, 8, - 2 [[_homogeneous, class C], _dAlembert] ode:=diff(y(x),x)=(3+9*x+8*y(x))^(2): homog_c_parse(ode,y(x)); DEtools:-odeadvisor(ode); 3, 9, 8, 2 [[_homogeneous, class C], _Riccati] ode:=(x+y(x))*diff(y(x),x)=1: homog_c_parse(ode,y(x)); DEtools:-odeadvisor(ode); 0, 1, 1, -1 [[_homogeneous, class C], [_Abel, 2nd type, class C], _dAlembert] ode:=diff(y(x),x)=sqrt(x+y(x)+1): homog_c_parse(ode,y(x)); DEtools:-odeadvisor(ode); 1 1, 1, 1, - 2 [[_homogeneous, class C], _dAlembert] ode:=diff(y(x),x)=1/(x+y(x)+1): homog_c_parse(ode,y(x)); DEtools:-odeadvisor(ode); 1, 1, 1, -1 [[_homogeneous, class C], [_Abel, 2nd type, class C], _dAlembert] ode:=diff(y(x),x)=1/(x+y(x)+sin(x)): homog_c_parse(ode,y(x)); DEtools:-odeadvisor(ode); FAIL [[_Abel, 2nd type, class C]] ode:=diff(y(x),x)=(x+y(x)^2)^(2/3): homog_c_parse(ode,y(x)); DEtools:-odeadvisor(ode); FAIL [y=_G(x,y')]