/**
 * This function compares two complex numbers in polar representation.
 *
 * @param a A tuple containing the magnitude and angle of the first complex number.
 * @param b A tuple containing the magnitude and angle of the second complex number.
 * @return 1 if both complex numbers are same, 0 otherwise.
 */
fun comparePolarNumbers(a: Pair<Double, Double>, b: Pair<Double, Double>): Int {

    if (a !is Pair<*, *> || b !is Pair<*, *>) {
        return -1
    }

    if (a.first == null || a.second == null || b.first == null || b.second == null) {
        return -1
    }

    // Extract magnitude and angle from pairs
    val (magnitudeA, angleA) = a
    val (magnitudeB, angleB) = b

    // Check if both magnitudes and angles are equal
    return if (magnitudeA == magnitudeB && angleA == angleB) {
        1
    } else {
        0
    }
}
/**
 * This function compares two complex numbers in polar representation.
 *
 * @param a A tuple containing the magnitude and angle of the first complex number.
 * @param b A tuple containing the magnitude and angle of the second complex number.
 * @return 1 if both complex numbers are same, 0 otherwise.
 */
fun comparePolarNumbers(a: Pair<Double, Double>, b: Pair<Double, Double>): Int {
/**
 * This function compares two complex numbers in polar representation.
 *
 * @param a A tuple containing the magnitude and angle of the first complex number.
 * @param b A tuple containing the magnitude and angle of the second complex number.
 * @return 1 if both complex numbers are same, 0 otherwise.
 */
fun comparePolarNumbers(a: Pair<Double, Double>, b: Pair<Double, Double>): Int {

    if (a !is Pair<*, *> || b !is Pair<*, *>) {
        return -1
    }

    if (a.first == null || a.second == null || b.first == null || b.second == null) {
        return -1
    }

    // Extract magnitude and angle from pairs
    val (magnitudeA, angleA) = a
    val (magnitudeB, angleB) = b

    // Check if both magnitudes and angles are equal
    return if (magnitudeA == magnitudeB && angleA == angleB) {
        1
    } else {
        0
    }
}