modified function definition for tan and cos