print(sqrt(-1)())
$i$ GOOD time: 0.817000ms
stack: size: 9
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq(sqrt(-1), i)
${\sqrt{-1}} = {i}$
GOOD
time: 0.674000ms
stack: size: 9
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

make sure, when distributing sqrt()'s, that the negative signs on the inside are simplified in advance

simplifyAssertEq( ((((-x*a - x*b)))^frac(1,2)), i * (sqrt(x) * sqrt(a+b)) )
${{\left({{ {-{x}} {{a}}}{-{{{x}} {{b}}}}}\right)}^{\frac{1}{2}}} = {{{i}} {{\sqrt{x}}} {{\sqrt{{a} + {b}}}}}$
GOOD
time: 10.220000ms
stack: size: 16
  • Init
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • Prune
  • Expand
  • Prune
  • +:Factor:apply
  • *:Factor:combineMulOfLikePow
  • Factor
  • ^:Prune:expandMulOfLikePow
  • *:Prune:flatten
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • Tidy

simplifyAssertEq( (-(((-x*a - x*b)))^frac(1,2)), -i * (sqrt(x) * sqrt(a+b)) )
${-{{\left({{ {-{x}} {{a}}}{-{{{x}} {{b}}}}}\right)}^{\frac{1}{2}}}} = { {-{i}} {{\sqrt{x}}} {{\sqrt{{a} + {b}}}}}$
GOOD
time: 9.515000ms
stack: size: 21
  • Init
  • unm:Prune:doubleNegative
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • *:Prune:flatten
  • Prune
  • Expand
  • Prune
  • +:Factor:apply
  • *:Factor:combineMulOfLikePow
  • Factor
  • ^:Prune:expandMulOfLikePow
  • *:Prune:flatten
  • Prune
  • Constant:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • *:Tidy:apply
  • *:Tidy:apply
  • Tidy


simplifyAssertEq( ((((-x*a - x*b)*-1))^frac(1,2)), (sqrt(x) * sqrt(a+b)) )
${{\left({{{\left({{ {-{x}} {{a}}}{-{{{x}} {{b}}}}}\right)}} \cdot {{-1}}}\right)}^{\frac{1}{2}}} = {{{\sqrt{x}}} {{\sqrt{{a} + {b}}}}}$
GOOD
time: 5.549000ms
stack: size: 15
  • Init
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • Prune
  • Expand
  • Prune
  • +:Factor:apply
  • *:Factor:combineMulOfLikePow
  • Factor
  • ^:Prune:expandMulOfLikePow
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • Tidy

simplifyAssertEq( (-(((-x*a - x*b)*-1))^frac(1,2)), -(sqrt(x) * sqrt(a+b)) )
${-{{\left({{{\left({{ {-{x}} {{a}}}{-{{{x}} {{b}}}}}\right)}} \cdot {{-1}}}\right)}^{\frac{1}{2}}}} = {-{{{\sqrt{x}}} {{\sqrt{{a} + {b}}}}}}$
GOOD
time: 5.671000ms
stack: size: 20
  • Init
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • Prune
  • Expand
  • Prune
  • +:Factor:apply
  • *:Factor:combineMulOfLikePow
  • Factor
  • ^:Prune:expandMulOfLikePow
  • *:Prune:flatten
  • Prune
  • Constant:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • *:Tidy:apply
  • *:Tidy:apply
  • Tidy
If sqrt, -1, and mul factor run out of order then -sqrt(-x) and sqrt(-x) will end up equal. And that isn't good for things like solve() on quadratics.

simplifyAssertEq( ((((-x*a - x*b)/-1)/y)^frac(1,2)), (sqrt(x) * sqrt(a+b)) / sqrt(y) )
${{\left({{\frac{1}{y}} {{\frac{1}{-1}}{\left({{ {-{x}} {{a}}}{-{{{x}} {{b}}}}}\right)}}}\right)}^{\frac{1}{2}}} = {\frac{{{\sqrt{x}}} {{\sqrt{{a} + {b}}}}}{\sqrt{y}}}$
GOOD
time: 14.229000ms
stack: size: 35
  • Init
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • Prune
  • Expand
  • Prune
  • +:Factor:apply
  • *:Factor:combineMulOfLikePow
  • /:Factor:polydiv
  • Factor
  • ^:Prune:expandMulOfLikePow
  • *:Prune:flatten
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • Tidy

simplifyAssertEq( (-(((-x*a - x*b)/-1)/y)^frac(1,2)), -(sqrt(x) * sqrt(a+b)) / sqrt(y) )
${-{{\left({{\frac{1}{y}} {{\frac{1}{-1}}{\left({{ {-{x}} {{a}}}{-{{{x}} {{b}}}}}\right)}}}\right)}^{\frac{1}{2}}}} = {\frac{-{{{\sqrt{x}}} {{\sqrt{{a} + {b}}}}}}{\sqrt{y}}}$
GOOD
time: 13.795000ms
stack: size: 41
  • Init
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • sqrt:Prune:apply
  • Prune
  • Expand
  • Prune
  • +:Factor:apply
  • *:Factor:combineMulOfLikePow
  • /:Factor:polydiv
  • Factor
  • ^:Prune:expandMulOfLikePow
  • *:Prune:flatten
  • *:Prune:flatten
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • Prune
  • Constant:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • *:Tidy:apply
  • *:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • /:Tidy:apply
  • Tidy


simplifying expressions with sqrts in them

simplifyAssertEq( 2^frac(-1,2) + 2^frac(1,2), frac(3, sqrt(2)) )
${{{2}^{\frac{-1}{2}}} + {{2}^{\frac{1}{2}}}} = {\frac{3}{\sqrt{2}}}$
GOOD
time: 3.861000ms
stack: size: 12
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • Tidy

simplifyAssertEq( 2*2^frac(-1,2) + 2^frac(1,2), 2 * sqrt(2) )
${{{{2}} \cdot {{{2}^{\frac{-1}{2}}}}} + {{2}^{\frac{1}{2}}}} = {{{2}} {{\sqrt{2}}}}$
GOOD
time: 1.912000ms
stack: size: 13
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • *:Prune:combinePows
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • Tidy

simplifyAssertEq( 4*2^frac(-1,2) + 2^frac(1,2), 3 * sqrt(2) )
${{{{4}} \cdot {{{2}^{\frac{-1}{2}}}}} + {{2}^{\frac{1}{2}}}} = {{{3}} {{\sqrt{2}}}}$
GOOD
time: 1.976000ms
stack: size: 13
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • Tidy


