How are frequency and energy of a wave related?