randRange(3, 9) randRange(3, 12) * (rand(2) ? 1 : -1) randRange(3, 12) * (rand(2) ? 1 : -1)

What is expr(["*", ["^", BASE, EXP1], ["^", BASE, EXP2]])?

BASE EXP1 + EXP2

 expr(["*", ["^", BASE, EXP1], ["^", BASE, EXP2]]) = expr(["^", BASE, ["+", EXP1, EXP2]]) 

 \hphantom{expr(["*", ["^", BASE, EXP1], ["^", BASE, EXP2]])} = expr(["^", BASE, EXP1 + EXP2]) 

What is \displaystyle expr(["frac", ["^", BASE, EXP1], ["^", BASE, EXP2]])?

BASE EXP1 - EXP2

\displaystyle expr(["frac", ["^", BASE, EXP1], ["^", BASE, EXP2]]) = expr(["^", BASE, ["-", EXP1, EXP2]]) 

\displaystyle \hphantom{expr(["frac", ["^", BASE, EXP1], ["^", BASE, EXP2]])} = expr(["^", BASE, EXP1 - EXP2]) 

What is expr(["^", ["^", BASE, EXP1], EXP2])?

BASE EXP1 * EXP2

 expr(["^", ["^", BASE, EXP1], EXP2]) = expr(["^", BASE, ["*", EXP1, EXP2]]) 

 \hphantom{expr(["^", ["^", BASE, EXP1], EXP2])} = expr(["^", BASE, EXP1 * EXP2]) 

randRange(3, 9) randRange(3, 9) randRange(3, 12) * (rand(2) ? 1 : -1) randRange(3, 12) * (rand(2) ? 1 : -1) randRange(3, 12) * (rand(2) ? 1 : -1)

What is expr(["^", ["*", ["^", BASE1, EXP1], ["^", BASE2, EXP2]], EXP3])?

BASE1 EXP1 * EXP3 · BASE2 EXP2 * EXP3

 expr(["^", ["*", ["^", BASE1, EXP1], ["^", BASE2, EXP2]], EXP3]) = expr(["*", ["^", BASE1, ["*", EXP1, EXP3]], ["^", BASE2, ["*", EXP2, EXP3]]]) 

 \hphantom{expr(["^", ["*", ["^", BASE1, EXP1], ["^", BASE2, EXP2]], EXP3])} = expr(["^", BASE1, EXP1*EXP3]) \cdot expr(["^", BASE2, EXP2*EXP3])