A methodology for comparing algorithms and a method of computing mth order directional derivatives based on factorable programming