creating calculateOmega function