/**
 * Converts a Cartesian representation of a complex number to its polar representation.
 *
 * @param x The real part of the complex number.
 * @param y The imaginary part of the complex number.
 * @return A Pair containing the angle in radians and the magnitude of the complex number.
 */
fun cartesianToPolar(x: Double, y: Double): Pair<Double, Double> {

    val r = Math.sqrt(x * x + y * y)
    val theta = Math.atan2(y, x)
    return Pair(theta, r)
}
/**
 * Converts a Cartesian representation of a complex number to its polar representation.
 *
 * @param x The real part of the complex number.
 * @param y The imaginary part of the complex number.
 * @return A Pair containing the angle in radians and the magnitude of the complex number.
 */
fun cartesianToPolar(x: Double, y: Double): Pair<Double, Double> {
/**
 * Converts a Cartesian representation of a complex number to its polar representation.
 *
 * @param x The real part of the complex number.
 * @param y The imaginary part of the complex number.
 * @return A Pair containing the angle in radians and the magnitude of the complex number.
 */
fun cartesianToPolar(x: Double, y: Double): Pair<Double, Double> {

    val r = Math.sqrt(x * x + y * y)
    val theta = Math.atan2(y, x)
    return Pair(theta, r)
}