-/*
-ex power::expand_add_2(add const & a) const
-{
- // special case: expand a^2 where a is an add
-
- epvector sum;
- sum.reserve((a.seq.size()*(a.seq.size()+1))/2);
- epvector::const_iterator last=a.seq.end();
-
- for (epvector::const_iterator cit0=a.seq.begin(); cit0!=last; ++cit0) {
- ex const & b=a.recombine_pair_to_ex(*cit0);
- GINAC_ASSERT(!is_ex_exactly_of_type(b,add));
- GINAC_ASSERT(!is_ex_exactly_of_type(b,power)||
- !is_ex_exactly_of_type(ex_to_power(b).exponent,numeric)||
- !ex_to_numeric(ex_to_power(b).exponent).is_pos_integer());
- if (is_ex_exactly_of_type(b,mul)) {
- sum.push_back(a.split_ex_to_pair(expand_mul(ex_to_mul(b),numTWO())));
- } else {
- sum.push_back(a.split_ex_to_pair((new power(b,exTWO()))->
- setflag(status_flags::dynallocated)));
- }
- for (epvector::const_iterator cit1=cit0+1; cit1!=last; ++cit1) {
- sum.push_back(a.split_ex_to_pair((new mul(a.recombine_pair_to_ex(*cit0),
- a.recombine_pair_to_ex(*cit1)))->
- setflag(status_flags::dynallocated),
- exTWO()));
- }
- }
-
- GINAC_ASSERT(sum.size()==(a.seq.size()*(a.seq.size()+1))/2);
-
- return (new add(sum))->setflag(status_flags::dynallocated);
-}
-*/
-