simplifyAssertEq( (1 + sqrt(3))^2 + (1 - sqrt(3))^2, 8 )
${{{\left({{1} + {\sqrt{3}}}\right)}^{2}} + {{\left({{1}{-{\sqrt{3}}}}\right)}^{2}}} = {8}$
GOOD
time: 6.228000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( (frac(1,2)*sqrt(3))*(frac(sqrt(2),sqrt(3))) + (-frac(1,2))*(frac(1,3)*-sqrt(2)) , 2 * sqrt(2) / 3)
${{{{\frac{1}{2}}} {{\sqrt{3}}} {{\frac{\sqrt{2}}{\sqrt{3}}}}} + { {-{\frac{1}{2}}} {{\frac{1}{3}}} \cdot {-{\sqrt{2}}}}} = {{\frac{1}{3}} {{{2}} {{\sqrt{2}}}}}$
GOOD
time: 9.600000ms
stack: size: 13
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • *:Prune:combinePows
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • Tidy


simplifyAssertEq( -frac(1,3)*-frac(1+sqrt(3),3) + -frac(2,3)*frac(1,3) + -frac(2,3) * frac(1-sqrt(3),3), -frac(1 - sqrt(3), 3))
${{ {-{\frac{1}{3}}} \cdot {-{{\frac{1}{3}}{\left({{1} + {\sqrt{3}}}\right)}}}} + { {-{\frac{2}{3}}} {{\frac{1}{3}}}} + { {-{\frac{2}{3}}} {{{\frac{1}{3}}{\left({{1}{-{\sqrt{3}}}}\right)}}}}} = {-{{\frac{1}{3}}{\left({{1}{-{\sqrt{3}}}}\right)}}}$
GOOD
time: 13.015000ms
stack: size: 24
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:factorDenominators
  • 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


simplifyAssertEq( -sqrt(3)*sqrt(2)/(2*sqrt(3)) + sqrt(2)/6, -sqrt(2)/3 )
${{\frac{ {-{\sqrt{3}}} {{\sqrt{2}}}}{{{2}} {{\sqrt{3}}}}} + {{\frac{1}{6}} {\sqrt{2}}}} = {{\frac{1}{3}}{\left({-{\sqrt{2}}}\right)}}$
GOOD
time: 4.790000ms
stack: size: 17
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • Prune
  • Constant:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • *:Tidy:apply
  • /:Tidy:apply
  • Tidy


simplifyAssertEq( 1 + 5*sqrt(5) + sqrt(5), 1 + 6*sqrt(5) )
${{1} + {{{5}} {{\sqrt{5}}}} + {\sqrt{5}}} = {{1} + {{{6}} {{\sqrt{5}}}}}$
GOOD
time: 2.171000ms
stack: size: 10
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy
powers of the sqrt sometimes get caught simplifying as merging the exponents, and don't add.
simplifyAssertEq( 1 + 25*sqrt(5) + sqrt(5), 1 + 26*sqrt(5) )
${{1} + {{{25}} {{\sqrt{5}}}} + {\sqrt{5}}} = {{1} + {{{26}} {{\sqrt{5}}}}}$
GOOD
time: 2.123000ms
stack: size: 10
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq( 1 + 5*sqrt(5) - 5*sqrt(5), 1 )
${{{1} + {{{5}} {{\sqrt{5}}}}}{-{{{5}} {{\sqrt{5}}}}}} = {1}$
GOOD
time: 1.132000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( -(1 + sqrt(5))/(2*sqrt(3)) , frac(1,2)*(-frac(1,sqrt(3)))*(1 + sqrt(5)) )
${\frac{-{\left({{1} + {\sqrt{5}}}\right)}}{{{2}} {{\sqrt{3}}}}} = {{{\frac{1}{2}}} \cdot {-{\frac{1}{\sqrt{3}}}} {{\left({{1} + {\sqrt{5}}}\right)}}}$
GOOD
time: 17.324000ms
stack: size: 83
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • *:Prune:factorDenominators
  • Prune
  • *:Expand:apply
  • Expand
  • *:Prune:apply
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • Constant:Tidy:apply
  • Constant:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • *:Tidy:apply
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( (-(1-sqrt(3))/3)*(frac(1,3)) + ((2+sqrt(3))/6)*(-(1-sqrt(3))/3) + (-(1+2*sqrt(3))/6)*(-(1+sqrt(3))/3) , (1 + sqrt(3))/3 )
${{{{{\frac{1}{3}}{\left({-{\left({{1}{-{\sqrt{3}}}}\right)}}\right)}}} {{\frac{1}{3}}}} + {{{{\frac{1}{6}}{\left({{2} + {\sqrt{3}}}\right)}}} {{{\frac{1}{3}}{\left({-{\left({{1}{-{\sqrt{3}}}}\right)}}\right)}}}} + {{{{\frac{1}{6}}{\left({-{\left({{1} + {{{2}} {{\sqrt{3}}}}}\right)}}\right)}}} {{{\frac{1}{3}}{\left({-{\left({{1} + {\sqrt{3}}}\right)}}\right)}}}}} = {{\frac{1}{3}}{\left({{1} + {\sqrt{3}}}\right)}}$
GOOD
time: 14.257000ms
stack: size: 10
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( (-sqrt(sqrt(5) + 1) * (1 - sqrt(5))) / (4 * sqrt(sqrt(5) - 1)) , frac(1,2))
${\frac{ {-{\sqrt{{\sqrt{5}} + {1}}}} {{\left({{1}{-{\sqrt{5}}}}\right)}}}{{{4}} {{\sqrt{{\sqrt{5}}{-{1}}}}}}} = {\frac{1}{2}}$
GOOD
time: 10.615000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

