cos^(-1) from the formula is not acos. you need 1/cos(...).