####################################################################################################
## Code generation
####################################################################################################

diffeqtoproc := proc(deq, yofz)
    local lc, a;
    fail_if_singular(deq, yofz, [0]);
    lc := read_diffeq(deq, yofz)[1][-1];
    a := convert(evalf(first_root(lc,z)/10),rational,2);
    if a = infinity then a := 1 end if;
    ac_eval(deq, yofz, [0,a], 10);
    proc(x, prec := Digits)
        local path;
        if type(x, list(complex(rational))) then
            path := x;
        elif type(x, complex(rational)) then
            path := [0,x];
        else
            error("expected a point or a path with rational coefficients");
        end if;
        ac_eval(deq, yofz, path, prec);
    end proc:
end proc:
