Class Simplifier
java.lang.Object
org.episteme.core.mathematics.symbolic.Simplifier
Provides LegacyExpression simplification using algebraic rules.
Implements various simplification strategies: - Algebraic identities (0·x = 0, 1·x = x, x+0 = x, etc.) - Constant folding (2+3 → 5) - Like term collection (2x + 3x → 5x) - Trigonometric identities (sin²+cos² = 1, etc.)
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Ring<T>>
Expression<T> collectLikeTerms(Expression<T> expr) Collects like terms in an expression.static <T extends Ring<T>>
Expression<T> expandProducts(Expression<T> expr) Expands products in an expression.static <T extends Ring<T>>
Expression<T> simplify(Expression<T> expr) Simplifies an LegacyExpression using all available rules.static <T extends Ring<T>>
Expression<T> simplifyAlgebraic(Expression<T> expr) Simplifies algebraic expressions.static <T extends Ring<T>>
Expression<T> simplifyArithmetic(Expression<T> expr) Simplifies arithmetic operations.static <T extends Ring<T>>
Expression<T> simplifyTrigonometric(Expression<T> expr) Simplifies trigonometric expressions.
-
Constructor Details
-
Simplifier
public Simplifier()
-
-
Method Details
-
simplify
Simplifies an LegacyExpression using all available rules.- Type Parameters:
T- the type- Parameters:
expr- the LegacyExpression to simplify- Returns:
- the simplified expression
-
simplifyArithmetic
Simplifies arithmetic operations.Rules: - x + 0 = x - 0 + x = x - x * 1 = x - 1 * x = x - x * 0 = 0 - 0 * x = 0 - Constant folding: 2 + 3 = 5
- Type Parameters:
T- the type- Parameters:
expr- the expression- Returns:
- simplified expression
-
simplifyAlgebraic
Simplifies algebraic expressions.Rules: - x^0 = 1 - x^1 = x - (x^a)^b = x^(a*b)
- Type Parameters:
T- the type- Parameters:
expr- the expression- Returns:
- simplified expression
-
simplifyTrigonometric
Simplifies trigonometric expressions.Rules: - sin²(x) + cos²(x) = 1 - sin(0) = 0 - cos(0) = 1 - tan(0) = 0
- Type Parameters:
T- the type- Parameters:
expr- the expression- Returns:
- simplified expression
-
collectLikeTerms
Collects like terms in an expression.Example: 2x + 3x → 5x
- Type Parameters:
T- the type- Parameters:
expr- the expression- Returns:
- simplified LegacyExpression with like terms collected
-
expandProducts
Expands products in an expression.Example: (x + 1)(x + 2) → x² + 3x + 2
- Type Parameters:
T- the type- Parameters:
expr- the expression- Returns:
- expanded expression
-