/**
 * Takes a polar representation of a complex number in string format and returns the sliced parts.
 *
 * @param polarStr The polar representation of a complex number in string format, in the form "r∠θ".
 * @return A Pair containing the sliced parts - magnitude and angle - of the polar representation.
 * @throws IllegalArgumentException If the input string format is not valid.
 *
 * Example:
 * polarStringSlice("2∠45") -> Pair(2.0, 45)
 * polarStringSlice("5∠-30") -> Pair(5.0, -30)
 */
fun polarStringSlice(polarStr: String): Pair<Double, Int> {

    // Extracting the magnitude part of the polar representation
    val magnitudeStr = polarStr.substringBefore('∠')

    // Extracting the angle part of the polar representation
    val angleStr = polarStr.substringAfter('∠')

    // Converting the magnitude part to a Double
    val magnitude = magnitudeStr.toDouble()

    // Converting the angle part to an Int
    val angle = angleStr.toInt()

    return Pair(magnitude, angle)
}
/**
 * Takes a polar representation of a complex number in string format and returns the sliced parts.
 *
 * @param polarStr The polar representation of a complex number in string format, in the form "r∠θ".
 * @return A Pair containing the sliced parts - magnitude and angle - of the polar representation.
 * @throws IllegalArgumentException If the input string format is not valid.
 *
 * Example:
 * polarStringSlice("2∠45") -> Pair(2.0, 45)
 * polarStringSlice("5∠-30") -> Pair(5.0, -30)
 */
fun polarStringSlice(polarStr: String): Pair<Double, Int> {
/**
 * Takes a polar representation of a complex number in string format and returns the sliced parts.
 *
 * @param polarStr The polar representation of a complex number in string format, in the form "r∠θ".
 * @return A Pair containing the sliced parts - magnitude and angle - of the polar representation.
 * @throws IllegalArgumentException If the input string format is not valid.
 *
 * Example:
 * polarStringSlice("2∠45") -> Pair(2.0, 45)
 * polarStringSlice("5∠-30") -> Pair(5.0, -30)
 */
fun polarStringSlice(polarStr: String): Pair<Double, Int> {

    // Extracting the magnitude part of the polar representation
    val magnitudeStr = polarStr.substringBefore('∠')

    // Extracting the angle part of the polar representation
    val angleStr = polarStr.substringAfter('∠')

    // Converting the magnitude part to a Double
    val magnitude = magnitudeStr.toDouble()

    // Converting the angle part to an Int
    val angle = angleStr.toInt()

    return Pair(magnitude, angle)
}