/**
 * This function takes real and imaginary numbers as input and returns the polar representation
 * of the complex number. If the complex number is in the first or fourth quadrant, it returns
 * the angle in degrees; otherwise, it returns false.
 *
 * @param real The real component of the complex number.
 * @param imag The imaginary component of the complex number.
 * @return The angle in degrees if in the first or fourth quadrant, false otherwise.
 */
fun polarRepresentationComplexNumbers(real: Double, imag: Double): Double? {

    if (real > 0 && imag >= 0) {
        val theta = Math.atan(imag / real) * (180 / Math.PI)
        return theta
    } else if (real < 0 && imag >= 0) {
        val theta = 180 - (Math.atan(Math.abs(imag) / Math.abs(real)) * (180 / Math.PI))
        return theta
    } else if (real < 0 && imag < 0) {
        val theta = 180 + (Math.atan(Math.abs(imag) / Math.abs(real)) * (180 / Math.PI))
        return theta
    } else if (real > 0 && imag < 0) {
        val theta = 360 - (Math.atan(Math.abs(imag) / real) * (180 / Math.PI))
        return theta
    }
    return null
}
/**
 * This function takes real and imaginary numbers as input and returns the polar representation
 * of the complex number. If the complex number is in the first or fourth quadrant, it returns
 * the angle in degrees; otherwise, it returns false.
 *
 * @param real The real component of the complex number.
 * @param imag The imaginary component of the complex number.
 * @return The angle in degrees if in the first or fourth quadrant, false otherwise.
 */
fun polarRepresentationComplexNumbers(real: Double, imag: Double): Double? {
/**
 * This function takes real and imaginary numbers as input and returns the polar representation
 * of the complex number. If the complex number is in the first or fourth quadrant, it returns
 * the angle in degrees; otherwise, it returns false.
 *
 * @param real The real component of the complex number.
 * @param imag The imaginary component of the complex number.
 * @return The angle in degrees if in the first or fourth quadrant, false otherwise.
 */
fun polarRepresentationComplexNumbers(real: Double, imag: Double): Double? {

    if (real > 0 && imag >= 0) {
        val theta = Math.atan(imag / real) * (180 / Math.PI)
        return theta
    } else if (real < 0 && imag >= 0) {
        val theta = 180 - (Math.atan(Math.abs(imag) / Math.abs(real)) * (180 / Math.PI))
        return theta
    } else if (real < 0 && imag < 0) {
        val theta = 180 + (Math.atan(Math.abs(imag) / Math.abs(real)) * (180 / Math.PI))
        return theta
    } else if (real > 0 && imag < 0) {
        val theta = 360 - (Math.atan(Math.abs(imag) / real) * (180 / Math.PI))
        return theta
    }
    return null
}