/**
 * Converts the given complex number in polar representation to rectangular form.
 *
 * @param complexNumber A string representing the complex number in polar form, e.g. "r ∠ theta"
 * @return A Pair representing the complex number in rectangular form, e.g. (realPart, imaginaryPart)
 */
fun polarToRectangular(complexNumber: String): Pair<Double, Double> {

    // Extracting the magnitude and angle from the string
    val (magnitude, angle) = complexNumber.split("∠")

    // Converting magnitude and angle to Double
    val magnitudeValue = magnitude.toDouble()
    val angleValue = angle.toDouble()

    // Calculating the real and imaginary parts using polar to rectangular conversion
    val realPart = magnitudeValue * Math.cos(Math.toRadians(angleValue))
    val imaginaryPart = magnitudeValue * Math.sin(Math.toRadians(angleValue))

    return Pair(realPart, imaginaryPart)
}
/**
 * Converts the given complex number in polar representation to rectangular form.
 *
 * @param complexNumber A string representing the complex number in polar form, e.g. "r ∠ theta"
 * @return A Pair representing the complex number in rectangular form, e.g. (realPart, imaginaryPart)
 */
fun polarToRectangular(complexNumber: String): Pair<Double, Double> {
/**
 * Converts the given complex number in polar representation to rectangular form.
 *
 * @param complexNumber A string representing the complex number in polar form, e.g. "r ∠ theta"
 * @return A Pair representing the complex number in rectangular form, e.g. (realPart, imaginaryPart)
 */
fun polarToRectangular(complexNumber: String): Pair<Double, Double> {

    // Extracting the magnitude and angle from the string
    val (magnitude, angle) = complexNumber.split("∠")

    // Converting magnitude and angle to Double
    val magnitudeValue = magnitude.toDouble()
    val angleValue = angle.toDouble()

    // Calculating the real and imaginary parts using polar to rectangular conversion
    val realPart = magnitudeValue * Math.cos(Math.toRadians(angleValue))
    val imaginaryPart = magnitudeValue * Math.sin(Math.toRadians(angleValue))

    return Pair(realPart, imaginaryPart)
}