diff --git a/omnn/math/Sum.cpp b/omnn/math/Sum.cpp index c0b90956e..75dd64573 100644 --- a/omnn/math/Sum.cpp +++ b/omnn/math/Sum.cpp @@ -735,46 +735,7 @@ namespace Valuable Sum::InCommonWith(const Valuable& v) const { - if(v.IsSum()) - { - auto& s = v.as(); - auto vars = Vars(); - if (vars.size() == 1 && vars == s.Vars()) { - auto& v = vars.begin()->as(); - auto solutions = Solutions(v); - auto vSolutions = s.Solutions(v); - - // get common solutions - decltype(solutions) commonSolutions; - std::set_intersection(solutions.begin(), solutions.end(), - vSolutions.begin(), vSolutions.end(), - std::inserter(commonSolutions, commonSolutions.begin())); - - if (commonSolutions.size() > 0) { - Product p({}); - for (auto& solution : commonSolutions) { - p.Add(v - solution); - } - return p; - } - else { - IMPLEMENT - } - }else{ - return GCD(v); - } - }else{ - auto c = v; - auto b = GetConstCont().begin(); - auto e = GetConstCont().end(); - if(b != e) - { - auto it = b; - while(c != constants::one && ++it != e) - c = it->InCommonWith(c); - } - return c; - } + return GCD(v); } max_exp_t Sum::findMaxVaExp() { @@ -1303,6 +1264,8 @@ namespace } } + // TODO: https://math.stackexchange.com/a/1854191/118612 + return PrincipalSurd(*this, 2); }