messed up trigonometric functions