/**
 * Given a list of complex numbers in polar representation, convert them to Cartesian representation.
 *
 * Each complex number is represented as a pair (r, theta), where r is the magnitude
 * and theta is the angle in radians.
 *
 * @param numbers A list of complex numbers in polar representation.
 * @return A list of complex numbers in Cartesian representation.
 */
import kotlin.math.cos
import kotlin.math.sin


fun polarToCartesian(numbers: List<Pair<Double, Double>>): List<Pair<Double, Double>> {

    val cartesianNumbers = mutableListOf<Pair<Double, Double>>()

    for (num in numbers) {
        val (r, theta) = num
        val x = r * cos(theta)
        val y = r * sin(theta)
        cartesianNumbers.add(Pair(x, y))
    }

    return cartesianNumbers
}
import kotlin.math.cos
import kotlin.math.sin

/**
 * Given a list of complex numbers in polar representation, convert them to Cartesian representation.
 *
 * Each complex number is represented as a pair (r, theta), where r is the magnitude
 * and theta is the angle in radians.
 *
 * @param numbers A list of complex numbers in polar representation.
 * @return A list of complex numbers in Cartesian representation.
 */
fun polarToCartesian(numbers: List<Pair<Double, Double>>): List<Pair<Double, Double>> {
import kotlin.math.cos
import kotlin.math.sin

/**
 * Given a list of complex numbers in polar representation, convert them to Cartesian representation.
 *
 * Each complex number is represented as a pair (r, theta), where r is the magnitude
 * and theta is the angle in radians.
 *
 * @param numbers A list of complex numbers in polar representation.
 * @return A list of complex numbers in Cartesian representation.
 */
fun polarToCartesian(numbers: List<Pair<Double, Double>>): List<Pair<Double, Double>> {

    val cartesianNumbers = mutableListOf<Pair<Double, Double>>()

    for (num in numbers) {
        val (r, theta) = num
        val x = r * cos(theta)
        val y = r * sin(theta)
        cartesianNumbers.add(Pair(x, y))
    }

    return cartesianNumbers
}