calculateTheta2 function
Calculates the argument (phase) in radians in the range [0, 2π).
Takes the principal argument theta1 and shifts it to the positive range.
Implementation
double calculateTheta2(double theta1) {
return theta1 >= 0 ? theta1 : theta1 + (2 * math.pi);
}