operation construction

assert flattening construction works:

local expr = a + b + c simplifyAssertAllEq(expr, {a,b,c})
${3} = {3}$
${a} = {a}$
${a} = {a}$
${b} = {b}$
${b} = {b}$
${c} = {c}$
${c} = {c}$
GOOD
time: 0.657000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

local expr = a * b * c simplifyAssertAllEq(expr, {a,b,c})
${3} = {3}$
${a} = {a}$
${a} = {a}$
${b} = {b}$
${b} = {b}$
${c} = {c}$
${c} = {c}$
GOOD
time: 0.523000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

assert flattening after replace() works

local expr = (a + d):replace(d, b + c) simplifyAssertAllEq(expr, {a,b,c})
${3} = {3}$
${a} = {a}$
${a} = {a}$
${b} = {b}$
${b} = {b}$
${c} = {c}$
${c} = {c}$
GOOD
time: 0.466000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

local expr = (a * d):replace(d, b * c) simplifyAssertAllEq(expr, {a,b,c})
${3} = {3}$
${a} = {a}$
${a} = {a}$
${b} = {b}$
${b} = {b}$
${c} = {c}$
${c} = {c}$
GOOD
time: 0.585000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

assert flatten of add after mul works

local expr = (f * (a + d)):replace(d, b + c):flatten() print(Verbose(expr)) assertEq(#expr[2], 3)
*[f, +[a, b, c]] ${3} = {3}$
GOOD
time: 0.222000ms
stack: size: 0

    TODO just call all this simplify()

    constant simplificaiton
    multiply by 1
    simplifyAssertEq(1, (Constant(1)*Constant(1))())
    ${1} = {1}$
    GOOD
    time: 0.212000ms
    stack: size: 7
    • Init
    • Prune
    • Expand
    • Prune
    • Factor
    • Prune
    • Tidy
    divide by 1
    simplifyAssertEq(1, (Constant(1)/Constant(1))())
    ${1} = {1}$
    GOOD
    time: 0.161000ms
    stack: size: 7
    • Init
    • Prune
    • Expand
    • Prune
    • Factor
    • Prune
    • Tidy
    divide by -1
    simplifyAssertEq(-1, (-Constant(1)/Constant(1))())
    ${-1} = {-{1}}$
    GOOD
    time: 0.351000ms
    stack: size: 8
    • Init
    • Prune
    • Expand
    • Prune
    • Factor
    • Prune
    • Constant:Tidy:apply
    • Tidy
    multiply and divide by 1
    simplifyAssertEq(1, (Constant(1)/(Constant(1)*Constant(1)))())
    ${1} = {1}$
    GOOD
    time: 0.158000ms
    stack: size: 7
    • Init
    • Prune
    • Expand
    • Prune
    • Factor
    • Prune
    • Tidy

    commutativity
    add commutative
    simplifyAssertEq(x+y, y+x)
    ${{x} + {y}} = {{y} + {x}}$
    GOOD
    time: 1.938000ms
    stack: size: 8
    • Init
    • Prune
    • Expand
    • Prune
    • +:Factor:apply
    • Factor
    • Prune
    • Tidy
    mul commutative
    simplifyAssertEq(x*y, y*x)
    ${{{x}} {{y}}} = {{{y}} {{x}}}$
    GOOD
    time: 0.789000ms
    stack: size: 8
    • Init
    • Prune
    • Expand
    • Prune
    • Factor
    • Prune
    • *:Tidy:apply
    • Tidy

    pruning operations
    prune 1*
    simplifyAssertEq(x, (1*x)())
    ${x} = {x}$
    GOOD
    time: 0.055000ms
    stack: size: 7
    • Init
    • Prune
    • Expand
    • Prune
    • Factor
    • Prune
    • Tidy
    prune *1
    simplifyAssertEq(x, (x*1)())
    ${x} = {x}$
    GOOD
    time: 0.020000ms
    stack: size: 0
      prune *0
      simplifyAssertEq(0, (0*x)())
      ${0} = {0}$
      GOOD
      time: 0.280000ms
      stack: size: 7
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((x/x)(), 1)
      ${1} = {1}$
      GOOD
      time: 0.179000ms
      stack: size: 7
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy


      simplifyAssertEq(x^2, (x*x)())
      ${{x}^{2}} = {{x}^{2}}$
      GOOD
      time: 1.691000ms
      stack: size: 10
      • Init
      • Prune
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Tidy

      simplify(): div add mul

      simplifyAssertEq(((x+1)*y)(), (x*y + y)())
      ${{{y}} {{\left({{1} + {x}}\right)}}} = {{{y}} {{\left({{1} + {x}}\right)}}}$
      GOOD
      time: 2.400000ms
      stack: size: 24
      • Init
      • Prune
      • Expand
      • Prune
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • Factor
      • Prune
      • *:Expand:apply
      • Expand
      • *:Prune:apply
      • Prune
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • Factor
      • Prune
      • *:Tidy:apply
      • Tidy

      simplifyAssertEq(((x+1)*(y+1))(), (x*y + x + y + 1)())
      ${{1} + {x} + {y} + {{{x}} {{y}}}} = {{1} + {x} + {y} + {{{x}} {{y}}}}$
      GOOD
      time: 3.212000ms
      stack: size: 10
      • Init
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • *:Tidy:apply
      • Tidy

      simplifyAssertEq((2/(2*x*y))(), (1/(x*y))())
      ${\frac{1}{{{x}} {{y}}}} = {\frac{1}{{{x}} {{y}}}}$
      GOOD
      time: 3.125000ms
      stack: size: 9
      • Init
      • Prune
      • Expand
      • Prune
      • /:Factor:polydiv
      • Factor
      • Prune
      • *:Tidy:apply
      • Tidy

      simplifyAssertEq((1-(1-x))(), x)
      ${x} = {x}$
      GOOD
      time: 0.353000ms
      stack: size: 19
      • Init
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • Prune
      • *:Expand:apply
      • Expand
      • *:Prune:apply
      • *:Prune:apply
      • *:Prune:flatten
      • +:Prune:combineConstants
      • +:Prune:flatten
      • Prune
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq(((1-(1-x))/x)(), 1)
      ${1} = {1}$
      GOOD
      time: 1.199000ms
      stack: size: 7
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((1 + 1/x + 1/x)(), (1 + 2/x)())
      ${{\frac{1}{x}}{\left({{2} + {x}}\right)}} = {{\frac{1}{x}}{\left({{2} + {x}}\right)}}$
      GOOD
      time: 5.713000ms
      stack: size: 10
      • Init
      • +:Prune:combineConstants
      • +:Prune:factorOutDivs
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((1 + 1/x + 2/x)(), (1 + 3/x)())
      ${{\frac{1}{x}}{\left({{3} + {x}}\right)}} = {{\frac{1}{x}}{\left({{3} + {x}}\right)}}$
      GOOD
      time: 5.806000ms
      stack: size: 10
      • Init
      • +:Prune:combineConstants
      • +:Prune:factorOutDivs
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Tidy

      factoring integers

      simplifyAssertEq((Constant(2)/Constant(2))(), Constant(1))
      ${1} = {1}$
      GOOD
      time: 0.128000ms
      stack: size: 7
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((Constant(2)/Constant(4))(), (Constant(1)/Constant(2))())
      ${\frac{1}{2}} = {\frac{1}{2}}$
      GOOD
      time: 1.510000ms
      stack: size: 7
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy


      simplifyAssertEq(((2*x + 2*y)/2)(), (x+y)())
      ${{x} + {y}} = {{x} + {y}}$
      GOOD
      time: 2.589000ms
      stack: size: 8
      • Init
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq(((-2*x + 2*y)/2)(), (-x+y)())
      ${{-{x}} + {y}} = {{-{x}} + {y}}$
      GOOD
      time: 3.128000ms
      stack: size: 12
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy


      simplifyAssertEq(-1-x, -(1+x))
      ${{-1}{-{x}}} = {-{\left({{1} + {x}}\right)}}$
      GOOD
      time: 2.016000ms
      stack: size: 18
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • *:Expand:apply
      • Expand
      • *:Prune:apply
      • Prune
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy


      simplifyAssertEq((-x)/x, -1)
      ${{\frac{1}{x}}{\left({-{x}}\right)}} = {-1}$
      GOOD
      time: 0.682000ms
      stack: size: 8
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Constant:Tidy:apply
      • Tidy

      simplifyAssertEq((x/(-x)), -1)
      ${\frac{x}{-{x}}} = {-1}$
      GOOD
      time: 0.849000ms
      stack: size: 8
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Constant:Tidy:apply
      • Tidy

      simplifyAssertEq((-x-1)/(x+1), -1)
      ${\frac{{-{x}}{-{1}}}{{x} + {1}}} = {-1}$
      GOOD
      time: 2.075000ms
      stack: size: 8
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Constant:Tidy:apply
      • Tidy

      simplifyAssertEq((x-1)/(1-x), -1)
      ${\frac{{x}{-{1}}}{{1}{-{x}}}} = {-1}$
      GOOD
      time: 2.363000ms
      stack: size: 8
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Constant:Tidy:apply
      • Tidy


      simplifyAssertEq( (x*y)/(x*y)^2, 1/(x*y) )
      ${\frac{{{x}} {{y}}}{{\left({{{x}} {{y}}}\right)}^{2}}} = {\frac{1}{{{x}} {{y}}}}$
      GOOD
      time: 2.085000ms
      stack: size: 9
      • Init
      • Prune
      • Expand
      • Prune
      • /:Factor:polydiv
      • Factor
      • Prune
      • *:Tidy:apply
      • Tidy

      origin of the error:

      simplifyAssertEq( 1/(1-x), -1/(x-1) )
      ${\frac{1}{{1}{-{x}}}} = {\frac{-1}{{x}{-{1}}}}$
      GOOD
      time: 2.794000ms
      stack: size: 26
      • Init
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • *:Prune:apply
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • /:Prune:negOverNeg
      • Prune
      • *:Expand:apply
      • Expand
      • *:Prune:apply
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy
      without needing to factor the polynomial

      simplifyAssertEq(((x-1)*(x+1))/(x+1), x-1)
      ${\frac{{{\left({{x}{-{1}}}\right)}} {{\left({{x} + {1}}\right)}}}{{x} + {1}}} = {{x}{-{1}}}$
      GOOD
      time: 1.504000ms
      stack: size: 11
      • Init
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Constant:Tidy:apply
      • Tidy

      simplifyAssertEq(((x-1)*(x+1))/(x-1), x+1)
      ${\frac{{{\left({{x}{-{1}}}\right)}} {{\left({{x} + {1}}\right)}}}{{x}{-{1}}}} = {{x} + {1}}$
      GOOD
      time: 1.458000ms
      stack: size: 9
      • Init
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((x-1)/((x+1)*(x-1)), 1/(x+1))
      ${\frac{{x}{-{1}}}{{{\left({{x} + {1}}\right)}} {{\left({{x}{-{1}}}\right)}}}} = {\frac{1}{{x} + {1}}}$
      GOOD
      time: 1.635000ms
      stack: size: 10
      • Init
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((x+1)/((x+1)*(x-1)), 1/(x-1))
      ${\frac{{x} + {1}}{{{\left({{x} + {1}}\right)}} {{\left({{x}{-{1}}}\right)}}}} = {\frac{1}{{x}{-{1}}}}$
      GOOD
      time: 1.745000ms
      stack: size: 12
      • Init
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Constant:Tidy:apply
      • Tidy
      with needing to factor the polynomial

      simplifyAssertEq((x^2-1)/(x+1), x-1)
      ${\frac{{{x}^{2}}{-{1}}}{{x} + {1}}} = {{x}{-{1}}}$
      GOOD
      time: 4.910000ms
      stack: size: 11
      • Init
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Constant:Tidy:apply
      • Tidy

      simplifyAssertEq((x^2-1)/(x-1), x+1)
      ${\frac{{{x}^{2}}{-{1}}}{{x}{-{1}}}} = {{x} + {1}}$
      GOOD
      time: 4.917000ms
      stack: size: 9
      • Init
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((x-1)/(x^2-1), 1/(x+1))
      ${\frac{{x}{-{1}}}{{{x}^{2}}{-{1}}}} = {\frac{1}{{x} + {1}}}$
      GOOD
      time: 9.222000ms
      stack: size: 10
      • Init
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((x+1)/(x^2-1), 1/(x-1))
      ${\frac{{x} + {1}}{{{x}^{2}}{-{1}}}} = {\frac{1}{{x}{-{1}}}}$
      GOOD
      time: 5.377000ms
      stack: size: 12
      • Init
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Constant:Tidy:apply
      • Tidy
      ... and with signs flipped

      simplifyAssertEq((1-x^2)/(x+1), -(x-1))
      ${\frac{{1}{-{{x}^{2}}}}{{x} + {1}}} = {-{\left({{x}{-{1}}}\right)}}$
      GOOD
      time: 3.887000ms
      stack: size: 21
      • Init
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • Prune
      • *:Expand:apply
      • Expand
      • *:Prune:apply
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy

      simplifyAssertEq((1-x^2)/(x-1), -(x+1))
      ${\frac{{1}{-{{x}^{2}}}}{{x}{-{1}}}} = {-{\left({{x} + {1}}\right)}}$
      GOOD
      time: 3.350000ms
      stack: size: 19
      • Init
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • Prune
      • *:Expand:apply
      • Expand
      • *:Prune:apply
      • Prune
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy

      simplifyAssertEq((x-1)/(1-x^2), -1/(x+1))
      ${\frac{{x}{-{1}}}{{1}{-{{x}^{2}}}}} = {\frac{-1}{{x} + {1}}}$
      GOOD
      time: 3.388000ms
      stack: size: 15
      • Init
      • +:Prune:combineConstants
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • /:Prune:xOverMinusOne
      • *:Prune:apply
      • *:Prune:flatten
      • Prune
      • Constant:Tidy:apply
      • /:Tidy:apply
      • Tidy

      simplifyAssertEq((x+1)/(1-x^2), -1/(x-1))
      ${\frac{{x} + {1}}{{1}{-{{x}^{2}}}}} = {\frac{-1}{{x}{-{1}}}}$
      GOOD
      time: 4.662000ms
      stack: size: 26
      • Init
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • *:Prune:apply
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • /:Prune:negOverNeg
      • Prune
      • *:Expand:apply
      • Expand
      • *:Prune:apply
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy

      make sure sorting of expression terms works

      simplifyAssertEq(y-a, -a+y)
      ${{y}{-{a}}} = {{-{a}} + {y}}$
      GOOD
      time: 0.925000ms
      stack: size: 12
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy

      simplifyAssertEq( (y-a)/(b-a) , y/(b-a) - a/(b-a) )
      ${\frac{{y}{-{a}}}{{b}{-{a}}}} = {{\frac{y}{{b}{-{a}}}}{-{\frac{a}{{b}{-{a}}}}}}$
      GOOD
      time: 14.513000ms
      stack: size: 90
      • Init
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • *:Prune:factorDenominators
      • unm:Prune:doubleNegative
      • *:Prune:flatten
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • ^:Prune:xToTheZero
      • /:Prune:divToPowSub
      • *:Prune:factorDenominators
      • +:Prune:factorOutDivs
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • /:Prune:negOverNeg
      • *:Prune:flatten
      • unm:Prune:doubleNegative
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • unm:Prune:doubleNegative
      • *:Prune:apply
      • unm:Prune:doubleNegative
      • /:Prune:negOverNeg
      • *:Prune:factorDenominators
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • ^:Prune:xToTheOne
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • /:Prune:negOverNeg
      • /:Prune:divToPowSub
      • /:Prune:qIsDiv
      • Prune
      • *:Expand:apply
      • *:Expand:apply
      • Expand
      • *:Prune:apply
      • *:Prune:flatten
      • *:Prune:apply
      • *:Prune:flatten
      • Prune
      • +:Factor:apply
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • ^:Prune:xToTheZero
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • unm:Prune:doubleNegative
      • *:Prune:apply
      • /:Prune:divToPowSub
      • *:Prune:factorDenominators
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • ^:Prune:xToTheZero
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • unm:Prune:doubleNegative
      • *:Prune:apply
      • /:Prune:divToPowSub
      • *:Prune:factorDenominators
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy

      just printing this, i was getting simplification loops
      print((a^2 * x^2 - a^2)())
      ${-{{a}^{2}}} + {{{{a}^{2}}} {{{x}^{2}}}}$ GOOD time: 4.532000ms
      stack: size: 69
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • *:Factor:combineMulOfLikePow
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • +:Factor:apply
      • Factor
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • *:Prune:flatten
      • *:Prune:flatten
      • Prune
      • ^:Expand:integerPower
      • *:Expand:apply
      • *:Expand:apply
      • *:Expand:apply
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • *:Prune:apply
      • +:Prune:combineConstants
      • +:Prune:flattenAddMul
      • +:Prune:flatten
      • Prune
      • *:Factor:combineMulOfLikePow
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      this won't simplify correctly unless you negative , simplify, negative again ...
      simplifyAssertEq( (t - r) / (-r^2 - t^2 + 2 * r * t), -1 / (t - r))
      ${\frac{{t}{-{r}}}{{-{{r}^{2}}}{-{{t}^{2}}} + {{{2}} {{r}} {{t}}}}} = {\frac{-1}{{t}{-{r}}}}$
      GOOD
      time: 9.673000ms
      stack: size: 42
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • unm:Prune:doubleNegative
      • *:Prune:apply
      • unm:Prune:doubleNegative
      • /:Prune:negOverNeg
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • unm:Prune:doubleNegative
      • *:Prune:apply
      • *:Prune:flatten
      • *:Prune:apply
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • /:Prune:negOverNeg
      • Prune
      • *:Expand:apply
      • Expand
      • *:Prune:apply
      • *:Prune:flatten
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy


      simplifyAssertEq( (-128 + 64*sqrt(5))/(64*sqrt(5)), -2 / sqrt(5) + 1 )
      ${\frac{{-128} + {{{64}} {{\sqrt{5}}}}}{{{64}} {{\sqrt{5}}}}} = {{\frac{-2}{\sqrt{5}}} + {1}}$
      GOOD
      time: 41.732000ms
      stack: size: 16
      • Init
      • ^:Prune:sqrtFix4
      • sqrt:Prune:apply
      • ^:Prune:sqrtFix4
      • ^:Prune:sqrtFix4
      • +:Prune:combineConstants
      • +:Prune:factorOutDivs
      • +:Prune:combineConstants
      • Prune
      • Expand
      • ^:Prune:sqrtFix4
      • ^:Prune:sqrtFix4
      • Prune
      • Factor
      • Prune
      • Tidy

      expand(): add div mul

      factor(): mul add div

      trigonometry


      simplifyAssertEq((sin(x)^2+cos(x)^2)(), 1)
      ${1} = {1}$
      GOOD
      time: 0.994000ms
      stack: size: 7
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((y*sin(x)^2+y*cos(x)^2)(), y)
      ${y} = {y}$
      GOOD
      time: 1.700000ms
      stack: size: 17
      • Init
      • Prune
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((y+y*sin(x)^2+y*cos(x)^2)(), 2*y)
      ${{{2}} {{y}}} = {{{2}} {{y}}}$
      GOOD
      time: 2.191000ms
      stack: size: 8
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • *:Tidy:apply
      • Tidy

      simplifyAssertEq((1+y*sin(x)^2+y*cos(x)^2)(), 1+y)
      ${{1} + {y}} = {{1} + {y}}$
      GOOD
      time: 1.483000ms
      stack: size: 8
      • Init
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • Factor
      • Prune
      • Tidy


      simplifyAssertEq(1+cos(x)^2+cos(x)^2, 1+2*cos(x)^2)
      ${{1} + {{\cos\left( x\right)}^{2}} + {{\cos\left( x\right)}^{2}}} = {{1} + {{{2}} {{{\cos\left( x\right)}^{2}}}}}$
      GOOD
      time: 3.246000ms
      stack: size: 10
      • Init
      • Prune
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq(-1+cos(x)^2+cos(x)^2, -1+2*cos(x)^2)
      ${{-1} + {{\cos\left( x\right)}^{2}} + {{\cos\left( x\right)}^{2}}} = {{-1} + {{{2}} {{{\cos\left( x\right)}^{2}}}}}$
      GOOD
      time: 4.166000ms
      stack: size: 10
      • Init
      • Prune
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Tidy


      simplifyAssertEq( cos(x)^2 + sin(x)^2, 1)
      ${{{\cos\left( x\right)}^{2}} + {{\sin\left( x\right)}^{2}}} = {1}$
      GOOD
      time: 0.854000ms
      stack: size: 7
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq( (cos(x)*y)^2 + (sin(x)*y)^2, y^2)
      ${{{\left({{{\cos\left( x\right)}} {{y}}}\right)}^{2}} + {{\left({{{\sin\left( x\right)}} {{y}}}\right)}^{2}}} = {{y}^{2}}$
      GOOD
      time: 1.861000ms
      stack: size: 10
      • Init
      • Prune
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Tidy


      simplifyLHSAssertEq( (sin(x)^2)(), sin(x)^2)
      ${{\sin\left( x\right)}^{2}} = {{\sin\left( x\right)}^{2}}$
      GOOD
      time: 1.898000ms
      stack: size: 18
      • Init
      • Prune
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • ^:Expand:integerPower
      • unm:Expand:apply
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy


      simplifyLHSAssertEq( (cos(b)^2 - 1)(), -sin(b)^2)
      ${-{{\sin\left( b\right)}^{2}}} = {-{{\sin\left( b\right)}^{2}}}$
      GOOD
      time: 1.224000ms
      stack: size: 12
      • Init
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • Prune
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyLHSAssertEq( (1 - cos(b)^2)(), sin(b)^2)
      ${{\sin\left( b\right)}^{2}} = {{\sin\left( b\right)}^{2}}$
      GOOD
      time: 0.975000ms
      stack: size: 11
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Tidy


      simplifyLHSAssertEq( (a * cos(b)^2 - a)(), -(a * sin(b)^2))
      ${-{{{a}} {{{\sin\left( b\right)}^{2}}}}} = {-{{{a}} {{{\sin\left( b\right)}^{2}}}}}$
      GOOD
      time: 3.030000ms
      stack: size: 15
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyLHSAssertEq( (a - a * cos(b)^2)(), a * sin(b)^2)
      ${{{a}} {{{\sin\left( b\right)}^{2}}}} = {{{a}} {{{\sin\left( b\right)}^{2}}}}$
      GOOD
      time: 3.136000ms
      stack: size: 15
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      the only one that doesn't work
      simplifyLHSAssertEq( (a^2 * cos(b)^2 - a^2)(), -(a^2 * sin(b)^2))
      ${{-{{a}^{2}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}} = {-{{{{a}^{2}}} {{{\sin\left( b\right)}^{2}}}}}$
      expected ${-{{a}^{2}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$ to equal $-{{{{a}^{2}}} {{{\sin\left( b\right)}^{2}}}}$
      found ${-{{a}^{2}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$ vs $-{{{{a}^{2}}} {{{\sin\left( b\right)}^{2}}}}$
      lhs stack
      Init ${{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}{-{{a}^{2}}}$
      	+[*[^[a, 2], ^[cos[b], 2]], unm(^[a, 2])]	

      unm:Prune:doubleNegative ${{-1}} {{{a}^{2}}}$
      	*[-1, ^[a, 2]]	

      Prune ${{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}} + {{{-1}} {{{a}^{2}}}}$
      	+[*[^[a, 2], ^[cos[b], 2]], *[-1, ^[a, 2]]]	

      ^:Expand:integerPower ${{a}} {{a}}$
      	*[a, a]	

      ^:Expand:integerPower ${{\cos\left( b\right)}} {{\cos\left( b\right)}}$
      	*[cos[b], cos[b]]	

      ^:Expand:integerPower ${{a}} {{a}}$
      	*[a, a]	

      Expand ${{{{{a}} {{a}}}} {{{{\cos\left( b\right)}} {{\cos\left( b\right)}}}}} + {{{-1}} {{{{a}} {{a}}}}}$
      	+[*[*[a, a], *[cos[b], cos[b]]], *[-1, *[a, a]]]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${\cos\left( b\right)}^{2}$
      	^[cos[b], 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      Prune ${{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}} + {{{-1}} {{{a}^{2}}}}$
      	+[*[^[a, 2], ^[cos[b], 2]], *[-1, ^[a, 2]]]	

      *:Factor:combineMulOfLikePow ${\left({{{a}} {{\cos\left( b\right)}}}\right)}^{2}$
      	^[*[a, cos[b]], 2]	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne ${{a}} {{\cos\left( b\right)}}$
      	*[a, cos[b]]	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne $a$
      	a	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne ${{a}} {{\cos\left( b\right)}}$
      	*[a, cos[b]]	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne $a$
      	a	

      unm:Prune:doubleNegative ${{-1}} {{a}}$
      	*[-1, a]	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      +:Factor:apply ${{a}} {{\left({{-1} + {\cos\left( b\right)}}\right)}}$
      	*[a, +[-1, cos[b]]]	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      +:Factor:apply ${{a}} {{\left({{1} + {\cos\left( b\right)}}\right)}}$
      	*[a, +[1, cos[b]]]	

      +:Factor:apply ${{{{a}} {{\left({{-1} + {\cos\left( b\right)}}\right)}}}} {{{{a}} {{\left({{1} + {\cos\left( b\right)}}\right)}}}}$
      	*[*[a, +[-1, cos[b]]], *[a, +[1, cos[b]]]]	

      Factor ${{{{a}} {{\left({{-1} + {\cos\left( b\right)}}\right)}}}} {{{{a}} {{\left({{1} + {\cos\left( b\right)}}\right)}}}}$
      	*[*[a, +[-1, cos[b]]], *[a, +[1, cos[b]]]]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{-1} + {\cos\left( b\right)}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[-1, cos[b]]]	

      *:Prune:flatten ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{-1} + {\cos\left( b\right)}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[-1, cos[b]]]	

      *:Prune:flatten ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{-1} + {\cos\left( b\right)}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[-1, cos[b]]]	

      Prune ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{-1} + {\cos\left( b\right)}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[-1, cos[b]]]	

      ^:Expand:integerPower ${{a}} {{a}}$
      	*[a, a]	

      *:Expand:apply ${{{{{a}} {{a}}}} {{1}} \cdot {{-1}}} + {{{{{a}} {{a}}}} {{1}} {{\cos\left( b\right)}}}$
      	+[*[*[a, a], 1, -1], *[*[a, a], 1, cos[b]]]	

      *:Expand:apply ${{{{{a}} {{a}}}} {{\cos\left( b\right)}} \cdot {{-1}}} + {{{{{a}} {{a}}}} {{\cos\left( b\right)}} {{\cos\left( b\right)}}}$
      	+[*[*[a, a], cos[b], -1], *[*[a, a], cos[b], cos[b]]]	

      *:Expand:apply ${{{{{{a}} {{a}}}} {{1}} \cdot {{-1}}} + {{{{{a}} {{a}}}} {{1}} {{\cos\left( b\right)}}}} + {{{{{{a}} {{a}}}} {{\cos\left( b\right)}} \cdot {{-1}}} + {{{{{a}} {{a}}}} {{\cos\left( b\right)}} {{\cos\left( b\right)}}}}$
      	+[+[*[*[a, a], 1, -1], *[*[a, a], 1, cos[b]]], +[*[*[a, a], cos[b], -1], *[*[a, a], cos[b], cos[b]]]]	

      Expand ${{{{{{a}} {{a}}}} {{1}} \cdot {{-1}}} + {{{{{a}} {{a}}}} {{1}} {{\cos\left( b\right)}}}} + {{{{{{a}} {{a}}}} {{\cos\left( b\right)}} \cdot {{-1}}} + {{{{{a}} {{a}}}} {{\cos\left( b\right)}} {{\cos\left( b\right)}}}}$
      	+[+[*[*[a, a], 1, -1], *[*[a, a], 1, cos[b]]], +[*[*[a, a], cos[b], -1], *[*[a, a], cos[b], cos[b]]]]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}$
      	*[^[a, 2], ^[cos[b], 2]]	

      *:Prune:apply $0$
      	0	

      +:Prune:combineConstants ${{{-1}} {{{a}^{2}}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[*[-1, ^[a, 2]], *[^[a, 2], ^[cos[b], 2]]]	

      +:Prune:flattenAddMul ${{{-1}} {{{a}^{2}}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[*[-1, ^[a, 2]], *[^[a, 2], ^[cos[b], 2]]]	

      +:Prune:flatten ${{{-1}} {{{a}^{2}}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[*[-1, ^[a, 2]], *[^[a, 2], ^[cos[b], 2]]]	

      Prune ${{{-1}} {{{a}^{2}}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[*[-1, ^[a, 2]], *[^[a, 2], ^[cos[b], 2]]]	

      *:Factor:combineMulOfLikePow ${\left({{{a}} {{\cos\left( b\right)}}}\right)}^{2}$
      	^[*[a, cos[b]], 2]	

      Factor ${{{-1}} {{{a}^{2}}}} + {{\left({{{a}} {{\cos\left( b\right)}}}\right)}^{2}}$
      	+[*[-1, ^[a, 2]], ^[*[a, cos[b]], 2]]	

      Prune ${{{-1}} {{{a}^{2}}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[*[-1, ^[a, 2]], *[^[a, 2], ^[cos[b], 2]]]	

      Expand ${{{-1}} {{{{a}} {{a}}}}} + {{{{{a}} {{a}}}} {{{{\cos\left( b\right)}} {{\cos\left( b\right)}}}}}$
      	+[*[-1, *[a, a]], *[*[a, a], *[cos[b], cos[b]]]]	

      Prune ${{{-1}} {{{a}^{2}}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[*[-1, ^[a, 2]], *[^[a, 2], ^[cos[b], 2]]]	

      Factor ${{{-1}} {{{a}^{2}}}} + {{\left({{{a}} {{\cos\left( b\right)}}}\right)}^{2}}$
      	+[*[-1, ^[a, 2]], ^[*[a, cos[b]], 2]]	

      Prune ${{{-1}} {{{a}^{2}}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[*[-1, ^[a, 2]], *[^[a, 2], ^[cos[b], 2]]]	

      Tidy ${-{{a}^{2}}} + {{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[unm(^[a, 2]), *[^[a, 2], ^[cos[b], 2]]]	

      BAD
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:141: failed
      stack traceback:
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:246: in function
      [C]: in function 'error'
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:141: in function 'simplifyLHSAssertEq'
      [string "simplifyLHSAssertEq( (a^2 * cos(b)^2 - a^2)()..."]:1: in main chunk
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:238: in function
      [C]: in function 'xpcall'
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:237: in function 'exec'
      test.lua:182: in function 'cb'
      /home/chris/Projects/lua/ext/timer.lua:58: in function 'timer'
      test.lua:8: in main chunk
      [C]: at 0x650dbbc7a380
      time: 13.929000ms
      stack: size: 69
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • *:Factor:combineMulOfLikePow
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • +:Factor:apply
      • Factor
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • *:Prune:flatten
      • *:Prune:flatten
      • Prune
      • ^:Expand:integerPower
      • *:Expand:apply
      • *:Expand:apply
      • *:Expand:apply
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • *:Prune:apply
      • +:Prune:combineConstants
      • +:Prune:flattenAddMul
      • +:Prune:flatten
      • Prune
      • *:Factor:combineMulOfLikePow
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy
      also the only one that doesn't work
      simplifyLHSAssertEq( (a^2 - a^2 * cos(b)^2)(), a^2 * sin(b)^2)
      ${{{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1}{-{\cos\left( b\right)}}}\right)}}} = {{{{a}^{2}}} {{{\sin\left( b\right)}^{2}}}}$
      expected ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1}{-{\cos\left( b\right)}}}\right)}}$ to equal ${{{a}^{2}}} {{{\sin\left( b\right)}^{2}}}$
      found ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1}{-{\cos\left( b\right)}}}\right)}}$ vs ${{{a}^{2}}} {{{\sin\left( b\right)}^{2}}}$
      lhs stack
      Init ${{a}^{2}}{-{{{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}}$
      	+[^[a, 2], unm(*[^[a, 2], ^[cos[b], 2]])]	

      unm:Prune:doubleNegative ${{-1}} {{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}$
      	*[-1, ^[a, 2], ^[cos[b], 2]]	

      Prune ${{a}^{2}} + {{{-1}} {{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[^[a, 2], *[-1, ^[a, 2], ^[cos[b], 2]]]	

      ^:Expand:integerPower ${{a}} {{a}}$
      	*[a, a]	

      ^:Expand:integerPower ${{a}} {{a}}$
      	*[a, a]	

      ^:Expand:integerPower ${{\cos\left( b\right)}} {{\cos\left( b\right)}}$
      	*[cos[b], cos[b]]	

      Expand ${{{a}} {{a}}} + {{{-1}} {{{{a}} {{a}}}} {{{{\cos\left( b\right)}} {{\cos\left( b\right)}}}}}$
      	+[*[a, a], *[-1, *[a, a], *[cos[b], cos[b]]]]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${\cos\left( b\right)}^{2}$
      	^[cos[b], 2]	

      Prune ${{a}^{2}} + {{{-1}} {{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[^[a, 2], *[-1, ^[a, 2], ^[cos[b], 2]]]	

      *:Factor:combineMulOfLikePow ${{-1}} {{{\left({{{a}} {{\cos\left( b\right)}}}\right)}^{2}}}$
      	*[-1, ^[*[a, cos[b]], 2]]	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne $a$
      	a	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne ${{a}} {{\cos\left( b\right)}}$
      	*[a, cos[b]]	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne $a$
      	a	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne ${{a}} {{\cos\left( b\right)}}$
      	*[a, cos[b]]	

      unm:Prune:doubleNegative ${{-1}} {{a}} {{\cos\left( b\right)}}$
      	*[-1, a, cos[b]]	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      +:Factor:apply ${{a}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[a, +[1, *[-1, cos[b]]]]	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      +:Factor:apply ${{a}} {{\left({{1} + {\cos\left( b\right)}}\right)}}$
      	*[a, +[1, cos[b]]]	

      +:Factor:apply ${{{{a}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}}} {{{{a}} {{\left({{1} + {\cos\left( b\right)}}\right)}}}}$
      	*[*[a, +[1, *[-1, cos[b]]]], *[a, +[1, cos[b]]]]	

      Factor ${{{{a}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}}} {{{{a}} {{\left({{1} + {\cos\left( b\right)}}\right)}}}}$
      	*[*[a, +[1, *[-1, cos[b]]]], *[a, +[1, cos[b]]]]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, *[-1, cos[b]]]]	

      *:Prune:flatten ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, *[-1, cos[b]]]]	

      *:Prune:flatten ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, *[-1, cos[b]]]]	

      Prune ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, *[-1, cos[b]]]]	

      ^:Expand:integerPower ${{a}} {{a}}$
      	*[a, a]	

      *:Expand:apply ${{{{{a}} {{a}}}} {{1}} \cdot {{1}}} + {{{{{a}} {{a}}}} {{1}} {{{{-1}} {{\cos\left( b\right)}}}}}$
      	+[*[*[a, a], 1, 1], *[*[a, a], 1, *[-1, cos[b]]]]	

      *:Expand:apply ${{{{{a}} {{a}}}} {{\cos\left( b\right)}} {{1}}} + {{{{{a}} {{a}}}} {{\cos\left( b\right)}} {{{{-1}} {{\cos\left( b\right)}}}}}$
      	+[*[*[a, a], cos[b], 1], *[*[a, a], cos[b], *[-1, cos[b]]]]	

      *:Expand:apply ${{{{{{a}} {{a}}}} {{1}} \cdot {{1}}} + {{{{{a}} {{a}}}} {{1}} {{{{-1}} {{\cos\left( b\right)}}}}}} + {{{{{{a}} {{a}}}} {{\cos\left( b\right)}} {{1}}} + {{{{{a}} {{a}}}} {{\cos\left( b\right)}} {{{{-1}} {{\cos\left( b\right)}}}}}}$
      	+[+[*[*[a, a], 1, 1], *[*[a, a], 1, *[-1, cos[b]]]], +[*[*[a, a], cos[b], 1], *[*[a, a], cos[b], *[-1, cos[b]]]]]	

      Expand ${{{{{{a}} {{a}}}} {{1}} \cdot {{1}}} + {{{{{a}} {{a}}}} {{1}} {{{{-1}} {{\cos\left( b\right)}}}}}} + {{{{{{a}} {{a}}}} {{\cos\left( b\right)}} {{1}}} + {{{{{a}} {{a}}}} {{\cos\left( b\right)}} {{{{-1}} {{\cos\left( b\right)}}}}}}$
      	+[+[*[*[a, a], 1, 1], *[*[a, a], 1, *[-1, cos[b]]]], +[*[*[a, a], cos[b], 1], *[*[a, a], cos[b], *[-1, cos[b]]]]]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      *:Prune:apply ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      *:Prune:flatten ${{-1}} {{{a}^{2}}} {{\cos\left( b\right)}}$
      	*[-1, ^[a, 2], cos[b]]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${a}^{2}$
      	^[a, 2]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${{-1}} {{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}$
      	*[-1, ^[a, 2], ^[cos[b], 2]]	

      *:Prune:flatten ${{-1}} {{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}$
      	*[-1, ^[a, 2], ^[cos[b], 2]]	

      *:Prune:apply $0$
      	0	

      +:Prune:combineConstants ${{a}^{2}} + {{{-1}} {{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[^[a, 2], *[-1, ^[a, 2], ^[cos[b], 2]]]	

      +:Prune:flattenAddMul ${{a}^{2}} + {{{-1}} {{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[^[a, 2], *[-1, ^[a, 2], ^[cos[b], 2]]]	

      +:Prune:flatten ${{a}^{2}} + {{{-1}} {{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[^[a, 2], *[-1, ^[a, 2], ^[cos[b], 2]]]	

      Prune ${{a}^{2}} + {{{-1}} {{{a}^{2}}} {{{\cos\left( b\right)}^{2}}}}$
      	+[^[a, 2], *[-1, ^[a, 2], ^[cos[b], 2]]]	

      *:Factor:combineMulOfLikePow ${{-1}} {{{\left({{{a}} {{\cos\left( b\right)}}}\right)}^{2}}}$
      	*[-1, ^[*[a, cos[b]], 2]]	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne $a$
      	a	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne ${{a}} {{\cos\left( b\right)}}$
      	*[a, cos[b]]	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne $a$
      	a	

      /:Prune:xOverX $1$
      	1	

      ^:Prune:xToTheOne ${{a}} {{\cos\left( b\right)}}$
      	*[a, cos[b]]	

      unm:Prune:doubleNegative ${{-1}} {{a}} {{\cos\left( b\right)}}$
      	*[-1, a, cos[b]]	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      +:Factor:apply ${{a}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[a, +[1, *[-1, cos[b]]]]	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      unm:Prune:doubleNegative $-1$
      	-1	

      +:Prune:combineConstants $0$
      	0	

      +:Factor:apply ${{a}} {{\left({{1} + {\cos\left( b\right)}}\right)}}$
      	*[a, +[1, cos[b]]]	

      +:Factor:apply ${{{{a}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}}} {{{{a}} {{\left({{1} + {\cos\left( b\right)}}\right)}}}}$
      	*[*[a, +[1, *[-1, cos[b]]]], *[a, +[1, cos[b]]]]	

      Factor ${{{{a}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}}} {{{{a}} {{\left({{1} + {\cos\left( b\right)}}\right)}}}}$
      	*[*[a, +[1, *[-1, cos[b]]]], *[a, +[1, cos[b]]]]	

      +:Prune:combineConstants $2$
      	2	

      *:Prune:combinePows ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, *[-1, cos[b]]]]	

      *:Prune:flatten ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, *[-1, cos[b]]]]	

      *:Prune:flatten ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, *[-1, cos[b]]]]	

      Prune ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1} + {{{-1}} {{\cos\left( b\right)}}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, *[-1, cos[b]]]]	

      Constant:Tidy:apply $-{1}$
      	unm(1)	

      *:Tidy:apply $\cos\left( b\right)$
      	cos[b]	

      *:Tidy:apply $-{\cos\left( b\right)}$
      	unm(cos[b])	

      *:Tidy:apply ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1}{-{\cos\left( b\right)}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, unm(cos[b])]]	

      Tidy ${{{a}^{2}}} {{\left({{1} + {\cos\left( b\right)}}\right)}} {{\left({{1}{-{\cos\left( b\right)}}}\right)}}$
      	*[^[a, 2], +[1, cos[b]], +[1, unm(cos[b])]]	

      BAD
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:141: failed
      stack traceback:
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:246: in function
      [C]: in function 'error'
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:141: in function 'simplifyLHSAssertEq'
      [string "simplifyLHSAssertEq( (a^2 - a^2 * cos(b)^2)()..."]:1: in main chunk
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:238: in function
      [C]: in function 'xpcall'
      /home/chris/Projects/lua/symmath/tests/unit/unit.lua:237: in function 'exec'
      test.lua:182: in function 'cb'
      /home/chris/Projects/lua/ext/timer.lua:58: in function 'timer'
      test.lua:8: in main chunk
      [C]: at 0x650dbbc7a380
      time: 7.257000ms
      stack: size: 96
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • *:Factor:combineMulOfLikePow
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • +:Factor:apply
      • Factor
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • *:Prune:flatten
      • *:Prune:flatten
      • Prune
      • ^:Expand:integerPower
      • *:Expand:apply
      • *:Expand:apply
      • *:Expand:apply
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • *:Prune:apply
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • *:Prune:flatten
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • *:Prune:flatten
      • *:Prune:apply
      • +:Prune:combineConstants
      • +:Prune:flattenAddMul
      • +:Prune:flatten
      • Prune
      • *:Factor:combineMulOfLikePow
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • /:Prune:xOverX
      • ^:Prune:xToTheOne
      • unm:Prune:doubleNegative
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • unm:Prune:doubleNegative
      • +:Prune:combineConstants
      • +:Factor:apply
      • +:Factor:apply
      • Factor
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • *:Prune:flatten
      • *:Prune:flatten
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy


      simplifyLHSAssertEq( (a^3 * cos(b)^2 - a^3)(), -(a^3 * sin(b)^2))
      ${-{{{{a}^{3}}} {{{\sin\left( b\right)}^{2}}}}} = {-{{{{a}^{3}}} {{{\sin\left( b\right)}^{2}}}}}$
      GOOD
      time: 6.041000ms
      stack: size: 21
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyLHSAssertEq( (a^3 - a^3 * cos(b)^2)(), a^3 * sin(b)^2)
      ${{{{a}^{3}}} {{{\sin\left( b\right)}^{2}}}} = {{{{a}^{3}}} {{{\sin\left( b\right)}^{2}}}}$
      GOOD
      time: 3.904000ms
      stack: size: 21
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy


      simplifyLHSAssertEq( (a^4 * cos(b)^2 - a^4)(), -(a^4 * sin(b)^2))
      ${-{{{{a}^{4}}} {{{\sin\left( b\right)}^{2}}}}} = {-{{{{a}^{4}}} {{{\sin\left( b\right)}^{2}}}}}$
      GOOD
      time: 4.453000ms
      stack: size: 21
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy

      simplifyLHSAssertEq( (a^4 - a^4 * cos(b)^2)(), a^4 * sin(b)^2)
      ${{{{a}^{4}}} {{{\sin\left( b\right)}^{2}}}} = {{{{a}^{4}}} {{{\sin\left( b\right)}^{2}}}}$
      GOOD
      time: 6.185000ms
      stack: size: 21
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • ^:Expand:integerPower
      • Expand
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • +:Prune:combineConstants
      • *:Prune:combinePows
      • Prune
      • Factor
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Tidy


      some more stuff


      simplifyAssertEq((y-x)/(x-y), -1)
      ${\frac{{y}{-{x}}}{{x}{-{y}}}} = {-1}$
      GOOD
      time: 1.566000ms
      stack: size: 8
      • Init
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Constant:Tidy:apply
      • Tidy

      simplifyAssertEq((x+y)/(x+y)^2, 1/(x+y))
      ${\frac{{x} + {y}}{{\left({{x} + {y}}\right)}^{2}}} = {\frac{1}{{x} + {y}}}$
      GOOD
      time: 1.344000ms
      stack: size: 9
      • Init
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Tidy

      simplifyAssertEq((-x+y)/(-x+y)^2, 1/(-x+y))
      ${\frac{{-{x}} + {y}}{{\left({{-{x}} + {y}}\right)}^{2}}} = {\frac{1}{{-{x}} + {y}}}$
      GOOD
      time: 1.862000ms
      stack: size: 13
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • Expand
      • Prune
      • +:Factor:apply
      • /:Factor:polydiv
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy


      simplifyAssertEq( gUxy * (gUxy^2 - gUxx*gUyy) / (gUxx * gUyy - gUxy^2), -gUxy)
      ${\frac{{{{\gamma^{xy}}}} \cdot {{\left({{{{\gamma^{xy}}}^{2}}{-{{{{\gamma^{xx}}}} \cdot {{{\gamma^{yy}}}}}}}\right)}}}{{{{{\gamma^{xx}}}} \cdot {{{\gamma^{yy}}}}}{-{{{\gamma^{xy}}}^{2}}}}} = {-{{\gamma^{xy}}}}$
      GOOD
      time: 6.215000ms
      stack: size: 11
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy

      simplifyAssertEq( gUxy * (gUxy - gUxx*gUyy) / (gUxx * gUyy - gUxy), -gUxy)
      ${\frac{{{{\gamma^{xy}}}} \cdot {{\left({{{\gamma^{xy}}}{-{{{{\gamma^{xx}}}} \cdot {{{\gamma^{yy}}}}}}}\right)}}}{{{{{\gamma^{xx}}}} \cdot {{{\gamma^{yy}}}}}{-{{\gamma^{xy}}}}}} = {-{{\gamma^{xy}}}}$
      GOOD
      time: 6.502000ms
      stack: size: 11
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy

      simplifyAssertEq( gUxy * (gUxy - gUxx) / (gUxx - gUxy), -gUxy)
      ${\frac{{{{\gamma^{xy}}}} \cdot {{\left({{{\gamma^{xy}}}{-{{\gamma^{xx}}}}}\right)}}}{{{\gamma^{xx}}}{-{{\gamma^{xy}}}}}} = {-{{\gamma^{xy}}}}$
      GOOD
      time: 2.215000ms
      stack: size: 11
      • Init
      • unm:Prune:doubleNegative
      • Prune
      • Expand
      • Prune
      • Factor
      • Prune
      • Constant:Tidy:apply
      • *:Tidy:apply
      • *:Tidy:apply
      • Tidy


      assert( not( Constant(0) == x * y ) )
      GOOD time: 0.014000ms
      stack: size: 0

        assert( Constant(0) ~= x * y )
        GOOD time: 0.009000ms
        stack: size: 0

          simplifyAssertEq( Constant(0):subst( (v'^k' * v'^l' * g'_kl'):eq(var'vsq') ), Constant(0) )
          ${0} = {0}$
          GOOD
          time: 0.120000ms
          stack: size: 0

            simplifyAssertEq( Constant(0):replace( v'^k' * v'^l' * g'_kl', var'vsq' ), Constant(0) )
            ${0} = {0}$
            GOOD
            time: 0.044000ms
            stack: size: 0

              simplifyAssertEq( Constant(0):replace( v'^k' * v'^l', var'vsq' ), Constant(0) )
              ${0} = {0}$
              GOOD
              time: 0.038000ms
              stack: size: 0

                simplifyAssertEq( Constant(0):replace( v'^k', var'vsq' ), Constant(0) )
                ${0} = {0}$
                GOOD
                time: 0.028000ms
                stack: size: 0

                  fixed this bug with op.div.rules.Prune.negOverNeg
                  'a' var lexically before 'f' var, squared, times -1's, simplification loop. oscillates between factoring out the -1 or not.
                  simplifyAssertEq(-f * a^2 + f^3 * a^2 - f^5 * a^2, -f * a^2 * (1 - f^2 + f^4))
                  ${{{ {-{f}} {{{a}^{2}}}} + {{{{f}^{3}}} {{{a}^{2}}}}}{-{{{{f}^{5}}} {{{a}^{2}}}}}} = { {-{f}} {{{a}^{2}}} {{\left({{1}{-{{f}^{2}}} + {{f}^{4}}}\right)}}}$
                  GOOD
                  time: 11.236000ms
                  stack: size: 33
                  • Init
                  • unm:Prune:doubleNegative
                  • unm:Prune:doubleNegative
                  • *:Prune:flatten
                  • Prune
                  • ^:Expand:integerPower
                  • ^:Expand:integerPower
                  • ^:Expand:integerPower
                  • *:Expand:apply
                  • Expand
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • *:Prune:flatten
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • Prune
                  • Factor
                  • Prune
                  • Expand
                  • Prune
                  • Factor
                  • Prune
                  • Tidy
                  'g' var lexically before 'f' var, no simplification loop
                  simplifyAssertEq(-f * g^2 + f^3 * g^2 - f^5 * g^2, -f * g^2 * (1 - f^2 + f^4))
                  ${{{ {-{f}} {{{g}^{2}}}} + {{{{f}^{3}}} {{{g}^{2}}}}}{-{{{{f}^{5}}} {{{g}^{2}}}}}} = { {-{f}} {{{g}^{2}}} {{\left({{1}{-{{f}^{2}}} + {{f}^{4}}}\right)}}}$
                  GOOD
                  time: 6.617000ms
                  stack: size: 33
                  • Init
                  • unm:Prune:doubleNegative
                  • unm:Prune:doubleNegative
                  • *:Prune:flatten
                  • Prune
                  • ^:Expand:integerPower
                  • ^:Expand:integerPower
                  • ^:Expand:integerPower
                  • *:Expand:apply
                  • Expand
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • *:Prune:flatten
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • Prune
                  • Factor
                  • Prune
                  • Expand
                  • Prune
                  • Factor
                  • Prune
                  • Tidy
                  replace -1's with +1's, no simplification loop
                  simplifyAssertEq(f * a^2 + f^3 * a^2 + f^5 * a^2, f * a^2 * (1 + f^2 + f^4))
                  ${{{{f}} {{{a}^{2}}}} + {{{{f}^{3}}} {{{a}^{2}}}} + {{{{f}^{5}}} {{{a}^{2}}}}} = {{{f}} {{{a}^{2}}} {{\left({{1} + {{f}^{2}} + {{f}^{4}}}\right)}}}$
                  GOOD
                  time: 3.449000ms
                  stack: size: 25
                  • Init
                  • Prune
                  • ^:Expand:integerPower
                  • ^:Expand:integerPower
                  • ^:Expand:integerPower
                  • *:Expand:apply
                  • Expand
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • Prune
                  • Factor
                  • Prune
                  • Tidy
                  replace a^2 with a, no simplification loop
                  simplifyAssertEq(-f * a + f^3 * a - f^5 * a, -f * a * (1 - f^2 + f^4))
                  ${{{ {-{f}} {{a}}} + {{{{f}^{3}}} {{a}}}}{-{{{{f}^{5}}} {{a}}}}} = { {-{f}} {{a}} {{\left({{1}{-{{f}^{2}}} + {{f}^{4}}}\right)}}}$
                  GOOD
                  time: 5.369000ms
                  stack: size: 26
                  • Init
                  • unm:Prune:doubleNegative
                  • unm:Prune:doubleNegative
                  • *:Prune:flatten
                  • Prune
                  • ^:Expand:integerPower
                  • ^:Expand:integerPower
                  • *:Expand:apply
                  • Expand
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • *:Prune:flatten
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • Prune
                  • Factor
                  • Prune
                  • Expand
                  • Prune
                  • Factor
                  • Prune
                  • Tidy
                  replace f * quadratic of f^2 with f * quadratic of f, no simplification loop
                  simplifyAssertEq(-f * a^2 + f^2 * a^2 - f^3 * a^2, -f * a^2 * (1 - f + f^2))
                  ${{{ {-{f}} {{{a}^{2}}}} + {{{{f}^{2}}} {{{a}^{2}}}}}{-{{{{f}^{3}}} {{{a}^{2}}}}}} = { {-{f}} {{{a}^{2}}} {{\left({{1}{-{f}} + {{f}^{2}}}\right)}}}$
                  GOOD
                  time: 3.408000ms
                  stack: size: 31
                  • Init
                  • unm:Prune:doubleNegative
                  • unm:Prune:doubleNegative
                  • *:Prune:flatten
                  • Prune
                  • ^:Expand:integerPower
                  • ^:Expand:integerPower
                  • *:Expand:apply
                  • Expand
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • *:Prune:flatten
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • +:Prune:combineConstants
                  • *:Prune:combinePows
                  • Prune
                  • *:Factor:combineMulOfLikePow
                  • Factor
                  • Prune
                  • Expand
                  • Prune
                  • Factor
                  • Prune
                  • Tidy

                  this runs forever (unless I push certain rules)
                  (b^2 * (a * r^2 + (a + 3 * sqrt(b^2 + delta^2))) * (a + sqrt(b^2 + delta^2))^2 / (3 * (r^2 + (a + sqrt(b^2 + delta^2))^2)^frac(5,2) * (b^2 + delta^2)^frac(3,2)) - lambda * exp(-l^2 / 2)):diff(delta)()