import math

"Consider a 8-PSK (Phase Shift Keying) modulation with the following parameters:"
    #carrier frequency (normalized) : 0.15
    #symbol duration (normalized): 40 samples

def modulation_frequency_band(f_carrier, T_symbol):
    f_low = f_carrier - 1 / (2 * T_symbol)
    f_high = f_carrier + 1 / (2 * T_symbol)
    
    return f_low, f_high

def main():
    f_carrier = 0.15
    T_symbol = 40
    modulation_order = 8

    # Number of symbols
    num_symbols = modulation_order
    print(f"Number of symbols: {num_symbols}")

    # Bits per symbol
    bits_per_symbol = int(math.log2(modulation_order))
    print(f"Bits per symbol: {bits_per_symbol}")

    # Distinct amplitudes for I and Q components
    distinct_amplitudes = int(math.sqrt(modulation_order))
    print(f"Distinct amplitudes for the in-phase (I) component: {distinct_amplitudes}")
    print(f"Distinct amplitudes for the quadrature (Q) component: {distinct_amplitudes}")

    # Low and high frequencies of the modulation frequency band
    f_low, f_high = modulation_frequency_band(f_carrier, T_symbol)
    print(f"Normalized low frequency of the modulation frequency band: {f_low}")
    print(f"Normalized high frequency of the modulation frequency band: {f_high}")

if __name__ == "__main__":
    main()