Chapter 1
Design of the ode solver program

This gives high level view of my ode solver program which is in development for academic use. The program design is based on top-down modular design. There are a number of public API’s each to do different functionality. The main API is dsolve. But there other API’s for doing other things such as finding eigenvalues and eigenvectors.

This diagrams show the top level design

The following is pseudo code of the dsolve API. This is one of main calls into the solver to solve single differential equation. It returns back all solutions found.

dsolve:=proc(ode,y(x),IC,hint::string) 
 
-- This CALL validates the ode itself. IC are validated by each separate module below 
ode_MGR:-parse_ode(ode); 
 
-- the following factors ode if possible. For example for y''*y'=0 
-- gives y''=0 and y'=0 factors. If not possible to factor, ode is left as is 
 
ode_factors := factor_ode(ode); 
 
solutions_found := {}; 
 
FOR current_factor in ode_factors DO -- must have at least one 
 
    -- possible to have factor not ode. Example x*y'=0, only factor is y'=0 
    -- and x factor is ignored. 
    IF current_factor has y THEN 
       -- find ode order to know which module to call. 
       ode_order := ode_MGR:-:-get_ode_order(current_factor); 
 
       IF ode_order = 0 then -- algebraic factor 
          -- handle case of factor has only y and no y'. For example 
          -- cos(y)*y'=0, then factors are  cos(y)=0 and y'=0 
          solution := SOLVE(current_factor=0,y) 
       ELIF ode_order = 1 then 
          solution := first_order_ode:-dsolve(current_factor=0,IC,hint); 
       ELIF ode_order = 2 then 
          solution := second_order_ode:-dsolve(current_factor=0,IC,hint); 
       ELSE 
          solution := higher_order_ode:-dsolve(current_factor=0,IC,hint); 
       FI; 
 
       -- collect solutions and remove duplicates 
       solutions_found := solutions_found UNION solution; 
    END IF; 
END DO; 
 
RETURN solutions_found 
END proc;