randFromArray("abkmnpvx") randRangeNonZero(-1, 1) * randRange(1, randRange(1, 12)) randRangeNonZero(-1, 1) * randRange(1, randRange(1, 12)) randRangeNonZero(-1, 1) * randRange(1, randRange(1, 20)) randRangeNonZero(-1, 1) * randRange(1, randRange(1, 12)) "(?:" + (A < 0 ? "[-\\u2212]" : "") + abs(A) + (A === 1 ? "|" : "" ) + (A === -1 ? "|[-\\u2212]" : "") + ")\\s*" + X "(?:" + ((A + B) < 0 ? "[-\\u2212]" : "") + abs(A + B) + (A + B === 1 ? "|" : "" ) + (A + B === -1 ? "|[-\\u2212]" : "") + ")\\s*" + X (C < 0 ? "[-\\u2212]\\s*" : "") + abs(C) ((C + D) < 0 ? "[-\\u2212]\\s*" : "") + abs(C + D)
[TERM_AX_BX]

Simplify the following expression:

\large{expr(["+", ["*", A, X], ["*", B, X]])}

^\s*SOL\s*$
an expression, like -2x + 4

Combine the X terms:

\qquad\pink{expr(["*", A, X]) + expr(["*", B, X])}

\qquad\pink{expr(["*", A + B, X])}

The simplified expression is expr(["*", A + B, X])

[ TERM_AX_BX + (C > 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_C, TERM_C + ((A + B) > 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_AX_BX ]

\large{expr(["+", ["*", A, X], ["*", B, X], C])}

Combine the \pink{X} terms:

\qquad\pink{expr(["*", A, X])} + \pink{expr(["*", B, X])} + C

\qquad\pink{expr(["*", A + B, X])} + C

The simplified expression is expr(["*", A + B, X]) + C

\large{expr(["+", ["*", A, X], C, ["*", B, X]])}

Rewrite to group the \pink{X} terms together:

\qquad\pink{expr(["*", A, X]) + expr(["*", B, X])} + C

Combine the \pink{X} terms:

\qquad\pink{expr(["*", A + B, X])} + C

The simplified expression is expr(["*", A + B, X]) + C

[ TERM_AX_BX + ((C + D) > 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_C_D, TERM_C_D + ((A + B) > 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_AX_BX ]

\large{expr(["+", ["*", A, X], C, ["*", B, X], D])}

Rewrite the expression to group the \pink{X} terms and numeric terms:

\qquad\pink{expr(["*", A, X]) + expr(["*", B, X])} C < 0 ? "" : "+" \blue{C + D}

Combine the \pink{X} terms:

\qquad\pink{expr(["*", A + B, X])} C < 0 ? "" : "+" \blue{C + D}

Combine the numeric terms:

\qquad\pink{expr(["*", A + B, X])} (C + D) < 0 ? "" : "+" \blue{C + D}

The simplified expression is expr(["+", ["*", A + B, X], C + D])

\large{expr(["+", ["*", A, X], C, D, ["*", B, X]])}

[ TERM_AX + ((C + D) > 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_C_D, TERM_C_D + (A > 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_AX ]

\large{expr(["+", ["*", A, X], C, D])}

Combine the numeric terms:

\qquad expr(["*", A, X]) C < 0 ? "" : "+" \blue{C + D}

\qquad expr(["*", A, X]) (C + D) < 0 ? "" : "+" \blue{C + D}

The simplified expression is expr(["+", ["*", A, X], C + D])

\large{expr(["+", C, ["*", A, X], D])}

Rewrite the expression to group the numeric terms:

\qquad expr(["*", A, X]) C < 0 ? "" : "+" \blue{C + D}

Combine the numeric terms:

\qquad expr(["*", A, X]) (C + D) < 0 ? "" : "+" \blue{C + D}

The simplified expression is expr(["+", ["*", A, X], C + D])