randFromArray(['multiply', 'divide'])
randFromArray([[0, 1], [1, 0]])
randVar()
randRangeNonZero(-10, 10)
randRangeNonZero(-10, 10)
randRangeNonZero(-10, 10)
randRangeWeightedExclude(-10, 10, 1, 0.4, [0])
(function() {
if (rand(2)) {
if (rand(2)) {
var f1 = new Term(randRangeWeightedExclude(-10, 10, 1, 0.5, [0]), X);
var f2 = new Term(randRangeWeightedExclude(-10, 10, 1, 0.4, [0]));
} else {
var f1 = new Term(randRangeWeightedExclude(-10, 10, 1, 0.4, [0]));
var f2 = new Term(randRangeWeightedExclude(-10, 10, 1, 0.5, [0]), X);
}
} else {
var f1 = new Term(randRangeWeightedExclude(-10, 10, 1, 0.4, [0]));
var f2 = new Term(randRangeWeightedExclude(-10, 10, 1, 0.4, [0]));
}
return [f1, f2];
})()
new RationalExpression([FACTORS[0].multiply(FACTORS[1])])
new RationalExpression([[1, X], A])
new RationalExpression([[1, X], B])
new RationalExpression([[1, X], C])
TERM_B.multiply(TERM_C)
[TERM_A.multiply(FACTOR1), TERM_D]
[TERM_B.multiply(FACTORS[0]), TERM_C.multiply(FACTORS[1])]
[NUMERATORS[0].toString(), '(' + TERM_B.toString() + ')(' + TERM_C.toString() + ')']
[DENOMINATORS[0].toString(), DENOMINATORS[1].toString()]
[NUMERATORS[0].toStringFactored(), NUMER_STRINGS[1]]
[DENOMINATORS[0].toStringFactored(), DENOMINATORS[1].toStringFactored()]
[[FACTOR1], ORDER[0] ? [TERM_B, TERM_C, TERM_A] : [TERM_A, TERM_B, TERM_C]]
[[FACTORS[0], FACTORS[1]], ORDER[0] ? [TERM_C, TERM_B]: [TERM_B, TERM_C]]
TERM_C
[ORDER[0] ? [0, 1] : [1, 2], ORDER]
FACTOR_PRODUCT.isNegative() ? -FACTOR_PRODUCT.getGCD(FACTOR1) : FACTOR_PRODUCT.getGCD(FACTOR1)
NUMERATORS[0].divide(COMMON_FACTOR)
FACTOR_PRODUCT.divide(COMMON_FACTOR)
CANCEL.terms[1].coefficient !== B ? -CANCEL.terms[1] : 0
[TERM_B.multiply(FACTORS[0]), TERM_C.multiply(FACTORS[1])]
[TERM_A.multiply(FACTOR1), TERM_D]
[NUMERATORS[0].toString(), NUMERATORS[1].toString()]
[DENOMINATORS[0].toString(), '(' + TERM_B.toString() + ')(' + TERM_C.toString() + ')']
[NUMERATORS[0].toStringFactored(), NUMERATORS[1].toStringFactored()]
[DENOMINATORS[0].toStringFactored(), DENOM_STRINGS[1]]
[[FACTORS[0], FACTORS[1]], ORDER[0] ? [TERM_C, TERM_B]: [TERM_B, TERM_C]]
[[FACTOR1], ORDER[0] ? [TERM_B, TERM_C, TERM_A] : [TERM_A, TERM_B, TERM_C]]
TERM_C
[ORDER, ORDER[0] ? [0, 1] : [1, 2]]
FACTOR1 < 0 ? -FACTOR_PRODUCT.getGCD(FACTOR1) : FACTOR_PRODUCT.getGCD(FACTOR1)
FACTOR_PRODUCT.divide(COMMON_FACTOR)
DENOMINATORS[0].divide(COMMON_FACTOR)
CANCEL.terms[1].coefficient !== B ? -CANCEL.terms[1] : 0
[TERM_A.multiply(FACTOR1), TERM_D]
[TERM_B.multiply(FACTORS[0]), TERM_A.multiply(FACTORS[1])]
[NUMERATORS[0].toString(), '(' + TERM_B.toString() + ')(' + TERM_C.toString() + ')']
[DENOMINATORS[0].toString(), DENOMINATORS[1].toString()]
[NUMERATORS[0].toStringFactored(), NUMER_STRINGS[1]]
[DENOMINATORS[0].toStringFactored(), DENOMINATORS[1].toStringFactored()]
[[FACTOR1], ORDER[0] ? [TERM_B, TERM_C, TERM_A] : [TERM_A, TERM_B, TERM_C]]
[[FACTORS[0], FACTORS[1]], ORDER[0] ? [TERM_A, TERM_B] : [TERM_B, TERM_A]]
TERM_A
[ORDER[0] ? [0, 2] : [0, 1], ORDER]
FACTOR_PRODUCT.isNegative() ? -FACTOR_PRODUCT.getGCD(FACTOR1) : FACTOR_PRODUCT.getGCD(FACTOR1)
TERM_C.multiply(FACTOR1 / COMMON_FACTOR)
FACTOR_PRODUCT.divide(COMMON_FACTOR)
CANCEL.terms[1].coefficient !== B ? -CANCEL.terms[1] : 0
[TERM_B.multiply(FACTORS[0]), TERM_A.multiply(FACTORS[1])]
[TERM_A.multiply(FACTOR1), TERM_D]
[NUMERATORS[0].toString(), NUMERATORS[1].toString()]
[DENOMINATORS[0].toString(), '(' + TERM_B.toString() + ')(' + TERM_C.toString() + ')']
[NUMERATORS[0].toStringFactored(), NUMERATORS[1].toStringFactored()]
[DENOMINATORS[0].toStringFactored(), DENOM_STRINGS[1]]
[[FACTORS[0], FACTORS[1]], ORDER[0] ? [TERM_A, TERM_B] : [TERM_B, TERM_A]]
[[FACTOR1], ORDER[0] ? [TERM_B, TERM_C, TERM_A] : [TERM_A, TERM_B, TERM_C]]
TERM_A
[ORDER, ORDER[0] ? [0, 2] : [1, 0]]
FACTOR1 < 0 ? -FACTOR_PRODUCT.getGCD(FACTOR1) : FACTOR_PRODUCT.getGCD(FACTOR1)
FACTOR_PRODUCT.divide(COMMON_FACTOR)
TERM_C.multiply(FACTOR1 / COMMON_FACTOR)
CANCEL.terms[1].coefficient !== B ? -CANCEL.terms[1] : 0
(NUMERSOL.toString())/(DENOMSOL.toString())
(NUMERSOL.toStringFactored())/(DENOMSOL.toString())
(NUMERSOL.toString())/(DENOMSOL.toStringFactored())
(NUMERSOL.toStringFactored())/(DENOMSOL.toStringFactored())
NUMERSOL.toString()
NUMERSOL.toStringFactored()
Simplify the following expression and state the conditions under which the simplification is valid.
You can assume that X \neq 0
.
\qquad
\dfrac{NUMERATORS[ORDER[0]]}{DENOMINATORS[ORDER[0]]} \times
\dfrac{NUMERATORS[ORDER[1]]}{DENOMINATORS[ORDER[1]]}
\dfrac{NUMERATORS[ORDER[0]]}{DENOMINATORS[ORDER[0]]} \div
\dfrac{DENOMINATORS[ORDER[1]]}{NUMERATORS[ORDER[1]]}
Dividing by an expression is the same as multiplying by its inverse.
\qquad
\dfrac{NUMERATORS[ORDER[0]]}{DENOMINATORS[ORDER[0]]} \times
\dfrac{NUMERATORS[ORDER[1]]}{DENOMINATORS[ORDER[1]]}
First factor the quadratic.
\qquad
\dfrac{NUMER_STRINGS[ORDER[0]]}{DENOM_STRINGS[ORDER[0]]} \times
\dfrac{NUMER_STRINGS[ORDER[1]]}{DENOM_STRINGS[ORDER[1]]}
Then factor out any other terms.
\qquad
\dfrac{NUMER_STRINGS2[ORDER[0]]}{DENOM_STRINGS2[ORDER[0]]} \times
\dfrac{NUMER_STRINGS2[ORDER[1]]}{DENOM_STRINGS2[ORDER[1]]}
Then multiply the two numerators and multiply the two denominators.
\qquad \dfrac{
(NUMER_STRINGS2[ORDER[0]])
NUMER_STRINGS2[ORDER[0]] \times
(NUMER_STRINGS2[ORDER[1]])
NUMER_STRINGS2[ORDER[1]] } {
(DENOM_STRINGS2[ORDER[0]])
DENOM_STRINGS2[ORDER[0]] \times
(DENOM_STRINGS2[ORDER[1]])
DENOM_STRINGS2[ORDER[1]] }
\qquad \dfrac{
getProduct(NUMER_PRODUCT[0], NUMER_PRODUCT[1])}{
getProduct(DENOM_PRODUCT[0], DENOM_PRODUCT[1])}
Notice that
(CANCEL)
and (TERM_B)
appear
(TERM_B)
appears twice
in both the numerator and denominator so we can cancel them.
\qquad \dfrac{
getProduct(NUMER_PRODUCT[0], NUMER_PRODUCT[1], CANCEL_ORDER[0].slice(0, 1))}{
getProduct(DENOM_PRODUCT[0], DENOM_PRODUCT[1], CANCEL_ORDER[1].slice(0, 1))}
We are dividing by TERM_B
, so TERM_B \neq 0
.
Therefore, X \neq -B
.
\qquad \dfrac{
getProduct(NUMER_PRODUCT[0], NUMER_PRODUCT[1], CANCEL_ORDER[0])}{
getProduct(DENOM_PRODUCT[0], DENOM_PRODUCT[1], CANCEL_ORDER[1])}
We are dividing by CANCEL
, so CANCEL \neq 0
.
Therefore, X \neq -CANCEL.terms[1]
.
\qquad
\dfrac{NUMERSOL.multiply(COMMON_FACTOR).toStringFactored()}{DENOMSOL.multiply(COMMON_FACTOR).toStringFactored()}
\qquad
NUMERSOL.toStringFactored()
NUMERSOL.multiply(-1).toStringFactored()
\dfrac{NUMERSOL.toStringFactored()}{DENOMSOL.toStringFactored()}
; \space X \neq -B
; \space X \neq -CANCEL.terms[1]