I am relatively new to R, but I would like to use it find the values of b1 and b2 that maximize the following equation: (sum(cos(x3+2.33474-2(atan(b1*x1+b2*x2))))) Any help would be greatly appreciated.