# I haven't really encountered this specific type of problem before, but you could try using euler's formula
# so if you have something in the form (a(cosx + isinx))/(b(cosy + isiny)) you can rewrite it as (a/b)*(e^(i(x-y)))