Optimizer and graph plotter for functions with two arguments