randFromArray(["+", "-"]) rand(2) randVar() new RationalExpression([[randRangeWeightedExclude(-10, 10, 1, 0.4, [0]),X], randRangeNonZero(-10, 10)])
new Term(randRangeNonZero(-10, 10)) new Term(randRange(1, 10))
new RationalExpression([[randRangeWeightedExclude(-10, 10, 1, 0.4, [0]),X], randRangeNonZero(-10, 10)]) ORDER ? EXPR1 : TERM1 ORDER ? EXPR2 : TERM2 ORDER ? TERM1 : EXPR1 ORDER ? TERM2 : EXPR2 N1.multiply(D2) N2.multiply(D1) SIGN === '+' ? N_PRODUCT1.add(N_PRODUCT2) : N_PRODUCT1.add(N_PRODUCT2.multiply(-1)) D2.multiply(D1) D_PRODUCT.isNegative() ? N_SUM.getGCD(D_PRODUCT).multiply(-1) : N_SUM.getGCD(D_PRODUCT) N_SUM.divide(FACTOR) D_PRODUCT.divide(FACTOR)
rand(2) ? new Term(randRangeExclude(-10, 10, [-1, 0, 1])) : new Term(randRangeExclude(-10, 10, [-1, 0, 1]), X) ORDER ? EXPR1 : TERM1 ORDER ? TERM3: TERM2 ORDER ? TERM1 : EXPR1 ORDER ? TERM2 : TERM3 N1.multiply(D2) N2.multiply(D1) SIGN === '+' ? N_PRODUCT1.add(N_PRODUCT2) : N_PRODUCT1.add(N_PRODUCT2.multiply(-1)) D2.multiply(D1) D_PRODUCT.isNegative() ? N_SUM.getGCD(D_PRODUCT).multiply(-1) : N_SUM.getGCD(D_PRODUCT) N_SUM.divide(FACTOR) D_PRODUCT.divide(FACTOR)
rand(2) ? new Term(randRangeNonZero(-10, 10)) : new Term(randRangeNonZero(-10, 10), X) ORDER ? TERM3 : TERM1 ORDER ? EXPR1 : TERM2 ORDER ? TERM1 : TERM3 ORDER ? TERM2 : EXPR1 N1.multiply(D2) N2.multiply(D1) SIGN === '+' ? N_PRODUCT1.add(N_PRODUCT2) : N_PRODUCT1.add(N_PRODUCT2.multiply(-1)) D2.multiply(D1) D_PRODUCT.isNegative() ? N_SUM.getGCD(D_PRODUCT).multiply(-1) : N_SUM.getGCD(D_PRODUCT) N_SUM.divide(FACTOR) D_PRODUCT.divide(FACTOR)

Simplify the following expression:

\dfrac{N1}{D1}N1 SIGN \dfrac{N2}{D2} (N2) N2

(NUMERSOL.toString())/(DENOMSOL.toString())
(NUMERSOL.toString())/(DENOMSOL.toStringFactored())
(NUMERSOL.toStringFactored())/(DENOMSOL.toString())
(NUMERSOL.toStringFactored())/(DENOMSOL.toStringFactored())
NUMERSOL.toString()
NUMERSOL.toStringFactored()

In order to add subtract expressions, they must have a common denominator.

Multiply the first expression by \dfrac{D2}{D2}.

\qquad \dfrac{N1}{D1} \times \dfrac{D2}{D2} = \dfrac{N_PRODUCT1}{D_PRODUCT}

Multiply the second expression by \dfrac{D1}{D1}.

\qquad \dfrac{N2}{D2} \times \dfrac{D1}{D1} = \dfrac{N_PRODUCT2}{D_PRODUCT}

Therefore

\qquad \dfrac{N_PRODUCT1}{D_PRODUCT} SIGN \dfrac{N_PRODUCT2}{D_PRODUCT}

Now the expressions have the same denominator we can simply subtract the numerators:

\qquad \dfrac{N_PRODUCT1 - (N_PRODUCT2) N_PRODUCT2 }{D_PRODUCT}

Distribute the negative sign:

\qquad \dfrac{N_PRODUCT1 + N_PRODUCT2.multiply(-1)}{D_PRODUCT}

Now the expressions have the same denominator we can simply add the numerators:

\qquad \dfrac{N_PRODUCT1 + N_PRODUCT2}{D_PRODUCT}

\qquad \dfrac{N_SUM}{D_PRODUCT}

Simplify the expression by dividing the numerator and denominator by FACTOR:
\qquad NUMERSOL
\qquad \dfrac{NUMERSOL}{DENOMSOL}