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

simplifyAssertEq(sqrt(-1), i)
${\sqrt{-1}} = {i}$
GOOD
time: 1.152000ms
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: 41.294000ms
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: 36.265000ms
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: 25.315000ms
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: 23.186000ms
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: 52.938000ms
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: 48.286000ms
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: 10.295000ms
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: 5.925000ms
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: 8.408000ms
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: 25.509000ms
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: 34.637000ms
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: 37.578000ms
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: 20.928000ms
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: 9.068000ms
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: 9.437000ms
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: 3.602000ms
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: 58.092000ms
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: 44.719000ms
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: 34.763000ms
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: 8.913000ms
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: 11.926000ms
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: 9.394000ms
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: 8.668000ms
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: 49.450000ms
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: 6.217000ms
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: 96.449000ms
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: 18.617000ms
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: 16.953000ms
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: 23.172000ms
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: 54.551000ms
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: 16.375000ms
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: 115.286000ms
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: 12.709000ms
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(symmath.op.eq(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: 6.191000ms
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: 37.380000ms
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: 20.906000ms
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: 1.790000ms
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: 1.159000ms
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: 2.532000ms
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: 2.669000ms
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: 2.879000ms
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: 4.661000ms
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: 4.674000ms
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:54: in function 'timer'
sqrt.lua:9: in main chunk
[C]: at 0x5593e085a3e0
time: 25.573000ms
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: 21.031000ms
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:54: in function 'timer'
sqrt.lua:9: in main chunk
[C]: at 0x5593e085a3e0
time: 86.096000ms
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:54: in function 'timer'
sqrt.lua:9: in main chunk
[C]: at 0x5593e085a3e0
time: 59.041000ms
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