I'm currently developing my own equation calculator and considering how to simplify equations effectively. In this process, I aim to express formulas in either rational number form (p/q) or in an irreducible form involving well-known irrational constants such as π, e, or square roots like √3.
My question is: Given a number (e.g., π or 4/3), is there a method to determine whether the result of a trigonometric function can be expressed as a rational number? If so, I want to output the rational representation. If the result is irrational, I want to simplify it as much as possible using known mathematical constants (such as π, e) or algebraic irrational numbers (like √3), while preserving the simplest form possible.
For example:
If the output can be exactly expressed as a rational number, return it. If not, check if it can be rewritten in a form involving algebraic irrationals, rational numbers, and basic arithmetic operations (addition, subtraction, multiplication, division). Is there a systematic way to achieve this? Any insights or references to existing methods would be greatly appreciated!