Calculation of trigonometric functions