In my textbook about industrial robots it says that if the angle q5 in this robot is equal to 0, there are infinite solutions for the angles q4 and q6. I understand this part, but I have a problem with the equation below.

As a solution for this the book says f(q4,q6) = c1*(q4A - q4)^2 + c2*(q6A-q6)^2 = MIN

q4A and q6A are the joint angles calculated from the previous backward transformation when driving a robot path.

By the above equation, a solution for q4 and q6 is taken which is closest to the previous solution.

Between two IK solutions (intermediate points) on a line that the TCP must travel, Q4 must rotate from -pi/2 to -3/2*pi, and Q6 must rotate from pi/2 to -pi/2. Both joints must therefore cover a rotation of -pi.

So the formula would be: c1*(-pi/2 - (-3/2*pi))^2 + c2*(pi/2-(-pi/2))^2

Since I do not know c1 and c2 and the book does not tell me how to determine them, I cannot calculate a solution. How do I calculate the angles for Q4 and Q6?