simplifyAssertEq(#{x:eq(0):solve(x)}, 1)
${1} = {1}$
GOOD
time: 0.918000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(x:eq(0):solve(x), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 2.940000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy



simplifyAssertEq(#{x:eq(1):solve(x)}, 1)
${1} = {1}$
GOOD
time: 1.307000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

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



simplifyAssertEq(#{(x+1):eq(0):solve(x)}, 1)
${1} = {1}$
GOOD
time: 1.054000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x+1):eq(0):solve(x), x:eq(-1))
${{x} = {-{1}}} = {{x} = {-1}}$
GOOD
time: 1.753000ms
stack: size: 8
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Constant:Tidy:apply
  • Tidy



simplifyAssertEq(#{(x^2):eq(1):solve(x)}, 2)
${2} = {2}$
GOOD
time: 3.909000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x^2):eq(1):solve(x), x:eq(1))
${{x} = {1}} = {{x} = {1}}$
GOOD
time: 3.706000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(2, (x^2):eq(1):solve(x)), x:eq(-1))
${{x} = {-{1}}} = {{x} = {-1}}$
GOOD
time: 3.905000ms
stack: size: 8
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Constant:Tidy:apply
  • Tidy



simplifyAssertEq(#{(x^2):eq(-1):solve(x)}, 2)
${2} = {2}$
GOOD
time: 5.354000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x^2):eq(-1):solve(x), x:eq(i))
${{x} = {i}} = {{x} = {i}}$
GOOD
time: 4.067000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(2, (x^2):eq(-1):solve(x)), x:eq(-i))
${{x} = {-{i}}} = {{x} = {-{i}}}$
GOOD
time: 5.630000ms
stack: size: 11
  • Init
  • unm:Prune:doubleNegative
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Constant:Tidy:apply
  • *:Tidy:apply
  • *:Tidy:apply
  • Tidy



print((x^2):eq(0):solve(x))
${x} = {0}$ ${x} = {0}$ GOOD time: 3.745000ms
stack: size: 10
  • Init
  • unm:Prune:doubleNegative
  • ^:Prune:zeroToTheX
  • *:Prune:apply
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(#{(x^2):eq(0):solve(x)}, 2)
${2} = {2}$
GOOD
time: 2.390000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x^2):eq(0):solve(x), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 2.788000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(2, (x^2):eq(0):solve(x)), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 2.512000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


same with 3 ...


print((x^3):eq(0):solve(x))
${x} = {0}$ ${x} = {0}$ ${x} = {0}$ GOOD time: 47.266000ms
stack: size: 13
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:zeroToTheX
  • *:Prune:apply
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(#{(x^3):eq(0):solve(x)}, 3)
${3} = {3}$
GOOD
time: 30.758000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x^3):eq(0):solve(x), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 31.224000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(2, (x^3):eq(0):solve(x)), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 27.939000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(3, (x^3):eq(0):solve(x)), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 33.311000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


same with 4 ...


print((x^4):eq(0):solve(x))
${x} = {0}$ ${x} = {0}$ ${x} = {0}$ ${x} = {0}$ GOOD time: 5.549000ms
stack: size: 11
  • Init
  • unm:Prune:doubleNegative
  • ^:Prune:zeroToTheX
  • *:Prune:apply
  • *:Prune:flatten
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(#{(x^4):eq(0):solve(x)}, 4)
${4} = {4}$
GOOD
time: 6.191000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x^4):eq(0):solve(x), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 6.937000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(2, (x^4):eq(0):solve(x)), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 5.521000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(3, (x^4):eq(0):solve(x)), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 7.336000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(4, (x^4):eq(0):solve(x)), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 7.167000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


Deterministic order of roots?

For quadratics it is plus sqrt(discr) first then minus

For x^n times P(x) it is the zeroes first (TODO how about instead of enumerating all roots, we provide multiplicity, so (x^n):eq(0):solve(x) can return (for n != 0, x=0 n-times)



distinguish between x*(x^2 + 2x + 1) and (x^3 + 2x^2 + x) , because the solver handles one but not the other


printbr( (x * (x^2 + 2*x + 1)):eq(0):solve(x)  )
${x} = {0}$ ${x} = {-{1}}$ ${x} = {-{1}}$
GOOD
time: 3.363000ms
stack: size: 22
  • Init
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • ^:Prune:simplifyConstantPowers
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:zeroToTheX
  • sqrt:Prune:apply
  • +:Prune:combineConstants
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Constant:Tidy:apply
  • Tidy

simplifyAssertEq(#{(x * (x^2 + 2*x + 1)):eq(0):solve(x)}, 3)
${3} = {3}$
GOOD
time: 5.445000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x * (x^2 + 2*x + 1)):eq(0):solve(x), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 4.806000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(2, (x * (x^2 + 2*x + 1)):eq(0):solve(x)), x:eq(-1))
${{x} = {-{1}}} = {{x} = {-1}}$
GOOD
time: 3.842000ms
stack: size: 8
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Constant:Tidy:apply
  • Tidy

simplifyAssertEq(select(3, (x * (x^2 + 2*x + 1)):eq(0):solve(x)), x:eq(-1))
${{x} = {-{1}}} = {{x} = {-1}}$
GOOD
time: 3.955000ms
stack: size: 8
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Constant:Tidy:apply
  • Tidy



