1.2.5 Special solutions. section 3-1-2 in Murphy
-- tries special cases 
-- input y' = f0 + f1 y + f2 y^2 
 
riccati_solver_3_1_2 :=proc(ode) 
 
    -- Let y=f0/f1, this converts the ode to 
    -- u' = F + G u + u^2 
    -- where F=f0/f2, G=f1+f2'/f2 
 
    IF G=0 THEN -- (a) case in Murphy, page 17 
        u' = F + u^2 
        IF F(x) = c x^m THEN 
            -- this is reduced riccati. Solved. 
        ELIF F(x) is polynomial of x with more than one term (say x+x^2) THEN 
            IF degree of F(x) is odd (say u'=x+x^3 + b u^2) THEN 
                NO SOLUTION exist  -- (a.i) 
            ELSE degree of F(x) is even (say u'=x+x^2 + b u^2) THEN 
                SOLUTION can exist. see Murphy page 17  -- (a.ii, page 17) 
            END IF 
        END IF 
    ELSE -- case where G /=0 (b case in Murphy, page 17) 
        let u= w - G/2 and   u' = F + G u + u^2 becomes 
            -- w' = H + w^2 
            -- where 4 H + G^2 = 4 F + 2 G' 
        Let Q = G^2 -4 F -2 G' 
 
        IF Q polynomial of odd degree THEN -- (b.i) 
            NO solution. 
        ELIF Q polynomial of even degree THEN 
            Try as on page 18, Murphy in the hope to find solution. -- (b.ii) 
        ELIF Q is constant THEN 
             see page 18, part i  -- (c.i case, page 17) 
             see page 18, part ii  -- (c.ii case, page 17) 
        END IF 
    END IF 
 
    IF still not solved THEN 
       IF ode has form phi(x) y' = f0 + f1 y + f2 y^2 THEN 
            IF all coefficients f_i are polynomials in x THEN -- case (d. page 17) 
                Let particular solution be  y1=R(x). 
                -- let y=u+y1, the ode becomes 
                -- phi(x) y' = F u + f2 u^2, where F=f1 + 2 f2 R 
                -- see rest case d. 
            END IF 
        END IF 
    END IF 
 
    -- case (e). See page 19 
    -- to finish