1.2.1 Main solver (section 3-1 in Murphy)
INPUT y'= f0 + f1 y + f2 y^2 where f2 /= 0 
 
RICCATI_SOLVER := proc(ode) 
    IF all f0,f1,f2 are constants OR f0=0 then 
        -- this is either quadrature or Bernoulli. 
        SOL:= solve as Bernoulli or quadrature 
    ELSE 
        IF f1=0 THEN -- linear term is missing 
            IF f0=c x^m AND f2=b (where b,m,c are constants) THEN 
                -- ode now is y' = c x^m + b y^2 , This is the studied by Riccati 
                -- called REDUCED riccati ode 
                SOL:= reduced_riccati_solver(ode) -- Section 3-2 in Murphy book. 
            END IF 
        ELIF ode has form  x y' = c x^n + a y - b y^2 THEN 
            -- here, c,n,a,b are CONSTANTS 
            SOL:= CALL riccati_solver_3_3(ode)  -- section 3-3 in Murphy book 
        END IF 
 
        IF still not solved from above THEN 
            -- try to transform the ode y'=f0 + f1 y + f2 y^2 
            -- to form u'=F(x)+u^2 by removing the linear term 
            SOL:= riccati_solver_3_1_3(ode) -- Section 3-1-3 in Murphy book. 
        END IF 
 
        IF still not solved from above THEN 
            -- try special solutions. Murphy section 3-1-2 
            SOL:= riccati_solver_3_1_2(ode) 
        END IF 
 
 
        IF still NOT solved then 
           SOL:= riccati_solver_3_1_1(ode) -- section 3-1-1 in Murphy 
        END IF 
    END IF 
 
    return SOL 
 
END PROC;