ok this is hard to explain ..
simplifyAssertNe( 6 + 6 * sqrt(3), 12)
${{6} + {{{6}} {{\sqrt{3}}}}} \ne {12}$
GOOD
time: 2.935000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( (sqrt(5) + 1) * (sqrt(5) - 1), 4)
${{{\left({{\sqrt{5}} + {1}}\right)}} {{\left({{\sqrt{5}}{-{1}}}\right)}}} = {4}$
GOOD
time: 2.051000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq( sqrt((sqrt(5) + 1) * (sqrt(5) - 1)), 2)
${\sqrt{{{\left({{\sqrt{5}} + {1}}\right)}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}} = {2}$
GOOD
time: 2.512000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( (1 + 2 / sqrt(3)) / (2 * sqrt(3)), (2 + sqrt(3)) / 6 )
${\frac{{1} + {\frac{2}{\sqrt{3}}}}{{{2}} {{\sqrt{3}}}}} = {{\frac{1}{6}}{\left({{2} + {\sqrt{3}}}\right)}}$
GOOD
time: 6.311000ms
stack: size: 10
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( (frac(1,3)*(-(1-sqrt(3)))) * (frac(1,3)*(-(1-sqrt(3)))) + (frac(1,6)*(2+sqrt(3))) * (frac(1,3)*(1+sqrt(3))) + (frac(1,6)*-(1+2*sqrt(3))) * frac(1,3), (4 - sqrt(3))/6 )
${{{{\frac{1}{3}}} \cdot {-{\left({{1}{-{\sqrt{3}}}}\right)}} {{\frac{1}{3}}} \cdot {-{\left({{1}{-{\sqrt{3}}}}\right)}}} + {{{\frac{1}{6}}} {{\left({{2} + {\sqrt{3}}}\right)}} {{\frac{1}{3}}} {{\left({{1} + {\sqrt{3}}}\right)}}} + {{{\frac{1}{6}}} \cdot {-{\left({{1} + {{{2}} {{\sqrt{3}}}}}\right)}} {{\frac{1}{3}}}}} = {{\frac{1}{6}}{\left({{4}{-{\sqrt{3}}}}\right)}}$
GOOD
time: 13.332000ms
stack: size: 11
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( 1/sqrt(6) + 1/sqrt(6), 2/sqrt(6) )
${{\frac{1}{\sqrt{6}}} + {\frac{1}{\sqrt{6}}}} = {\frac{2}{\sqrt{6}}}$
GOOD
time: 2.362000ms
stack: size: 23
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • /:Prune:divToPowSub
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • Tidy


simplifyAssertEq( (32 * sqrt(3) + 32 * sqrt(15)) / 384, (sqrt(3) + sqrt(15)) / 12 )
${{\frac{1}{384}}{\left({{{{32}} {{\sqrt{3}}}} + {{{32}} {{\sqrt{15}}}}}\right)}} = {{\frac{1}{12}}{\left({{\sqrt{3}} + {\sqrt{15}}}\right)}}$
GOOD
time: 31.563000ms
stack: size: 17
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( sqrt(5)/(2*sqrt(3)), sqrt(15)/6 )
${\frac{\sqrt{5}}{{{2}} {{\sqrt{3}}}}} = {{\frac{1}{6}} {\sqrt{15}}}$
GOOD
time: 6.134000ms
stack: size: 111
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • ^:Prune:sqrtFix4
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • ^:Prune:sqrtFix4
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • *:Prune:combineMulOfLikePow_constants
  • *:Prune:apply
  • ^:Prune:sqrtFix4
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • ^:Prune:sqrtFix4
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • *:Prune:combineMulOfLikePow_constants
  • *:Prune:apply
  • ^:Prune:sqrtFix4
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • ^:Prune:sqrtFix4
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • Tidy


simplifyAssertEq( -1/(2*sqrt(3)), -sqrt(frac(1,12)) )
${\frac{-1}{{{2}} {{\sqrt{3}}}}} = {-{\sqrt{\frac{1}{12}}}}$
GOOD
time: 5.803000ms
stack: size: 98
  • Init
  • sqrt:Prune:apply
  • ^:Prune:oneToTheX
  • *:Prune:apply
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • Constant:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • /:Tidy:apply
  • Tidy

simplifyAssertNe( -sqrt(frac(1,12)), sqrt(frac(1,12)) )
${-{\sqrt{\frac{1}{12}}}} \ne {\sqrt{\frac{1}{12}}}$
GOOD
time: 6.492000ms
stack: size: 137
  • Init
  • sqrt:Prune:apply
  • Prune
  • ^:Expand:frac
  • Expand
  • ^:Prune:oneToTheX
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • Tidy


simplifyAssertEq( (sqrt(2)*sqrt(frac(1,3))) * -frac(1,3) + (-frac(1,2)) * (sqrt(2)/sqrt(3)) + (frac(1,2)*1/sqrt(3)) * (-sqrt(2)/3), -sqrt(2) / sqrt(3) )
${{{{\sqrt{2}}} {{\sqrt{\frac{1}{3}}}} \cdot {-{\frac{1}{3}}}} + { {-{\frac{1}{2}}} {{\frac{\sqrt{2}}{\sqrt{3}}}}} + {{{\frac{\frac{1}{2}}{\sqrt{3}}}} {{{\frac{1}{3}}{\left({-{\sqrt{2}}}\right)}}}}} = {\frac{-{\sqrt{2}}}{\sqrt{3}}}$
GOOD
time: 20.320000ms
stack: size: 22
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • Prune
  • Constant:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • *:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • /:Tidy:apply
  • Tidy


simplifyAssertEq( 1 + ( -(7 - 3*sqrt(5)) / (3*(3 - sqrt(5))) )*(1 + frac(1,2)), (1 + sqrt(5))/4 )
${{1} + {{{\frac{-{\left({{7}{-{{{3}} {{\sqrt{5}}}}}}\right)}}{{{3}} {{\left({{3}{-{\sqrt{5}}}}\right)}}}}} {{\left({{1} + {\frac{1}{2}}}\right)}}}} = {{\frac{1}{4}}{\left({{1} + {\sqrt{5}}}\right)}}$
GOOD
time: 5.219000ms
stack: size: 10
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq( (-(sqrt(5)-1)/2)/sqrt((-(sqrt(5)-1)/2)^2 + 1), -sqrt( (sqrt(5) - 1) / (2 * sqrt(5)) ))
${\frac{{\frac{1}{2}}{\left({-{\left({{\sqrt{5}}{-{1}}}\right)}}\right)}}{\sqrt{{{\left({{\frac{1}{2}}{\left({-{\left({{\sqrt{5}}{-{1}}}\right)}}\right)}}\right)}^{2}} + {1}}}} = {-{\sqrt{\frac{{\sqrt{5}}{-{1}}}{{{2}} {{\sqrt{5}}}}}}}$
GOOD
time: 35.123000ms
stack: size: 120
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • +:Prune:combineConstants
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • Constant:Tidy:apply
  • ^:Tidy:replacePowerOfFractionWithRoots
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • *:Prune:apply
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • sqrt:Prune:apply
  • ^:Prune:sqrtFix4
  • +:Prune:combineConstants
  • *:Prune:combinePows
  • ^:Prune:distributePow
  • ^:Prune:expandMulOfLikePow
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • Prune
  • ^:Expand:integerPower
  • ^:Expand:integerPower
  • ^:Expand:frac
  • Expand
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • *:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • *:Prune:apply
  • unm:Prune:doubleNegative
  • +:Prune:combineConstants
  • ^:Prune:xToTheZero
  • *:Prune:apply
  • /:Prune:divToPowSub
  • *:Prune:factorDenominators
  • +:Prune:combineConstants
  • /:Prune:zeroOverX
  • +:Prune:factorOutDivs
  • ^:Prune:xToTheZero
  • *:Prune:combinePows
  • *:Prune:apply
  • *:Prune:factorDenominators
  • unm:Prune:doubleNegative
  • ^:Prune:sqrtFix4
  • /:Prune:prodOfSqrtOverProdOfSqrt
  • /:Prune:divToPowSub
  • /:Prune:mulBySqrtConj
  • Prune
  • Factor
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


simplifyAssertEq(sqrt(frac(15,16)) * sqrt(frac(2,3)), sqrt(5)/(2*sqrt(2)))
${{{\sqrt{\frac{15}{16}}}} {{\sqrt{\frac{2}{3}}}}} = {\frac{\sqrt{5}}{{{2}} {{\sqrt{2}}}}}$
GOOD
time: 3.974000ms
stack: size: 18
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • *:Prune:combinePows
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • Tidy


simplify() was introducing an unflattened mul where there originally was none
TODO NOTICE - if there's just sqrt(2)*sqrt(3) then the sqrts will merge ... so should they merge if that extra 2 is out front?

local expr = 2*sqrt(2)*sqrt(3) local sexpr = expr() printbr(Verbose(expr), '=', Verbose(sexpr)) simplifyAssertEq(expr,sexpr)
*[2, sqrt[2], sqrt[3]] = *[2, sqrt[2], sqrt[3]]
${{{2}} {{\sqrt{2}}} {{\sqrt{3}}}} = {{{2}} {{\sqrt{2}}} {{\sqrt{3}}}}$
GOOD
time: 1.748000ms
stack: size: 20
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • ^:Prune:sqrtFix4
  • *:Prune:combinePows
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • ^:Prune:sqrtFix4
  • Prune
  • ^:Tidy:replacePowerOfFractionWithRoots
  • ^:Tidy:replacePowerOfFractionWithRoots
  • *:Tidy:apply
  • Tidy


these go bad when I don't have mul/Prune/combineMulOfLikePow_mulPowAdd

simplifyAssertEq( ( sqrt(f) * (g + f * sqrt(g)) )() , sqrt(f) * sqrt(g) * (sqrt(g) + f))
${{{\sqrt{f}}} {{\sqrt{g}}} {{\left({{\sqrt{g}} + {f}}\right)}}} = {{{\sqrt{f}}} {{\sqrt{g}}} {{\left({{\sqrt{g}} + {f}}\right)}}}$
GOOD
time: 9.469000ms
stack: size: 21
  • Init
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • Prune
  • *:Expand:apply
  • Expand
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:flattenAddMul
  • ^:Prune:xToTheOne
  • *:Prune:combinePows
  • +:Prune:combineConstants
  • +:Prune:factorOutDivs
  • +:Prune:combineConstants
  • *:Prune:combinePows
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq( ( sqrt(f) * (g + sqrt(g)) )() , sqrt(f) * sqrt(g) * (sqrt(g) + 1))
${{{{\sqrt{f}}} {{\sqrt{g}}}} + {{{g}} {{\sqrt{f}}}}} = {{{\sqrt{f}}} {{\sqrt{g}}} {{\left({{\sqrt{g}} + {1}}\right)}}}$
GOOD
time: 5.059000ms
stack: size: 23
  • Init
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • +:Prune:combineConstants
  • Prune
  • *:Expand:apply
  • Expand
  • *:Prune:apply
  • /:Prune:xOverX
  • *:Prune:factorDenominators
  • +:Prune:flattenAddMul
  • ^:Prune:xToTheOne
  • *:Prune:combinePows
  • Prune
  • *:Factor:combineMulOfLikePow
  • Factor
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


hmm having constant factor and sqrt/pow simplification problems
works
simplifyAssertEq( sqrt(15) - sqrt(15), 0)
${{\sqrt{15}}{-{\sqrt{15}}}} = {0}$
GOOD
time: 0.666000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy
works
simplifyAssertEq( sqrt(6) - sqrt(Constant(2)*3), 0)
${{\sqrt{6}}{-{\sqrt{{{2}} \cdot {{3}}}}}} = {0}$
GOOD
time: 0.486000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq( sqrt(6) - sqrt(2)*sqrt(3), 0)
${{\sqrt{6}}{-{{{\sqrt{2}}} {{\sqrt{3}}}}}} = {0}$
GOOD
time: 0.525000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq( sqrt(15)/2 - sqrt(15)/2, 0)
${{{\frac{1}{2}} {\sqrt{15}}}{-{{\frac{1}{2}} {\sqrt{15}}}}} = {0}$
GOOD
time: 1.504000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq( sqrt(6*x) - sqrt(2)*sqrt(3)*sqrt(x), 0)
${{\sqrt{{{6}} {{x}}}}{-{{{\sqrt{2}}} {{\sqrt{3}}} {{\sqrt{x}}}}}} = {0}$
GOOD
time: 0.700000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy


without the extra product our difference-of-squares picks up fine ...
simplifyAssertEq( (3+sqrt(5)) * (3 - sqrt(5)), 4 )
${{{\left({{3} + {\sqrt{5}}}\right)}} {{\left({{3}{-{\sqrt{5}}}}\right)}}} = {4}$
GOOD
time: 1.742000ms
stack: size: 7
  • Init
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy
and it does recognize without the sqrts as a simplified form ...
assertEq( (4 * sqrt(3+sqrt(5)))(), 4 * sqrt(3+sqrt(5)) )
${{{4}} {{\sqrt{{3} + {\sqrt{5}}}}}} = {{{4}} {{\sqrt{{3} + {\sqrt{5}}}}}}$
GOOD
time: 1.101000ms
stack: size: 11
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy
but with and extra product of a sqrt of a sum ... it doesn't ... in fact specifically because the sqrt(3+sqrt(5)) matches the non-sqrt (3+sqrt(5)), so the powers combine, and then we can't merge all the sqrts into one as we did before
simplifyAssertEq( (3+sqrt(5)) * (3 - sqrt(5)) * sqrt(3+sqrt(5)) , 4 * sqrt(3+sqrt(5)))
${{{\left({{3} + {\sqrt{5}}}\right)}} {{\left({{3}{-{\sqrt{5}}}}\right)}} {{\sqrt{{3} + {\sqrt{5}}}}}} = {{{4}} {{\sqrt{{3} + {\sqrt{5}}}}}}$
expected ${{\left({{3} + {\sqrt{5}}}\right)}} {{\left({{3}{-{\sqrt{5}}}}\right)}} {{\sqrt{{3} + {\sqrt{5}}}}}$ to equal ${{4}} {{\sqrt{{3} + {\sqrt{5}}}}}$
found ${{\left({{3} + {\sqrt{5}}}\right)}} {{\sqrt{{3} + {\sqrt{5}}}}} {{\left({{3}{-{\sqrt{5}}}}\right)}}$ vs ${{4}} {{\sqrt{{3} + {\sqrt{5}}}}}$
lhs stack
Init ${{\left({{3} + {\sqrt{5}}}\right)}} {{\left({{3}{-{\sqrt{5}}}}\right)}} {{\sqrt{{3} + {\sqrt{5}}}}}$
	*[+[3, sqrt[5]], +[3, unm(sqrt[5])], sqrt[+[3, sqrt[5]]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

unm:Prune:doubleNegative ${{-1}} \cdot {{{5}^{\frac{1}{2}}}}$
	*[-1, ^[5, /[1, 2]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}$
	^[+[3, ^[5, /[1, 2]]], /[1, 2]]	

+:Prune:combineConstants $3$
	3	

+:Prune:factorOutDivs $\frac{3}{2}$
	/[3, 2]	

+:Prune:combineConstants $\frac{3}{2}$
	/[3, 2]	

*:Prune:combinePows ${{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}} {{\left({{3} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}$
	*[^[+[3, ^[5, /[1, 2]]], /[3, 2]], +[3, *[-1, ^[5, /[1, 2]]]]]	

Prune ${{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}} {{\left({{3} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}$
	*[^[+[3, ^[5, /[1, 2]]], /[3, 2]], +[3, *[-1, ^[5, /[1, 2]]]]]	

*:Expand:apply ${{{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}} {{3}}} + {{{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}} {{{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}}$
	+[*[^[+[3, ^[5, /[1, 2]]], /[3, 2]], 3], *[^[+[3, ^[5, /[1, 2]]], /[3, 2]], *[-1, ^[5, /[1, 2]]]]]	

Expand ${{{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}} {{3}}} + {{{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}} {{{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}}$
	+[*[^[+[3, ^[5, /[1, 2]]], /[3, 2]], 3], *[^[+[3, ^[5, /[1, 2]]], /[3, 2]], *[-1, ^[5, /[1, 2]]]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

*:Prune:flatten ${{-1}} \cdot {{{5}^{\frac{1}{2}}}} {{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}}$
	*[-1, ^[5, /[1, 2]], ^[+[3, ^[5, /[1, 2]]], /[3, 2]]]	

Prune ${{{3}} {{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}}} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}} {{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}}}$
	+[*[3, ^[+[3, ^[5, /[1, 2]]], /[3, 2]]], *[-1, ^[5, /[1, 2]], ^[+[3, ^[5, /[1, 2]]], /[3, 2]]]]	

Factor ${{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}} {{\left({{3} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}$
	*[^[+[3, ^[5, /[1, 2]]], /[3, 2]], +[3, *[-1, ^[5, /[1, 2]]]]]	

Prune ${{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{3}{2}}}} {{\left({{3} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}$
	*[^[+[3, ^[5, /[1, 2]]], /[3, 2]], +[3, *[-1, ^[5, /[1, 2]]]]]	

Tidy ${{\left({{3} + {\sqrt{5}}}\right)}} {{\sqrt{{3} + {\sqrt{5}}}}} {{\left({{3}{-{\sqrt{5}}}}\right)}}$
	*[+[3, sqrt[5]], sqrt[+[3, sqrt[5]]], +[3, unm(sqrt[5])]]	

rhs stack
Init ${{4}} {{\sqrt{{3} + {\sqrt{5}}}}}$
	*[4, sqrt[+[3, sqrt[5]]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}$
	^[+[3, ^[5, /[1, 2]]], /[1, 2]]	

Prune ${{4}} {{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[4, ^[+[3, ^[5, /[1, 2]]], /[1, 2]]]	

Expand ${{4}} {{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[4, ^[+[3, ^[5, /[1, 2]]], /[1, 2]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

Prune ${{4}} {{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[4, ^[+[3, ^[5, /[1, 2]]], /[1, 2]]]	

Factor ${{4}} {{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[4, ^[+[3, ^[5, /[1, 2]]], /[1, 2]]]	

Prune ${{4}} {{{\left({{3} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[4, ^[+[3, ^[5, /[1, 2]]], /[1, 2]]]	

Tidy ${{4}} {{\sqrt{{3} + {\sqrt{5}}}}}$
	*[4, sqrt[+[3, sqrt[5]]]]	

BAD
/home/chris/Projects/lua/symmath/tests/unit/unit.lua:125: 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:125: in function 'simplifyAssertEq'
[string "simplifyAssertEq( (3+sqrt(5)) * (3 - sqrt(5))..."]: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'
sqrt.lua:120: in function 'cb'
/home/chris/Projects/lua/ext/timer.lua:58: in function 'timer'
sqrt.lua:9: in main chunk
[C]: at 0x5cbe028e2380
time: 7.440000ms
stack: size: 11
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy
see
simplifyAssertEq( (3+sqrt(5)) * (3 - sqrt(5)) * sqrt(2+sqrt(5)) , 4 * sqrt(2+sqrt(5)))
${{{\left({{3} + {\sqrt{5}}}\right)}} {{\left({{3}{-{\sqrt{5}}}}\right)}} {{\sqrt{{2} + {\sqrt{5}}}}}} = {{{4}} {{\sqrt{{2} + {\sqrt{5}}}}}}$
GOOD
time: 8.075000ms
stack: size: 11
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • Prune
  • Expand
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Tidy
so I need to merge powers if the power is a fraction *and* the denominator matches

these are in simplification loops

start with -1 / ( (√√5 √(√5 - 1)) / √2 ) ... what mine gets now vs what mathematica gets

simplifyAssertEq( -1 / ( sqrt(sqrt(5) * (sqrt(5) - 1)) / sqrt(2) ), sqrt((5 + sqrt(5)) / 10))
${\frac{-1}{\frac{\sqrt{{{\sqrt{5}}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}}{\sqrt{2}}}} = {\sqrt{{\frac{1}{10}}{\left({{5} + {\sqrt{5}}}\right)}}}$
expected $\frac{-1}{\frac{\sqrt{{{\sqrt{5}}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}}{\sqrt{2}}}$ to equal $\sqrt{{\frac{1}{10}}{\left({{5} + {\sqrt{5}}}\right)}}$
found $-{\frac{{{{\sqrt{2}}} {{\sqrt{{-{1}} + {\sqrt{5}}}}}} + {{{\sqrt{10}}} {{\sqrt{{-{1}} + {\sqrt{5}}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}}$ vs $\frac{\sqrt{{1} + {\sqrt{5}}}}{{{\sqrt{2}}} {{{5}^{\frac{1}{4}}}}}$
lhs stack
Init $\frac{-1}{\frac{\sqrt{{{\sqrt{5}}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}}{\sqrt{2}}}$
	/[-1, /[sqrt[*[sqrt[5], +[sqrt[5], unm(1)]]], sqrt[2]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

unm:Prune:doubleNegative $-1$
	-1	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

+:Prune:combineConstants ${-1} + {{5}^{\frac{1}{2}}}$
	+[-1, ^[5, /[1, 2]]]	

+:Prune:combineConstants $2$
	2	

*:Prune:combinePows ${\left({\frac{1}{2}}\right)}^{2}$
	^[/[1, 2], 2]	

^:Prune:distributePow ${5}^{{\left({\frac{1}{2}}\right)}^{2}}$
	^[5, ^[/[1, 2], 2]]	

^:Prune:expandMulOfLikePow ${{{5}^{{\left({\frac{1}{2}}\right)}^{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[^[5, ^[/[1, 2], 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

sqrt:Prune:apply ${{{5}^{{\left({\frac{1}{2}}\right)}^{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[^[5, ^[/[1, 2], 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

^:Prune:sqrtFix4 ${2}^{\frac{1}{2}}$
	^[2, /[1, 2]]	

sqrt:Prune:apply ${2}^{\frac{1}{2}}$
	^[2, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

unm:Prune:doubleNegative ${{-1}} \cdot {{{5}^{\frac{1}{2}}}}$
	*[-1, ^[5, /[1, 2]]]	

^:Prune:simplifyConstantPowers $1$
	1	

^:Prune:simplifyConstantPowers $1$
	1	

*:Prune:apply $5$
	5	

*:Prune:apply $-5$
	-5	

unm:Prune:doubleNegative $-5$
	-5	

+:Prune:combineConstants $-4$
	-4	

unm:Prune:doubleNegative ${{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} {{\left({{-1} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}$
	*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], +[-1, *[-1, ^[5, /[1, 2]]]]]	

unm:Prune:doubleNegative ${{4}} \cdot {{{5}^{{\left({\frac{1}{2}}\right)}^{2}}}}$
	*[4, ^[5, ^[/[1, 2], 2]]]	

/:Prune:negOverNeg $\frac{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} {{\left({{-1} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{{\left({\frac{1}{2}}\right)}^{2}}}}}$
	/[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], +[-1, *[-1, ^[5, /[1, 2]]]]], *[4, ^[5, ^[/[1, 2], 2]]]]	

/:Prune:conjOfSqrtInDenom $\frac{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} {{\left({{-1} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{{\left({\frac{1}{2}}\right)}^{2}}}}}$
	/[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], +[-1, *[-1, ^[5, /[1, 2]]]]], *[4, ^[5, ^[/[1, 2], 2]]]]	

/:Prune:mulBySqrtConj $\frac{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} {{\left({{-1} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{{\left({\frac{1}{2}}\right)}^{2}}}}}$
	/[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], +[-1, *[-1, ^[5, /[1, 2]]]]], *[4, ^[5, ^[/[1, 2], 2]]]]	

/:Prune:qIsDiv $\frac{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} {{\left({{-1} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{{\left({\frac{1}{2}}\right)}^{2}}}}}$
	/[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], +[-1, *[-1, ^[5, /[1, 2]]]]], *[4, ^[5, ^[/[1, 2], 2]]]]	

Prune $\frac{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} {{\left({{-1} + {{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{{\left({\frac{1}{2}}\right)}^{2}}}}}$
	/[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], +[-1, *[-1, ^[5, /[1, 2]]]]], *[4, ^[5, ^[/[1, 2], 2]]]]	

*:Expand:apply ${{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} \cdot {{-1}}} + {{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} {{{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}}$
	+[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], -1], *[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], *[-1, ^[5, /[1, 2]]]]]	

^:Expand:integerPower ${{1}} \cdot {{1}}$
	*[1, 1]	

^:Expand:integerPower ${{2}} \cdot {{2}}$
	*[2, 2]	

^:Expand:frac $\frac{{{1}} \cdot {{1}}}{{{2}} \cdot {{2}}}$
	/[*[1, 1], *[2, 2]]	

Expand $\frac{{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} \cdot {{-1}}} + {{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}} {{{{-1}} \cdot {{{5}^{\frac{1}{2}}}}}}}}{{{4}} \cdot {{{5}^{\frac{{{1}} \cdot {{1}}}{{{2}} \cdot {{2}}}}}}}$
	/[+[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], -1], *[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]], *[-1, ^[5, /[1, 2]]]]], *[4, ^[5, /[*[1, 1], *[2, 2]]]]]	

^:Prune:sqrtFix4 ${2}^{\frac{1}{2}}$
	^[2, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

^:Prune:sqrtFix4 ${2}^{\frac{1}{2}}$
	^[2, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

*:Prune:apply $10$
	10	

*:Prune:combineMulOfLikePow_constants ${{-1}} \cdot {{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[-1, ^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

*:Prune:flatten ${{-1}} \cdot {{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[-1, ^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

*:Prune:apply $1$
	1	

*:Prune:apply $4$
	4	

Prune $\frac{{{{-1}} \cdot {{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{-1}} \cdot {{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[+[*[-1, ^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[-1, ^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]], *[4, ^[5, /[1, 4]]]]	

Factor $\frac{{{-1}} {{\left({{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[*[-1, +[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Prune $\frac{{{-1}} {{\left({{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[*[-1, +[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Expand $\frac{{{{-1}} {{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}} + {{{-1}} {{{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[+[*[-1, *[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]], *[-1, *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Prune $\frac{{{{-1}} \cdot {{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{-1}} \cdot {{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[+[*[-1, ^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[-1, ^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]], *[4, ^[5, /[1, 4]]]]	

Factor $\frac{{{-1}} {{\left({{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[*[-1, +[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Prune $\frac{{{-1}} {{\left({{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[*[-1, +[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Tidy $-{\frac{{{{\sqrt{2}}} {{\sqrt{{-{1}} + {\sqrt{5}}}}}} + {{{\sqrt{10}}} {{\sqrt{{-{1}} + {\sqrt{5}}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}}$
	unm(/[+[*[sqrt[2], sqrt[+[unm(1), sqrt[5]]]], *[sqrt[10], sqrt[+[unm(1), sqrt[5]]]]], *[4, ^[5, /[1, 4]]]])	

rhs stack
Init $\sqrt{{\frac{1}{10}}{\left({{5} + {\sqrt{5}}}\right)}}$
	sqrt[/[+[5, sqrt[5]], 10]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${\left({{\frac{1}{10}}{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}}\right)}^{\frac{1}{2}}$
	^[/[+[5, ^[5, /[1, 2]]], 10], /[1, 2]]	

Prune ${\left({{\frac{1}{10}}{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}}\right)}^{\frac{1}{2}}$
	^[/[+[5, ^[5, /[1, 2]]], 10], /[1, 2]]	

^:Expand:frac $\frac{{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{10}^{\frac{1}{2}}}$
	/[^[+[5, ^[5, /[1, 2]]], /[1, 2]], ^[10, /[1, 2]]]	

Expand $\frac{{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{10}^{\frac{1}{2}}}$
	/[^[+[5, ^[5, /[1, 2]]], /[1, 2]], ^[10, /[1, 2]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

^:Prune:sqrtFix4 ${10}^{\frac{1}{2}}$
	^[10, /[1, 2]]	

Prune $\frac{{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{10}^{\frac{1}{2}}}$
	/[^[+[5, ^[5, /[1, 2]]], /[1, 2]], ^[10, /[1, 2]]]	

Factor $\frac{{{{{5}^{\frac{1}{2}}}^{\frac{1}{2}}}} {{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}{{10}^{\frac{1}{2}}}$
	/[*[^[^[5, /[1, 2]], /[1, 2]], ^[+[1, ^[5, /[1, 2]]], /[1, 2]]], ^[10, /[1, 2]]]	

Prune $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Expand $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Prune $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Factor $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Prune $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Tidy $\frac{\sqrt{{1} + {\sqrt{5}}}}{{{\sqrt{2}}} {{{5}^{\frac{1}{4}}}}}$
	/[sqrt[+[1, sqrt[5]]], *[sqrt[2], ^[5, /[1, 4]]]]	

BAD
/home/chris/Projects/lua/symmath/tests/unit/unit.lua:125: 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:125: in function 'simplifyAssertEq'
[string "simplifyAssertEq( -1 / ( sqrt(sqrt(5) * (sqrt..."]: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'
sqrt.lua:120: in function 'cb'
/home/chris/Projects/lua/ext/timer.lua:58: in function 'timer'
sqrt.lua:9: in main chunk
[C]: at 0x5cbe028e2380
time: 20.274000ms
stack: size: 17
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • Prune
  • ^:Expand:frac
  • Expand
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy

simplifyAssertEq( -(sqrt( 10 * (sqrt(5) - 1) ) + sqrt(2 * (sqrt(5) - 1))) / (4 * sqrt(sqrt(5))), sqrt((5 + sqrt(5)) / 10))
${\frac{-{\left({{\sqrt{{{10}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}} + {\sqrt{{{2}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}}}\right)}}{{{4}} {{\sqrt{\sqrt{5}}}}}} = {\sqrt{{\frac{1}{10}}{\left({{5} + {\sqrt{5}}}\right)}}}$
expected $\frac{-{\left({{\sqrt{{{10}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}} + {\sqrt{{{2}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}}}\right)}}{{{4}} {{\sqrt{\sqrt{5}}}}}$ to equal $\sqrt{{\frac{1}{10}}{\left({{5} + {\sqrt{5}}}\right)}}$
found $-{\frac{{{{\sqrt{2}}} {{\sqrt{{-{1}} + {\sqrt{5}}}}}} + {{{\sqrt{10}}} {{\sqrt{{-{1}} + {\sqrt{5}}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}}$ vs $\frac{\sqrt{{1} + {\sqrt{5}}}}{{{\sqrt{2}}} {{{5}^{\frac{1}{4}}}}}$
lhs stack
Init $\frac{-{\left({{\sqrt{{{10}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}} + {\sqrt{{{2}} {{\left({{\sqrt{5}}{-{1}}}\right)}}}}}\right)}}{{{4}} {{\sqrt{\sqrt{5}}}}}$
	/[unm(+[sqrt[*[10, +[sqrt[5], unm(1)]]], sqrt[*[2, +[sqrt[5], unm(1)]]]]), *[4, sqrt[sqrt[5]]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

unm:Prune:doubleNegative $-1$
	-1	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

+:Prune:combineConstants ${-1} + {{5}^{\frac{1}{2}}}$
	+[-1, ^[5, /[1, 2]]]	

^:Prune:sqrtFix4 ${10}^{\frac{1}{2}}$
	^[10, /[1, 2]]	

^:Prune:expandMulOfLikePow ${{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

sqrt:Prune:apply ${{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

unm:Prune:doubleNegative $-1$
	-1	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

+:Prune:combineConstants ${-1} + {{5}^{\frac{1}{2}}}$
	+[-1, ^[5, /[1, 2]]]	

^:Prune:sqrtFix4 ${2}^{\frac{1}{2}}$
	^[2, /[1, 2]]	

^:Prune:expandMulOfLikePow ${{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

sqrt:Prune:apply ${{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

unm:Prune:doubleNegative ${{-1}} {{\left({{{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}$
	*[-1, +[*[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

+:Prune:combineConstants $2$
	2	

*:Prune:combinePows ${\left({\frac{1}{2}}\right)}^{2}$
	^[/[1, 2], 2]	

^:Prune:distributePow ${5}^{{\left({\frac{1}{2}}\right)}^{2}}$
	^[5, ^[/[1, 2], 2]]	

sqrt:Prune:apply ${5}^{{\left({\frac{1}{2}}\right)}^{2}}$
	^[5, ^[/[1, 2], 2]]	

Prune $\frac{{{-1}} {{\left({{{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{{\left({\frac{1}{2}}\right)}^{2}}}}}$
	/[*[-1, +[*[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, ^[/[1, 2], 2]]]]	

*:Expand:apply ${{{-1}} {{{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}} + {{{-1}} {{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}}$
	+[*[-1, *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]], *[-1, *[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]]	

^:Expand:integerPower ${{1}} \cdot {{1}}$
	*[1, 1]	

^:Expand:integerPower ${{2}} \cdot {{2}}$
	*[2, 2]	

^:Expand:frac $\frac{{{1}} \cdot {{1}}}{{{2}} \cdot {{2}}}$
	/[*[1, 1], *[2, 2]]	

Expand $\frac{{{{-1}} {{{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}} + {{{-1}} {{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}}}{{{4}} \cdot {{{5}^{\frac{{{1}} \cdot {{1}}}{{{2}} \cdot {{2}}}}}}}$
	/[+[*[-1, *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]], *[-1, *[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[*[1, 1], *[2, 2]]]]]	

^:Prune:sqrtFix4 ${10}^{\frac{1}{2}}$
	^[10, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

*:Prune:flatten ${{-1}} \cdot {{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[-1, ^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

^:Prune:sqrtFix4 ${2}^{\frac{1}{2}}$
	^[2, /[1, 2]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

*:Prune:flatten ${{-1}} \cdot {{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}$
	*[-1, ^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]	

*:Prune:apply $1$
	1	

*:Prune:apply $4$
	4	

Prune $\frac{{{{-1}} \cdot {{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{-1}} \cdot {{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[+[*[-1, ^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[-1, ^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]], *[4, ^[5, /[1, 4]]]]	

Factor $\frac{{{-1}} {{\left({{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[*[-1, +[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Prune $\frac{{{-1}} {{\left({{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[*[-1, +[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Expand $\frac{{{{-1}} {{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}} + {{{-1}} {{{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[+[*[-1, *[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]], *[-1, *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Prune $\frac{{{{-1}} \cdot {{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{-1}} \cdot {{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[+[*[-1, ^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[-1, ^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]], *[4, ^[5, /[1, 4]]]]	

Factor $\frac{{{-1}} {{\left({{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[*[-1, +[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Prune $\frac{{{-1}} {{\left({{{{{2}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}} + {{{{10}^{\frac{1}{2}}}} {{{\left({{-1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}}\right)}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}$
	/[*[-1, +[*[^[2, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]], *[^[10, /[1, 2]], ^[+[-1, ^[5, /[1, 2]]], /[1, 2]]]]], *[4, ^[5, /[1, 4]]]]	

Tidy $-{\frac{{{{\sqrt{2}}} {{\sqrt{{-{1}} + {\sqrt{5}}}}}} + {{{\sqrt{10}}} {{\sqrt{{-{1}} + {\sqrt{5}}}}}}}{{{4}} \cdot {{{5}^{\frac{1}{4}}}}}}$
	unm(/[+[*[sqrt[2], sqrt[+[unm(1), sqrt[5]]]], *[sqrt[10], sqrt[+[unm(1), sqrt[5]]]]], *[4, ^[5, /[1, 4]]]])	

rhs stack
Init $\sqrt{{\frac{1}{10}}{\left({{5} + {\sqrt{5}}}\right)}}$
	sqrt[/[+[5, sqrt[5]], 10]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

sqrt:Prune:apply ${\left({{\frac{1}{10}}{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}}\right)}^{\frac{1}{2}}$
	^[/[+[5, ^[5, /[1, 2]]], 10], /[1, 2]]	

Prune ${\left({{\frac{1}{10}}{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}}\right)}^{\frac{1}{2}}$
	^[/[+[5, ^[5, /[1, 2]]], 10], /[1, 2]]	

^:Expand:frac $\frac{{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{10}^{\frac{1}{2}}}$
	/[^[+[5, ^[5, /[1, 2]]], /[1, 2]], ^[10, /[1, 2]]]	

Expand $\frac{{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{10}^{\frac{1}{2}}}$
	/[^[+[5, ^[5, /[1, 2]]], /[1, 2]], ^[10, /[1, 2]]]	

^:Prune:sqrtFix4 ${5}^{\frac{1}{2}}$
	^[5, /[1, 2]]	

^:Prune:sqrtFix4 ${10}^{\frac{1}{2}}$
	^[10, /[1, 2]]	

Prune $\frac{{\left({{5} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{10}^{\frac{1}{2}}}$
	/[^[+[5, ^[5, /[1, 2]]], /[1, 2]], ^[10, /[1, 2]]]	

Factor $\frac{{{{{5}^{\frac{1}{2}}}^{\frac{1}{2}}}} {{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}}}{{10}^{\frac{1}{2}}}$
	/[*[^[^[5, /[1, 2]], /[1, 2]], ^[+[1, ^[5, /[1, 2]]], /[1, 2]]], ^[10, /[1, 2]]]	

Prune $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Expand $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Prune $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Factor $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Prune $\frac{{\left({{1} + {{5}^{\frac{1}{2}}}}\right)}^{\frac{1}{2}}}{{{{2}^{\frac{1}{2}}}} {{{5}^{\frac{1}{4}}}}}$
	/[^[+[1, ^[5, /[1, 2]]], /[1, 2]], *[^[2, /[1, 2]], ^[5, /[1, 4]]]]	

Tidy $\frac{\sqrt{{1} + {\sqrt{5}}}}{{{\sqrt{2}}} {{{5}^{\frac{1}{4}}}}}$
	/[sqrt[+[1, sqrt[5]]], *[sqrt[2], ^[5, /[1, 4]]]]	

BAD
/home/chris/Projects/lua/symmath/tests/unit/unit.lua:125: 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:125: in function 'simplifyAssertEq'
[string "simplifyAssertEq( -(sqrt( 10 * (sqrt(5) - 1) ..."]: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'
sqrt.lua:120: in function 'cb'
/home/chris/Projects/lua/ext/timer.lua:58: in function 'timer'
sqrt.lua:9: in main chunk
[C]: at 0x5cbe028e2380
time: 23.423000ms
stack: size: 17
  • Init
  • ^:Prune:sqrtFix4
  • sqrt:Prune:apply
  • sqrt:Prune:apply
  • Prune
  • ^:Expand:frac
  • Expand
  • ^:Prune:sqrtFix4
  • ^:Prune:sqrtFix4
  • Prune
  • Factor
  • Prune
  • Expand
  • Prune
  • Factor
  • Prune
  • Tidy