Semidefinite Relaxation for Quadratic and Quartic Optimization with Applications to Wireless Communication