printbr( (x^3 + 2*x^2 + x):eq(0):solve(x) )
${x} = {0}$ ${x} = {-{{\frac{1}{2}}{\left({{1} + {{{i}} {{\sqrt{3}}}}}\right)}}}$ ${x} = {{\frac{1}{2}}{\left({{-{1}} + {{{i}} {{\sqrt{3}}}}}\right)}}$
GOOD
time: 29.271000ms
stack: size: 15
  • Init
  • unm:Prune:doubleNegative
  • ^:Prune:simplifyConstantPowers
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(#{(x^3 + 2*x^2 + x):eq(0):solve(x)}, 3)
${3} = {3}$
GOOD
time: 25.055000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x * (x^2 + 2*x + 1)):eq(0):solve(x), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 2.993000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(2, (x * (x^2 + 2*x + 1)):eq(0):solve(x)), x:eq(-1))
${{x} = {-{1}}} = {{x} = {-1}}$
GOOD
time: 3.040000ms
stack: size: 8
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Constant:Tidy:apply
  • Tidy

simplifyAssertEq(select(3, (x * (x^2 + 2*x + 1)):eq(0):solve(x)), x:eq(-1))
${{x} = {-{1}}} = {{x} = {-1}}$
GOOD
time: 2.724000ms
stack: size: 8
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Constant:Tidy:apply
  • Tidy


same with x^3 + x^2 - x


printbr( (x * (x^2 + x - 1)):eq(0):solve(x)  )
${x} = {0}$ ${x} = {-{{\frac{1}{2}}{\left({{1} + {\sqrt{5}}}\right)}}}$ ${x} = {{\frac{1}{2}}{\left({{-{1}} + {\sqrt{5}}}\right)}}$
GOOD
time: 13.537000ms
stack: size: 16
  • Init
  • unm:Prune:doubleNegative
  • ^:Prune:simplifyConstantPowers
  • *:Prune:apply
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(#{(x * (x^2 + x - 1)):eq(0):solve(x)}, 3)
${3} = {3}$
GOOD
time: 10.860000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x * (x^2 + x - 1)):eq(0):solve(x), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 11.158000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(2, (x * (x^2 + x - 1)):eq(0):solve(x)), x:eq( -(1 + sqrt(5))/2 ))
${{x} = {-{{\frac{1}{2}}{\left({{1} + {\sqrt{5}}}\right)}}}} = {{x} = {{\frac{1}{2}}{\left({-{\left({{1} + {\sqrt{5}}}\right)}}\right)}}}$
GOOD
time: 28.235000ms
stack: size: 13
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • Prune
  • *:Expand:apply
  • Expand
  • *:Prune:apply
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(3, (x * (x^2 + x - 1)):eq(0):solve(x)), x:eq( -(1 - sqrt(5))/2 ))
${{x} = {{\frac{1}{2}}{\left({{-{1}} + {\sqrt{5}}}\right)}}} = {{x} = {{\frac{1}{2}}{\left({-{\left({{1}{-{\sqrt{5}}}}\right)}}\right)}}}$
GOOD
time: 19.166000ms
stack: size: 23
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • unm:Prune:doubleNegative
  • Prune
  • *:Expand:apply
  • Expand
  • *:Prune:apply
  • ^:Prune:sqrtFix4
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • *:Prune:flatten
  • Prune
  • Factor
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy



printbr( (x^3 + x^2 - x):eq(0):solve(x) )
${x} = {0}$ ${x} = {-{{\frac{1}{2}}{\left({{1} + {{{i}} {{\sqrt{3}}}}}\right)}}}$ ${x} = {{\frac{1}{2}}{\left({{-{1}} + {{{i}} {{\sqrt{3}}}}}\right)}}$
GOOD
time: 22.088000ms
stack: size: 15
  • Init
  • unm:Prune:doubleNegative
  • ^:Prune:simplifyConstantPowers
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(#{(x^3 + x^2 - x):eq(0):solve(x)}, 3)
${3} = {3}$
GOOD
time: 19.868000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq((x * (x^2 + x - 1)):eq(0):solve(x), x:eq(0))
${{x} = {0}} = {{x} = {0}}$
GOOD
time: 9.966000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(2, (x * (x^2 + x - 1)):eq(0):solve(x)), x:eq( -(1 + sqrt(5))/2 ))
${{x} = {-{{\frac{1}{2}}{\left({{1} + {\sqrt{5}}}\right)}}}} = {{x} = {{\frac{1}{2}}{\left({-{\left({{1} + {\sqrt{5}}}\right)}}\right)}}}$
GOOD
time: 25.729000ms
stack: size: 13
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • Prune
  • *:Expand:apply
  • Expand
  • *:Prune:apply
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(select(3, (x * (x^2 + x - 1)):eq(0):solve(x)), x:eq( -(1 - sqrt(5))/2 ))
${{x} = {{\frac{1}{2}}{\left({{-{1}} + {\sqrt{5}}}\right)}}} = {{x} = {{\frac{1}{2}}{\left({-{\left({{1}{-{\sqrt{5}}}}\right)}}\right)}}}$
GOOD
time: 17.683000ms
stack: size: 23
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • unm:Prune:doubleNegative
  • Prune
  • *:Expand:apply
  • Expand
  • *:Prune:apply
  • ^:Prune:sqrtFix4
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • *:Prune:flatten
  • Prune
  • Factor
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy