Implement the mathematical functions sin, cos, tan, csc, sec, cot, along with their inverse functions asin, acos, atan, acsc, asec, and acot, in Python. The implementation must satisfy the following specific requirements to ensure correctness as demonstrated in the provided test cases:
Function Definitions:
Each function should accept a single argument, which can be a scalar (integer, float, symbolic) and should handle different input types (like symbols from sympy).
Handling Special Cases:
Define behavior for special input values:
sin, cos, tan should return nan for nan and zoo for infinity values.
sin(oo), cos(oo), tan(oo) should return AccumBounds(-1, 1) for sin, AccumBounds(-1, 1) for cos, and AccumBounds(-oo, oo) for tan.
Return zero for inputs that are integral multiples of π for sin and cos functions.
For sec and csc, handle values that would lead to division by zero appropriately.
Trigonometric Relationships:
Implement the following trigonometric identities correctly:
sin(x + π) = -sin(x)
cos(x + π) = -cos(x)
tan(x + π) = tan(x)
Ensure the relationships between the trigonometric functions and their inverses hold true, e.g., sin(asin(x)) = x.
Series Expansions:
Implement the Taylor series expansions for these functions around 0 up to the 6th order (or as required in test cases).
Rewrite Functionality:
Ensure that sin, cos, tan, sec, csc, and cot can be rewritten in terms of one another and exponential functions (exp), as prescribed in test cases.
Algebraic Properties:
Implement checks for algebraic properties, including when the functions return algebraic numbers, rationality, or real/imaginary types.
Differentiation:
Implement the differentiation of these functions, returning the correct derivatives as defined in calculus.
Error Handling:
Ensure that appropriate exceptions are raised for invalid input arguments (for example, requesting the second derivative without proper context).
Implement the functions in the /app/ directory, ensuring your code is clean, well-documented, and adheres to Python's best practices. All tests provided must pass upon completion of the implementation.