Restate Subtraction
import mathy_core.rules.restate_subtraction
Examples¶
Info
All the examples shown below are drawn from the mathy test suite that verifies the expected input/output combinations for rule transformations.
Input | Output | Valid |
---|---|---|
-9 = -10 - -h | -9 = -10 + h | ✔ |
-7 - -4 = -t | -7 + 4 = -t | ✔ |
m - 3 = 3 | m + -3 = 3 | ✔ |
3u^2 - -1t^4 + -u^2 | 3u^2 + 1t^4 + -u^2 | ✔ |
-4x^3 - -2x^3 | -4x^3 + 2x^3 | ✔ |
4x - -2x | 4x + 2x | ✔ |
m^2 - (3m^2 - 12m^2 - g^2) | m^2 + -(3m^2 - 12m^2 - g^2) | ✔ |
2x - 9 | 2x + -9 | ✔ |
2x - 9x | 2x + -9x | ✔ |
2x - 9x^3 | 2x + -9x^3 | ✔ |
2x + -9 | 2x - 9 | ✔ |
2x + -9x | 2x - 9x | ✔ |
2x + -9x^3 | 2x - 9x^3 | ✔ |
4 - 3x | 4 + -3x | ✔ |
API¶
RestateSubtractionRule¶
RestateSubtractionRule(self, args, kwargs)
get_type¶
RestateSubtractionRule.get_type(
self,
node: mathy_core.expressions.MathExpression,
) -> Optional[str]
Support two types of tree configurations: - Subtraction is a subtract to be restate as a plus negation - PlusNegative is a plus negative const to be restated as subtraction