Balanced Move
import mathy_core.rules.balanced_move
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 |
|---|---|---|
| 3x + 7 = 2 + 4x | 7 = 2 + 4x - 3x | ✔ |
| 3x + 1 = 4 | 3x = 4 - 1 | ✔ |
| 8 = 2x | 8 / 2 = 2x / 2 | ✔ |
| 3x + 7 = 2 + 4x | 3x + 7 - 4x = 2 | ✔ |
| 3x = 3 | 3x / 3 = 3 / 3 | ✔ |
| 3x + 7 = 2 | --- | --- |
| 3x / 15 + 3 = 3 | --- | --- |
| 2x | --- | --- |
| 2 | --- | --- |
API¶
BalancedMoveRule¶
BalancedMoveRule(self, args, kwargs)
Addition: a + 2 = 3 -> a + 2 - 2 = 3 - 2 Multiplication: 3a = 3 -> 3a / 3 = 3 / 3
get_type¶
BalancedMoveRule.get_type(
self,
node: mathy_core.expressions.MathExpression,
) -> Optional[str]
Supports the following configurations: - Addition is a term connected by an addition to the side of an equation or inequality. It generates two subtractions to move from one side to the other. - Multiply is a coefficient of a term that must be divided on both sides of the equation or inequality.