/**
 * Converts a complex number in polar form to rectangular form
 */
fun polarToRectangular(theta: Double, r: Double): Pair<Double, Double> {

    // Initialize the real and imaginary parts
    var real = 0.0
    var imag = 0.0

    // Convert theta to radians
    val thetaRad = theta * Math.PI / 180.0

    // Calculate the real and imaginary parts
    real = r * Math.cos(thetaRad)
    imag = r * Math.sin(thetaRad)

    // Return the complex number in rectangular form
    return Pair(real, imag)
}
/**
 * Converts a complex number in polar form to rectangular form
 */
fun polarToRectangular(theta: Double, r: Double): Pair<Double, Double> {
/**
 * Converts a complex number in polar form to rectangular form
 */
fun polarToRectangular(theta: Double, r: Double): Pair<Double, Double> {

    // Initialize the real and imaginary parts
    var real = 0.0
    var imag = 0.0

    // Convert theta to radians
    val thetaRad = theta * Math.PI / 180.0

    // Calculate the real and imaginary parts
    real = r * Math.cos(thetaRad)
    imag = r * Math.sin(thetaRad)

    // Return the complex number in rectangular form
    return Pair(real, imag)
}