This is a collection of some minor optimizations and indentation fixes.
15 files changed:
It is available from <ftp://ftpthep.physik.uni-mainz.de/pub/gnu/>.
You will also need a decent ISO C++-11 compiler. We recommend the C++
It is available from <ftp://ftpthep.physik.uni-mainz.de/pub/gnu/>.
You will also need a decent ISO C++-11 compiler. We recommend the C++
-compiler from the GNU compiler collection, GCC >= 4.9. If you have a
+compiler from the GNU compiler collection, GCC >= 4.8. If you have a
different or older compiler you are on your own. Note that you may have to
use the same compiler you compiled CLN with because of differing
name-mangling schemes.
different or older compiler you are on your own. Note that you may have to
use the same compiler you compiled CLN with because of differing
name-mangling schemes.
Known to work with:
- Linux on x86 and x86_64 using
Known to work with:
- Linux on x86 and x86_64 using
- - GCC 4.8, 4.9, 5.1, and 5.2
+ - GCC 4.8, 4.9, 5.1, 5.2, and 5.3
- Clang 3.5.0
Known not to work with:
- Clang 3.5.0
Known not to work with:
----------------------
Any code in GiNaC should comply to the C++ standard, as defined by ISO/IEC
----------------------
Any code in GiNaC should comply to the C++ standard, as defined by ISO/IEC
-14882:1998(E). Don't use compiler-specific language extensions unless they
+14882:2011(E). Don't use compiler-specific language extensions unless they
are surrounded by appropriate "#ifdef"s, and you also provide a compliant
version of the code in question for other compilers.
are surrounded by appropriate "#ifdef"s, and you also provide a compliant
version of the code in question for other compilers.
&& ex_to<indexed>(*self).has_dummy_index_for(other[1].op(1))) {
exvector self_indices = ex_to<indexed>(*self).get_indices();
&& ex_to<indexed>(*self).has_dummy_index_for(other[1].op(1))) {
exvector self_indices = ex_to<indexed>(*self).get_indices();
- exvector dummy_indices;
- dummy_indices.push_back(other[0].op(1));
- dummy_indices.push_back(other[1].op(1));
+ exvector dummy_indices = {other[0].op(1), other[1].op(1)};
int sig;
ex a = permute_free_index_to_front(self_indices, dummy_indices, sig);
*self = numeric(5, 6);
int sig;
ex a = permute_free_index_to_front(self_indices, dummy_indices, sig);
*self = numeric(5, 6);
&& ex_to<indexed>(*self).has_dummy_index_for(other[1].op(1))) {
exvector self_indices = ex_to<indexed>(*self).get_indices();
&& ex_to<indexed>(*self).has_dummy_index_for(other[1].op(1))) {
exvector self_indices = ex_to<indexed>(*self).get_indices();
- exvector dummy_indices;
- dummy_indices.push_back(other[0].op(1));
- dummy_indices.push_back(other[1].op(1));
+ exvector dummy_indices = {other[0].op(1), other[1].op(1)};
int sig;
ex a = permute_free_index_to_front(self_indices, dummy_indices, sig);
*self = numeric(3, 2) * sig * I;
int sig;
ex a = permute_free_index_to_front(self_indices, dummy_indices, sig);
*self = numeric(3, 2) * sig * I;
void expairseq::construct_from_2_ex_via_exvector(const ex &lh, const ex &rh)
{
void expairseq::construct_from_2_ex_via_exvector(const ex &lh, const ex &rh)
{
- exvector v;
- v.reserve(2);
- v.push_back(lh);
- v.push_back(rh);
- construct_from_exvector(v);
+ const exvector v = {lh, rh};
+ construct_from_exvector(std::move(v));
}
void expairseq::construct_from_2_ex(const ex &lh, const ex &rh)
}
void expairseq::construct_from_2_ex(const ex &lh, const ex &rh)
return x;
sort(dummies_of_factor.begin(), dummies_of_factor.end(), ex_is_less());
ex new_factor = rename_dummy_indices_uniquely(used_indices,
return x;
sort(dummies_of_factor.begin(), dummies_of_factor.end(), ex_is_less());
ex new_factor = rename_dummy_indices_uniquely(used_indices,
combine_indices(dummies_of_factor);
return new_factor;
}
combine_indices(dummies_of_factor);
return new_factor;
}
{
exvector new_dummy_indices;
set_union(used_indices.begin(), used_indices.end(),
{
exvector new_dummy_indices;
set_union(used_indices.begin(), used_indices.end(),
- dummies_of_factor.begin(), dummies_of_factor.end(),
- std::back_insert_iterator<exvector>(new_dummy_indices), ex_is_less());
+ dummies_of_factor.begin(), dummies_of_factor.end(),
+ std::back_insert_iterator<exvector>(new_dummy_indices), ex_is_less());
used_indices.swap(new_dummy_indices);
}
bool do_renaming;
used_indices.swap(new_dummy_indices);
}
bool do_renaming;
- list<umodpoly> factors;
- factors.push_back(a);
+ list<umodpoly> factors = {a};
unsigned int size = 1;
unsigned int r = 1;
unsigned int q = cl_I_to_uint(R->modulus);
unsigned int size = 1;
unsigned int r = 1;
unsigned int q = cl_I_to_uint(R->modulus);
div(*u, g, uo);
if ( equal_one(uo) ) {
throw logic_error("berlekamp: unexpected divisor.");
div(*u, g, uo);
if ( equal_one(uo) ) {
throw logic_error("berlekamp: unexpected divisor.");
*u = uo;
}
factors.push_back(g);
*u = uo;
}
factors.push_back(g);
umodpoly ap;
expt_1_over_p(a, prime, ap);
size_t previ = mult.size();
umodpoly ap;
expt_1_over_p(a, prime, ap);
size_t previ = mult.size();
for ( size_t i=0; i<degrees.size(); ++i ) {
if ( degrees[i] == degree(ddfactors[i]) ) {
upv.push_back(ddfactors[i]);
for ( size_t i=0; i<degrees.size(); ++i ) {
if ( degrees[i] == degree(ddfactors[i]) ) {
upv.push_back(ddfactors[i]);
berlekamp(ddfactors[i], upv);
}
}
berlekamp(ddfactors[i], upv);
}
}
if ( alpha != 1 ) {
w = w / alpha;
}
if ( alpha != 1 ) {
w = w / alpha;
}
static unsigned int next_prime(unsigned int p)
{
static vector<unsigned int> primes;
static unsigned int next_prime(unsigned int p)
{
static vector<unsigned int> primes;
- if ( primes.size() == 0 ) {
- primes.push_back(3); primes.push_back(5); primes.push_back(7);
+ if (primes.empty()) {
+ primes = {3, 5, 7};
}
if ( p >= primes.back() ) {
unsigned int candidate = primes.back() + 2;
while ( true ) {
size_t n = primes.size()/2;
for ( size_t i=0; i<n; ++i ) {
}
if ( p >= primes.back() ) {
unsigned int candidate = primes.back() + 2;
while ( true ) {
size_t n = primes.size()/2;
for ( size_t i=0; i<n; ++i ) {
- if ( candidate % primes[i] ) continue;
+ if (candidate % primes[i])
+ continue;
candidate += 2;
i=-1;
}
primes.push_back(candidate);
candidate += 2;
i=-1;
}
primes.push_back(candidate);
- if ( candidate > p ) break;
+ if (candidate > p)
+ break;
if ( len > n/2 ) return false;
fill(k.begin(), k.begin()+len, 1);
fill(k.begin()+len+1, k.end(), 0);
if ( len > n/2 ) return false;
fill(k.begin(), k.begin()+len, 1);
fill(k.begin()+len+1, k.end(), 0);
k[last++] = 0;
k[last] = 1;
}
k[last++] = 0;
k[last] = 1;
}
if ( d ) {
if ( cache[pos].size() >= d ) {
lr[group] = lr[group] * cache[pos][d-1];
if ( d ) {
if ( cache[pos].size() >= d ) {
lr[group] = lr[group] * cache[pos][d-1];
if ( cache[pos].size() == 0 ) {
cache[pos].push_back(factors[pos] * factors[pos+1]);
}
if ( cache[pos].size() == 0 ) {
cache[pos].push_back(factors[pos] * factors[pos+1]);
}
}
lr[group] = lr[group] * cache[pos].back();
}
}
lr[group] = lr[group] * cache[pos].back();
}
lr[group] = lr[group] * factors[pos];
}
} while ( i < n );
lr[group] = lr[group] * factors[pos];
}
} while ( i < n );
lr[1] = one;
if ( n > 6 ) {
split_cached();
lr[1] = one;
if ( n > 6 ) {
split_cached();
for ( size_t i=0; i<n; ++i ) {
lr[k[i]] = lr[k[i]] * factors[i];
}
for ( size_t i=0; i<n; ++i ) {
lr[k[i]] = lr[k[i]] * factors[i];
}
minfactors = trialfactors.size();
lastp = prime;
trials = 1;
minfactors = trialfactors.size();
lastp = prime;
trials = 1;
upvec newfactors1(part.size_left()), newfactors2(part.size_right());
auto i1 = newfactors1.begin(), i2 = newfactors2.begin();
for ( size_t i=0; i<n; ++i ) {
if ( part[i] ) {
*i2++ = tocheck.top().factors[i];
upvec newfactors1(part.size_left()), newfactors2(part.size_right());
auto i1 = newfactors1.begin(), i2 = newfactors2.begin();
for ( size_t i=0; i<n; ++i ) {
if ( part[i] ) {
*i2++ = tocheck.top().factors[i];
*i1++ = tocheck.top().factors[i];
}
}
*i1++ = tocheck.top().factors[i];
}
}
tocheck.push(mf);
break;
}
tocheck.push(mf);
break;
}
// not successful
if ( !part.next() ) {
// if no more combinations left, return polynomial as
// not successful
if ( !part.next() ) {
// if no more combinations left, return polynomial as
rem(bmod, a[j], buf);
result.push_back(buf);
}
rem(bmod, a[j], buf);
result.push_back(buf);
}
umodpoly s, t;
eea_lift(a[1], a[0], x, p, k, s, t);
umodpoly bmod = umodpoly_to_umodpoly(s, R, m);
umodpoly s, t;
eea_lift(a[1], a[0], x, p, k, s, t);
umodpoly bmod = umodpoly_to_umodpoly(s, R, m);
numeric n(R->retract(emod));
if ( n > halfmod ) {
return n-mod;
numeric n(R->retract(emod));
if ( n > halfmod ) {
return n-mod;
e = make_modular(buf, R);
}
}
e = make_modular(buf, R);
}
}
upvec amod;
for ( size_t i=0; i<a.size(); ++i ) {
umodpoly up;
upvec amod;
for ( size_t i=0; i<a.size(); ++i ) {
umodpoly up;
if ( is_a<add>(c) ) {
nterms = c.nops();
z = c.op(0);
if ( is_a<add>(c) ) {
nterms = c.nops();
z = c.op(0);
res.append(U[i]);
}
return res;
res.append(U[i]);
}
return res;
for ( size_t i=1; i<ufaclst.nops(); ++i ) {
C[i-1] = ufaclst.op(i).lcoeff(x);
}
for ( size_t i=1; i<ufaclst.nops(); ++i ) {
C[i-1] = ufaclst.op(i).lcoeff(x);
}
// difficult case.
// we use the property of the ftilde having a unique prime factor.
// details can be found in [Wan].
// difficult case.
// we use the property of the ftilde having a unique prime factor.
// details can be found in [Wan].
}
C[i] = D[i] * prefac;
}
}
C[i] = D[i] * prefac;
}
for ( int i=0; i<factor_count; ++i ) {
numeric prefac = ex_to<numeric>(ufaclst.op(i+1).lcoeff(x));
for ( int j=ftilde.size()-1; j>=0; --j ) {
for ( int i=0; i<factor_count; ++i ) {
numeric prefac = ex_to<numeric>(ufaclst.op(i+1).lcoeff(x));
for ( int j=ftilde.size()-1; j>=0; --j ) {
int ld = poly.ldegree(x);
ex res = factor_univariate(expand(poly/pow(x, ld)), x);
return res * pow(x,ld);
int ld = poly.ldegree(x);
ex res = factor_univariate(expand(poly/pow(x, ld)), x);
return res * pow(x,ld);
ex res = factor_univariate(poly, x);
return res;
}
ex res = factor_univariate(poly, x);
return res;
}
for ( size_t i=0; i<e.nops(); ++i ) {
if ( e.op(i).info(info_flags::polynomial) ) {
s1 += e.op(i);
for ( size_t i=0; i<e.nops(); ++i ) {
if ( e.op(i).info(info_flags::polynomial) ) {
s1 += e.op(i);
const ex& base = t.op(0);
if ( !is_a<add>(base) ) {
res *= t;
const ex& base = t.op(0);
if ( !is_a<add>(base) ) {
res *= t;
ex f = factor_sqrfree(base);
res *= pow(f, t.op(1));
}
ex f = factor_sqrfree(base);
res *= pow(f, t.op(1));
}
- }
- else if ( is_a<add>(t) ) {
+ } else if ( is_a<add>(t) ) {
ex f = factor_sqrfree(t);
res *= f;
ex f = factor_sqrfree(t);
res *= f;
{
use_return_type = true;
return_type = rt;
{
use_return_type = true;
return_type = rt;
return_type_tinfo = *rtt;
else
return_type_tinfo = make_return_type_t<function>();
return_type_tinfo = *rtt;
else
return_type_tinfo = make_return_type_t<function>();
// Something has changed while sorting arguments, more evaluations later
if (sig == 0)
return _ex0;
// Something has changed while sorting arguments, more evaluations later
if (sig == 0)
return _ex0;
- return ex(sig) * thiscontainer(v);
+ return ex(sig) * thiscontainer(std::move(v));
{
if ((is_a<numeric>(exp) && ex_to<numeric>(exp).is_even()) || exp.info(info_flags::even)) {
if (arg.info(info_flags::real) || arg.is_equal(arg.conjugate()))
{
if ((is_a<numeric>(exp) && ex_to<numeric>(exp).is_even()) || exp.info(info_flags::even)) {
if (arg.info(info_flags::real) || arg.is_equal(arg.conjugate()))
- return power(arg, exp);
- return power(arg, exp/2)*power(arg.conjugate(), exp/2);
+ return pow(arg, exp/2) * pow(arg.conjugate(), exp/2);
} else
return power(abs(arg), exp).hold();
}
} else
return power(abs(arg), exp).hold();
}
// in this case n more (or less) terms are needed
// (sadly, to generate them, we have to start from the beginning)
if (n == 0 && coeff == 1) {
// in this case n more (or less) terms are needed
// (sadly, to generate them, we have to start from the beginning)
if (n == 0 && coeff == 1) {
- epvector epv;
- ex acc = dynallocate<pseries>(rel, epv);
- epv.reserve(2);
- epv.push_back(expair(-1, _ex0));
- epv.push_back(expair(Order(_ex1), order));
- ex rest = pseries(rel, std::move(epv)).add_series(argser);
+ ex rest = pseries(rel, epvector{expair(-1, _ex0), expair(Order(_ex1), order)}).add_series(argser);
+ ex acc = dynallocate<pseries>(rel, epvector());
for (int i = order-1; i>0; --i) {
epvector cterm { expair(i%2 ? _ex1/i : _ex_1/i, _ex0) };
acc = pseries(rel, std::move(cterm)).add_series(ex_to<pseries>(acc));
for (int i = order-1; i>0; --i) {
epvector cterm { expair(i%2 ? _ex1/i : _ex_1/i, _ex0) };
acc = pseries(rel, std::move(cterm)).add_series(ex_to<pseries>(acc));
distrseq.push_back(addref.combine_pair_with_coeff_to_pair(it, overall_coeff));
}
return dynallocate<add>(std::move(distrseq),
distrseq.push_back(addref.combine_pair_with_coeff_to_pair(it, overall_coeff));
}
return dynallocate<add>(std::move(distrseq),
- ex_to<numeric>(addref.overall_coeff).mul_dyn(ex_to<numeric>(overall_coeff)))
+ ex_to<numeric>(addref.overall_coeff).mul_dyn(ex_to<numeric>(overall_coeff)))
.setflag(status_flags::evaluated);
} else if ((seq_size >= 2) && (! (flags & status_flags::expanded))) {
// Strip the content and the unit part from each term. Thus
.setflag(status_flags::evaluated);
} else if ((seq_size >= 2) && (! (flags & status_flags::expanded))) {
// Strip the content and the unit part from each term. Thus
add & primitive = dynallocate<add>(addref);
primitive.clearflag(status_flags::hash_calculated);
primitive.overall_coeff = ex_to<numeric>(primitive.overall_coeff).div_dyn(c);
add & primitive = dynallocate<add>(addref);
primitive.clearflag(status_flags::hash_calculated);
primitive.overall_coeff = ex_to<numeric>(primitive.overall_coeff).div_dyn(c);
- for (epvector::iterator ai = primitive.seq.begin(); ai != primitive.seq.end(); ++ai)
- ai->coeff = ex_to<numeric>(ai->coeff).div_dyn(c);
-
+ for (auto & ai : primitive.seq)
+ ai.coeff = ex_to<numeric>(ai.coeff).div_dyn(c);
+
s.push_back(expair(primitive, _ex1));
++i;
s.push_back(expair(primitive, _ex1));
++i;
ex mul::evalf(int level) const
{
if (level==1)
ex mul::evalf(int level) const
{
if (level==1)
- return mul(seq,overall_coeff);
+ return mul(seq, overall_coeff);
if (level==-max_recursion_level)
throw(std::runtime_error("max recursion level reached"));
if (level==-max_recursion_level)
throw(std::runtime_error("max recursion level reached"));
subsed[j] = true;
ex subsed_pattern
= it.first.subs(repls, subs_options::no_pattern);
subsed[j] = true;
ex subsed_pattern
= it.first.subs(repls, subs_options::no_pattern);
- divide_by *= power(subsed_pattern, nummatches);
+ divide_by *= pow(subsed_pattern, nummatches);
ex subsed_result
= it.second.subs(repls, subs_options::no_pattern);
ex subsed_result
= it.second.subs(repls, subs_options::no_pattern);
- multiply_by *= power(subsed_result, nummatches);
+ multiply_by *= pow(subsed_result, nummatches);
subsed[j] = true;
ex subsed_pattern
= it.first.subs(repls, subs_options::no_pattern);
subsed[j] = true;
ex subsed_pattern
= it.first.subs(repls, subs_options::no_pattern);
- divide_by *= power(subsed_pattern, nummatches);
+ divide_by *= pow(subsed_pattern, nummatches);
ex subsed_result
= it.second.subs(repls, subs_options::no_pattern);
ex subsed_result
= it.second.subs(repls, subs_options::no_pattern);
- multiply_by *= power(subsed_result, nummatches);
+ multiply_by *= pow(subsed_result, nummatches);
auto i = seq.begin(), end = seq.end();
auto i2 = mulseq.begin();
while (i != end) {
auto i = seq.begin(), end = seq.end();
auto i2 = mulseq.begin();
while (i != end) {
- expair ep = split_ex_to_pair(power(i->rest, i->coeff - _ex1) *
+ expair ep = split_ex_to_pair(pow(i->rest, i->coeff - _ex1) *
i->rest.diff(s));
ep.swap(*i2);
addseq.push_back(dynallocate<mul>(mulseq, overall_coeff * i->coeff));
i->rest.diff(s));
ep.swap(*i2);
addseq.push_back(dynallocate<mul>(mulseq, overall_coeff * i->coeff));
if (c.is_equal(_ex1))
return split_ex_to_pair(e);
if (c.is_equal(_ex1))
return split_ex_to_pair(e);
- return split_ex_to_pair(power(e,c));
+ return split_ex_to_pair(pow(e,c));
}
expair mul::combine_pair_with_coeff_to_pair(const expair & p,
}
expair mul::combine_pair_with_coeff_to_pair(const expair & p,
if (c.is_equal(_ex1))
return p;
if (c.is_equal(_ex1))
return p;
- return split_ex_to_pair(power(recombine_pair_to_ex(p),c));
+ return split_ex_to_pair(pow(recombine_pair_to_ex(p),c));
}
ex mul::recombine_pair_to_ex(const expair & p) const
}
ex mul::recombine_pair_to_ex(const expair & p) const
ex mul::expand(unsigned options) const
{
ex mul::expand(unsigned options) const
{
- {
- // trivial case: expanding the monomial (~ 30% of all calls)
- epvector::const_iterator i = seq.begin(), seq_end = seq.end();
- while ((i != seq.end()) && is_a<symbol>(i->rest) && i->coeff.info(info_flags::integer))
- ++i;
- if (i == seq_end) {
- setflag(status_flags::expanded);
- return *this;
+ // Check for trivial case: expanding the monomial (~ 30% of all calls)
+ bool monomial_case = true;
+ for (const auto & i : seq) {
+ if (!is_a<symbol>(i.rest) || !i.coeff.info(info_flags::integer)) {
+ monomial_case = false;
+ break;
+ if (monomial_case) {
+ setflag(status_flags::expanded);
+ return *this;
+ }
// do not rename indices if the object has no indices at all
if ((!(options & expand_options::expand_rename_idx)) &&
// do not rename indices if the object has no indices at all
if ((!(options & expand_options::expand_rename_idx)) &&
- this->info(info_flags::has_indices))
+ this->info(info_flags::has_indices))
options |= expand_options::expand_rename_idx;
const bool skip_idx_rename = !(options & expand_options::expand_rename_idx);
options |= expand_options::expand_rename_idx;
const bool skip_idx_rename = !(options & expand_options::expand_rename_idx);
if (!divide(rcoeff, blcoeff, term, false))
return dynallocate<fail>();
}
if (!divide(rcoeff, blcoeff, term, false))
return dynallocate<fail>();
}
- term *= power(x, rdeg - bdeg);
+ term *= pow(x, rdeg - bdeg);
v.push_back(term);
r -= (term * b).expand();
if (r.is_zero())
v.push_back(term);
r -= (term * b).expand();
if (r.is_zero())
if (!divide(rcoeff, blcoeff, term, false))
return dynallocate<fail>();
}
if (!divide(rcoeff, blcoeff, term, false))
return dynallocate<fail>();
}
- term *= power(x, rdeg - bdeg);
+ term *= pow(x, rdeg - bdeg);
r -= (term * b).expand();
if (r.is_zero())
break;
r -= (term * b).expand();
if (r.is_zero())
break;
if (bdeg == 0)
eb = _ex0;
else
if (bdeg == 0)
eb = _ex0;
else
- eb -= blcoeff * power(x, bdeg);
+ eb -= blcoeff * pow(x, bdeg);
} else
blcoeff = _ex1;
int delta = rdeg - bdeg + 1, i = 0;
while (rdeg >= bdeg && !r.is_zero()) {
ex rlcoeff = r.coeff(x, rdeg);
} else
blcoeff = _ex1;
int delta = rdeg - bdeg + 1, i = 0;
while (rdeg >= bdeg && !r.is_zero()) {
ex rlcoeff = r.coeff(x, rdeg);
- ex term = (power(x, rdeg - bdeg) * eb * rlcoeff).expand();
+ ex term = (pow(x, rdeg - bdeg) * eb * rlcoeff).expand();
if (rdeg == 0)
r = _ex0;
else
if (rdeg == 0)
r = _ex0;
else
- r -= rlcoeff * power(x, rdeg);
+ r -= rlcoeff * pow(x, rdeg);
r = (blcoeff * r).expand() - term;
rdeg = r.degree(x);
i++;
}
r = (blcoeff * r).expand() - term;
rdeg = r.degree(x);
i++;
}
- return power(blcoeff, delta - i) * r;
+ return pow(blcoeff, delta - i) * r;
if (bdeg == 0)
eb = _ex0;
else
if (bdeg == 0)
eb = _ex0;
else
- eb -= blcoeff * power(x, bdeg);
+ eb -= blcoeff * pow(x, bdeg);
} else
blcoeff = _ex1;
while (rdeg >= bdeg && !r.is_zero()) {
ex rlcoeff = r.coeff(x, rdeg);
} else
blcoeff = _ex1;
while (rdeg >= bdeg && !r.is_zero()) {
ex rlcoeff = r.coeff(x, rdeg);
- ex term = (power(x, rdeg - bdeg) * eb * rlcoeff).expand();
+ ex term = (pow(x, rdeg - bdeg) * eb * rlcoeff).expand();
if (rdeg == 0)
r = _ex0;
else
if (rdeg == 0)
r = _ex0;
else
- r -= rlcoeff * power(x, rdeg);
+ r -= rlcoeff * pow(x, rdeg);
r = (blcoeff * r).expand() - term;
rdeg = r.degree(x);
}
r = (blcoeff * r).expand() - term;
rdeg = r.degree(x);
}
int a_exp = ex_to<numeric>(a.op(1)).to_int();
ex rem_i;
if (divide(ab, b, rem_i, false)) {
int a_exp = ex_to<numeric>(a.op(1)).to_int();
ex rem_i;
if (divide(ab, b, rem_i, false)) {
- q = rem_i*power(ab, a_exp - 1);
+ q = rem_i * pow(ab, a_exp - 1);
return true;
}
// code below is commented-out because it leads to a significant slowdown
return true;
}
// code below is commented-out because it leads to a significant slowdown
else
if (!divide(rcoeff, blcoeff, term, false))
return false;
else
if (!divide(rcoeff, blcoeff, term, false))
return false;
- term *= power(x, rdeg - bdeg);
+ term *= pow(x, rdeg - bdeg);
v.push_back(term);
r -= (term * b).expand();
if (r.is_zero()) {
v.push_back(term);
r -= (term * b).expand();
if (r.is_zero()) {
ex term, rcoeff = r.coeff(x, rdeg);
if (!divide_in_z(rcoeff, blcoeff, term, var+1))
break;
ex term, rcoeff = r.coeff(x, rdeg);
if (!divide_in_z(rcoeff, blcoeff, term, var+1))
break;
- term = (term * power(x, rdeg - bdeg)).expand();
+ term = (term * pow(x, rdeg - bdeg)).expand();
v.push_back(term);
r -= (term * eb).expand();
if (r.is_zero()) {
v.push_back(term);
r -= (term * eb).expand();
if (r.is_zero()) {
numeric rxi = xi.inverse();
for (int i=0; !e.is_zero(); i++) {
ex gi = e.smod(xi);
numeric rxi = xi.inverse();
for (int i=0; !e.is_zero(); i++) {
ex gi = e.smod(xi);
- g.push_back(gi * power(x, i));
+ g.push_back(gi * pow(x, i));
e = (e - gi) * rxi;
}
return dynallocate<add>(g);
e = (e - gi) * rxi;
}
return dynallocate<add>(g);
int ldeg_b = var->ldeg_b;
int min_ldeg = std::min(ldeg_a,ldeg_b);
if (min_ldeg > 0) {
int ldeg_b = var->ldeg_b;
int min_ldeg = std::min(ldeg_a,ldeg_b);
if (min_ldeg > 0) {
- ex common = power(x, min_ldeg);
+ ex common = pow(x, min_ldeg);
return gcd((aex / common).expand(), (bex / common).expand(), ca, cb, false) * common;
}
return gcd((aex / common).expand(), (bex / common).expand(), ca, cb, false) * common;
}
if (ca)
*ca = _ex1;
if (cb)
if (ca)
*ca = _ex1;
if (cb)
- *cb = power(p, exp_b - exp_a);
- return power(p, exp_a);
+ *cb = pow(p, exp_b - exp_a);
+ return pow(p, exp_a);
- *ca = power(p, exp_a - exp_b);
+ *ca = pow(p, exp_a - exp_b);
- return power(p, exp_b);
// a(x) = g(x)^n A(x)^n, b(x) = g(x)^m B(x)^m ==>
// gcd(a, b) = g(x)^n gcd(A(x)^n, g(x)^(n-m) B(x)^m
if (exp_a < exp_b) {
// a(x) = g(x)^n A(x)^n, b(x) = g(x)^m B(x)^m ==>
// gcd(a, b) = g(x)^n gcd(A(x)^n, g(x)^(n-m) B(x)^m
if (exp_a < exp_b) {
- ex pg = gcd(power(p_co, exp_a), power(p_gcd, exp_b-exp_a)*power(pb_co, exp_b), ca, cb, false);
- return power(p_gcd, exp_a)*pg;
+ ex pg = gcd(pow(p_co, exp_a), pow(p_gcd, exp_b-exp_a)*pow(pb_co, exp_b), ca, cb, false);
+ return pow(p_gcd, exp_a)*pg;
- ex pg = gcd(power(p_gcd, exp_a - exp_b)*power(p_co, exp_a), power(pb_co, exp_b), ca, cb, false);
- return power(p_gcd, exp_b)*pg;
+ ex pg = gcd(pow(p_gcd, exp_a - exp_b)*pow(p_co, exp_a), pow(pb_co, exp_b), ca, cb, false);
+ return pow(p_gcd, exp_b)*pg;
if (p.is_equal(b)) {
// a = p^n, b = p, gcd = p
if (ca)
if (p.is_equal(b)) {
// a = p^n, b = p, gcd = p
if (ca)
- *ca = power(p, a.op(1) - 1);
+ *ca = pow(p, a.op(1) - 1);
if (cb)
*cb = _ex1;
return p;
if (cb)
*cb = _ex1;
return p;
return _ex1;
}
// a(x) = g(x)^n A(x)^n, b(x) = g(x) B(x) ==> gcd(a, b) = g(x) gcd(g(x)^(n-1) A(x)^n, B(x))
return _ex1;
}
// a(x) = g(x)^n A(x)^n, b(x) = g(x) B(x) ==> gcd(a, b) = g(x) gcd(g(x)^(n-1) A(x)^n, B(x))
- ex rg = gcd(power(p_gcd, exp_a-1)*power(p_co, exp_a), bpart_co, ca, cb, false);
+ ex rg = gcd(pow(p_gcd, exp_a-1)*pow(p_co, exp_a), bpart_co, ca, cb, false);
ex result = _ex1;
int p = 1;
for (auto & it : factors)
ex result = _ex1;
int p = 1;
for (auto & it : factors)
- result *= power(it, p++);
+ result *= pow(it, p++);
// Yun's algorithm does not account for constant factors. (For univariate
// polynomials it works only in the monic case.) We can correct this by
// Yun's algorithm does not account for constant factors. (For univariate
// polynomials it works only in the monic case.) We can correct this by
if (n_exponent.info(info_flags::positive)) {
// (a/b)^n -> {a^n, b^n}
if (n_exponent.info(info_flags::positive)) {
// (a/b)^n -> {a^n, b^n}
- return dynallocate<lst>({power(n_basis.op(0), n_exponent), power(n_basis.op(1), n_exponent)});
+ return dynallocate<lst>({pow(n_basis.op(0), n_exponent), pow(n_basis.op(1), n_exponent)});
} else if (n_exponent.info(info_flags::negative)) {
// (a/b)^-n -> {b^n, a^n}
} else if (n_exponent.info(info_flags::negative)) {
// (a/b)^-n -> {b^n, a^n}
- return dynallocate<lst>({power(n_basis.op(1), -n_exponent), power(n_basis.op(0), -n_exponent)});
+ return dynallocate<lst>({pow(n_basis.op(1), -n_exponent), pow(n_basis.op(0), -n_exponent)});
if (n_exponent.info(info_flags::positive)) {
// (a/b)^x -> {sym((a/b)^x), 1}
if (n_exponent.info(info_flags::positive)) {
// (a/b)^x -> {sym((a/b)^x), 1}
- return dynallocate<lst>({replace_with_symbol(power(n_basis.op(0) / n_basis.op(1), n_exponent), repl, rev_lookup), _ex1});
+ return dynallocate<lst>({replace_with_symbol(pow(n_basis.op(0) / n_basis.op(1), n_exponent), repl, rev_lookup), _ex1});
} else if (n_exponent.info(info_flags::negative)) {
if (n_basis.op(1).is_equal(_ex1)) {
// a^-x -> {1, sym(a^x)}
} else if (n_exponent.info(info_flags::negative)) {
if (n_basis.op(1).is_equal(_ex1)) {
// a^-x -> {1, sym(a^x)}
- return dynallocate<lst>({_ex1, replace_with_symbol(power(n_basis.op(0), -n_exponent), repl, rev_lookup)});
+ return dynallocate<lst>({_ex1, replace_with_symbol(pow(n_basis.op(0), -n_exponent), repl, rev_lookup)});
} else {
// (a/b)^-x -> {sym((b/a)^x), 1}
} else {
// (a/b)^-x -> {sym((b/a)^x), 1}
- return dynallocate<lst>({replace_with_symbol(power(n_basis.op(1) / n_basis.op(0), -n_exponent), repl, rev_lookup), _ex1});
+ return dynallocate<lst>({replace_with_symbol(pow(n_basis.op(1) / n_basis.op(0), -n_exponent), repl, rev_lookup), _ex1});
}
}
}
// (a/b)^x -> {sym((a/b)^x, 1}
}
}
}
// (a/b)^x -> {sym((a/b)^x, 1}
- return dynallocate<lst>({replace_with_symbol(power(n_basis.op(0) / n_basis.op(1), n_exponent), repl, rev_lookup), _ex1});
+ return dynallocate<lst>({replace_with_symbol(pow(n_basis.op(0) / n_basis.op(1), n_exponent), repl, rev_lookup), _ex1});
ex power::to_rational(exmap & repl) const
{
if (exponent.info(info_flags::integer))
ex power::to_rational(exmap & repl) const
{
if (exponent.info(info_flags::integer))
- return power(basis.to_rational(repl), exponent);
+ return pow(basis.to_rational(repl), exponent);
else
return replace_with_symbol(*this, repl);
}
else
return replace_with_symbol(*this, repl);
}
ex power::to_polynomial(exmap & repl) const
{
if (exponent.info(info_flags::posint))
ex power::to_polynomial(exmap & repl) const
{
if (exponent.info(info_flags::posint))
- return power(basis.to_rational(repl), exponent);
+ return pow(basis.to_rational(repl), exponent);
else if (exponent.info(info_flags::negint))
{
ex basis_pref = collect_common_factors(basis);
if (is_exactly_a<mul>(basis_pref) || is_exactly_a<power>(basis_pref)) {
// (A*B)^n will be automagically transformed to A^n*B^n
else if (exponent.info(info_flags::negint))
{
ex basis_pref = collect_common_factors(basis);
if (is_exactly_a<mul>(basis_pref) || is_exactly_a<power>(basis_pref)) {
// (A*B)^n will be automagically transformed to A^n*B^n
- ex t = power(basis_pref, exponent);
+ ex t = pow(basis_pref, exponent);
return t.to_polynomial(repl);
}
else
return t.to_polynomial(repl);
}
else
- return power(replace_with_symbol(power(basis, _ex_1), repl), -exponent);
+ return pow(replace_with_symbol(pow(basis, _ex_1), repl), -exponent);
}
else
return replace_with_symbol(*this, repl);
}
else
return replace_with_symbol(*this, repl);
ex eb = e.op(0).to_polynomial(repl);
ex factor_local(_ex1);
ex pre_res = find_common_factor(eb, factor_local, repl);
ex eb = e.op(0).to_polynomial(repl);
ex factor_local(_ex1);
ex pre_res = find_common_factor(eb, factor_local, repl);
- factor *= power(factor_local, e_exp);
- return power(pre_res, e_exp);
+ factor *= pow(factor_local, e_exp);
+ return pow(pre_res, e_exp);
} else
return e.to_polynomial(repl);
} else
return e.to_polynomial(repl);
-/** Used internally by operator+() to add two ex objects together. */
+/** Used internally by operator+() to add two ex objects. */
static inline const ex exadd(const ex & lh, const ex & rh)
{
return dynallocate<add>(lh, rh);
}
static inline const ex exadd(const ex & lh, const ex & rh)
{
return dynallocate<add>(lh, rh);
}
-/** Used internally by operator*() to multiply two ex objects together. */
+/** Used internally by operator*() to multiply two ex objects. */
static inline const ex exmul(const ex & lh, const ex & rh)
{
// Check if we are constructing a mul object or a ncmul object. Due to
static inline const ex exmul(const ex & lh, const ex & rh)
{
// Check if we are constructing a mul object or a ncmul object. Due to
const relational operator==(const ex & lh, const ex & rh)
{
const relational operator==(const ex & lh, const ex & rh)
{
- return relational(lh,rh,relational::equal);
+ return dynallocate<relational>(lh, rh, relational::equal);
}
const relational operator!=(const ex & lh, const ex & rh)
{
}
const relational operator!=(const ex & lh, const ex & rh)
{
- return relational(lh,rh,relational::not_equal);
+ return dynallocate<relational>(lh, rh, relational::not_equal);
}
const relational operator<(const ex & lh, const ex & rh)
{
}
const relational operator<(const ex & lh, const ex & rh)
{
- return relational(lh,rh,relational::less);
+ return dynallocate<relational>(lh, rh, relational::less);
}
const relational operator<=(const ex & lh, const ex & rh)
{
}
const relational operator<=(const ex & lh, const ex & rh)
{
- return relational(lh,rh,relational::less_or_equal);
+ return dynallocate<relational>(lh, rh, relational::less_or_equal);
}
const relational operator>(const ex & lh, const ex & rh)
{
}
const relational operator>(const ex & lh, const ex & rh)
{
- return relational(lh,rh,relational::greater);
+ return dynallocate<relational>(lh, rh, relational::greater);
}
const relational operator>=(const ex & lh, const ex & rh)
{
}
const relational operator>=(const ex & lh, const ex & rh)
{
- return relational(lh,rh,relational::greater_or_equal);
+ return dynallocate<relational>(lh, rh, relational::greater_or_equal);
}
// input/output stream operators and manipulators
}
// input/output stream operators and manipulators
"expression has " << exp_vector.size() << " instead");
if (exp_vector[j] != 0)
"expression has " << exp_vector.size() << " instead");
if (exp_vector[j] != 0)
- tv.push_back(power(vars[j], exp_vector[j]));
+ tv.push_back(pow(vars[j], exp_vector[j]));
}
tv.push_back(ec[i].second);
ex tmp = dynallocate<mul>(tv);
}
tv.push_back(ec[i].second);
ex tmp = dynallocate<mul>(tv);
// Turn (x^c)^d into x^(c*d) in the case that x is positive and c is real.
if (is_exactly_a<power>(basis) && basis.op(0).info(info_flags::positive) && basis.op(1).info(info_flags::real))
// Turn (x^c)^d into x^(c*d) in the case that x is positive and c is real.
if (is_exactly_a<power>(basis) && basis.op(0).info(info_flags::positive) && basis.op(1).info(info_flags::real))
- return power(basis.op(0), basis.op(1) * exponent);
+ return dynallocate<power>(basis.op(0), basis.op(1) * exponent);
// because otherwise we'll end up with something like
// (7/8)^(4/3) -> 7/8*(1/2*7^(1/3))
// instead of 7/16*7^(1/3).
// because otherwise we'll end up with something like
// (7/8)^(4/3) -> 7/8*(1/2*7^(1/3))
// instead of 7/16*7^(1/3).
- ex prod = power(*num_basis,r.div(m));
- return prod*power(*num_basis,q);
+ return pow(basis, r.div(m)) * pow(basis, q);
GINAC_ASSERT(num_sub_exponent!=numeric(1));
if (num_exponent->is_integer() || (abs(num_sub_exponent) - (*_num1_p)).is_negative() ||
(num_sub_exponent == *_num_1_p && num_exponent->is_positive())) {
GINAC_ASSERT(num_sub_exponent!=numeric(1));
if (num_exponent->is_integer() || (abs(num_sub_exponent) - (*_num1_p)).is_negative() ||
(num_sub_exponent == *_num_1_p && num_exponent->is_positive())) {
- return power(sub_basis,num_sub_exponent.mul(*num_exponent));
+ return dynallocate<power>(sub_basis, num_sub_exponent.mul(*num_exponent));
}
}
}
// ^(*(x,y,z),c1) -> *(x^c1,y^c1,z^c1) (c1 integer)
if (num_exponent->is_integer() && is_exactly_a<mul>(basis)) {
}
}
}
// ^(*(x,y,z),c1) -> *(x^c1,y^c1,z^c1) (c1 integer)
if (num_exponent->is_integer() && is_exactly_a<mul>(basis)) {
- return expand_mul(ex_to<mul>(basis), *num_exponent, 0);
+ return expand_mul(ex_to<mul>(basis), *num_exponent, false);
}
// (2*x + 6*y)^(-4) -> 1/16*(x + 3*y)^(-4)
}
// (2*x + 6*y)^(-4) -> 1/16*(x + 3*y)^(-4)
- return power(ebasis,eexponent);
+ return dynallocate<power>(ebasis, eexponent);
}
ex power::evalm() const
}
ex power::evalm() const
if (tryfactsubs(*this, it.first, nummatches, repls)) {
ex anum = it.second.subs(repls, subs_options::no_pattern);
ex aden = it.first.subs(repls, subs_options::no_pattern);
if (tryfactsubs(*this, it.first, nummatches, repls)) {
ex anum = it.second.subs(repls, subs_options::no_pattern);
ex aden = it.first.subs(repls, subs_options::no_pattern);
- ex result = (*this)*power(anum/aden, nummatches);
+ ex result = (*this) * pow(anum/aden, nummatches);
return (ex_to<basic>(result)).subs_one_level(m, options);
}
}
return (ex_to<basic>(result)).subs_one_level(m, options);
}
}
// Re((a+I*b)^c) w/ c ∈ ℤ
long N = ex_to<numeric>(c).to_long();
// Use real terms in Binomial expansion to construct
// Re((a+I*b)^c) w/ c ∈ ℤ
long N = ex_to<numeric>(c).to_long();
// Use real terms in Binomial expansion to construct
- // Re(expand(power(a+I*b, N))).
+ // Re(expand(pow(a+I*b, N))).
long NN = N > 0 ? N : -N;
long NN = N > 0 ? N : -N;
- ex numer = N > 0 ? _ex1 : power(power(a,2) + power(b,2), NN);
+ ex numer = N > 0 ? _ex1 : pow(pow(a,2) + pow(b,2), NN);
ex result = 0;
for (long n = 0; n <= NN; n += 2) {
ex result = 0;
for (long n = 0; n <= NN; n += 2) {
- ex term = binomial(NN, n) * power(a, NN-n) * power(b, n) / numer;
+ ex term = binomial(NN, n) * pow(a, NN-n) * pow(b, n) / numer;
if (n % 4 == 0) {
result += term; // sign: I^n w/ n == 4*m
} else {
if (n % 4 == 0) {
result += term; // sign: I^n w/ n == 4*m
} else {
// Re((a+I*b)^(c+I*d))
const ex d = exponent.imag_part();
// Re((a+I*b)^(c+I*d))
const ex d = exponent.imag_part();
- return power(abs(basis),c)*exp(-d*atan2(b,a))*cos(c*atan2(b,a)+d*log(abs(basis)));
+ return pow(abs(basis),c) * exp(-d*atan2(b,a)) * cos(c*atan2(b,a)+d*log(abs(basis)));
}
ex power::imag_part() const
{
}
ex power::imag_part() const
{
+ // basis == a+I*b, exponent == c+I*d
const ex a = basis.real_part();
const ex c = exponent.real_part();
if (basis.is_equal(a) && exponent.is_equal(c)) {
const ex a = basis.real_part();
const ex c = exponent.real_part();
if (basis.is_equal(a) && exponent.is_equal(c)) {
// Im((a+I*b)^c) w/ c ∈ ℤ
long N = ex_to<numeric>(c).to_long();
// Use imaginary terms in Binomial expansion to construct
// Im((a+I*b)^c) w/ c ∈ ℤ
long N = ex_to<numeric>(c).to_long();
// Use imaginary terms in Binomial expansion to construct
- // Im(expand(power(a+I*b, N))).
+ // Im(expand(pow(a+I*b, N))).
long p = N > 0 ? 1 : 3; // modulus for positive sign
long NN = N > 0 ? N : -N;
long p = N > 0 ? 1 : 3; // modulus for positive sign
long NN = N > 0 ? N : -N;
- ex numer = N > 0 ? _ex1 : power(power(a,2) + power(b,2), NN);
+ ex numer = N > 0 ? _ex1 : pow(pow(a,2) + pow(b,2), NN);
ex result = 0;
for (long n = 1; n <= NN; n += 2) {
ex result = 0;
for (long n = 1; n <= NN; n += 2) {
- ex term = binomial(NN, n) * power(a, NN-n) * power(b, n) / numer;
+ ex term = binomial(NN, n) * pow(a, NN-n) * pow(b, n) / numer;
if (n % 4 == p) {
result += term; // sign: I^n w/ n == 4*m+p
} else {
if (n % 4 == p) {
result += term; // sign: I^n w/ n == 4*m+p
} else {
// Im((a+I*b)^(c+I*d))
const ex d = exponent.imag_part();
// Im((a+I*b)^(c+I*d))
const ex d = exponent.imag_part();
- return power(abs(basis),c)*exp(-d*atan2(b,a))*sin(c*atan2(b,a)+d*log(abs(basis)));
+ return pow(abs(basis),c) * exp(-d*atan2(b,a)) * sin(c*atan2(b,a)+d*log(abs(basis)));
{
if (is_a<numeric>(exponent)) {
// D(b^r) = r * b^(r-1) * D(b) (faster than the formula below)
{
if (is_a<numeric>(exponent)) {
// D(b^r) = r * b^(r-1) * D(b) (faster than the formula below)
- epvector newseq;
- newseq.reserve(2);
- newseq.push_back(expair(basis, exponent - _ex1));
- newseq.push_back(expair(basis.diff(s), _ex1));
- return mul(std::move(newseq), exponent);
+ const epvector newseq = {expair(basis, exponent - _ex1), expair(basis.diff(s), _ex1)};
+ return dynallocate<mul>(std::move(newseq), exponent);
} else {
// D(b^e) = b^e * (D(e)*ln(b) + e*D(b)/b)
} else {
// D(b^e) = b^e * (D(e)*ln(b) + e*D(b)/b)
- return mul(*this,
- add(mul(exponent.diff(s), log(basis)),
- mul(mul(exponent, basis.diff(s)), power(basis, _ex_1))));
+ return *this * (exponent.diff(s)*log(basis) + exponent*basis.diff(s)*pow(basis, _ex_1));
// take care on the numeric coefficient
ex coeff=(possign? _ex1 : _ex_1);
if (m.overall_coeff.info(info_flags::positive) && m.overall_coeff != _ex1)
// take care on the numeric coefficient
ex coeff=(possign? _ex1 : _ex_1);
if (m.overall_coeff.info(info_flags::positive) && m.overall_coeff != _ex1)
- prodseq.push_back(power(m.overall_coeff, exponent));
+ prodseq.push_back(pow(m.overall_coeff, exponent));
else if (m.overall_coeff.info(info_flags::negative) && m.overall_coeff != _ex_1)
else if (m.overall_coeff.info(info_flags::negative) && m.overall_coeff != _ex_1)
- prodseq.push_back(power(-m.overall_coeff, exponent));
+ prodseq.push_back(pow(-m.overall_coeff, exponent));
else
coeff *= m.overall_coeff;
else
coeff *= m.overall_coeff;
// In either case we set a flag to avoid the second run on a part
// which does not have positive/negative terms.
if (prodseq.size() > 0) {
// In either case we set a flag to avoid the second run on a part
// which does not have positive/negative terms.
if (prodseq.size() > 0) {
- ex newbasis = coeff*mul(std::move(powseq));
+ ex newbasis = dynallocate<mul>(std::move(powseq), coeff);
ex_to<basic>(newbasis).setflag(status_flags::purely_indefinite);
return dynallocate<mul>(std::move(prodseq)) * pow(newbasis, exponent);
} else
ex_to<basic>(newbasis).setflag(status_flags::purely_indefinite);
return dynallocate<mul>(std::move(prodseq)) * pow(newbasis, exponent);
} else
exvector distrseq;
distrseq.reserve(a.seq.size() + 1);
for (auto & cit : a.seq) {
exvector distrseq;
distrseq.reserve(a.seq.size() + 1);
for (auto & cit : a.seq) {
- distrseq.push_back(power(expanded_basis, a.recombine_pair_to_ex(cit)));
+ distrseq.push_back(pow(expanded_basis, a.recombine_pair_to_ex(cit)));
}
// Make sure that e.g. (x+y)^(2+a) expands the (x+y)^2 factor
}
// Make sure that e.g. (x+y)^(2+a) expands the (x+y)^2 factor
if (int_exponent > 0 && is_exactly_a<add>(expanded_basis))
distrseq.push_back(expand_add(ex_to<add>(expanded_basis), int_exponent, options));
else
if (int_exponent > 0 && is_exactly_a<add>(expanded_basis))
distrseq.push_back(expand_add(ex_to<add>(expanded_basis), int_exponent, options));
else
- distrseq.push_back(power(expanded_basis, a.overall_coeff));
+ distrseq.push_back(pow(expanded_basis, a.overall_coeff));
- distrseq.push_back(power(expanded_basis, a.overall_coeff));
+ distrseq.push_back(pow(expanded_basis, a.overall_coeff));
// Make sure that e.g. (x+y)^(1+a) -> x*(x+y)^a + y*(x+y)^a
ex r = dynallocate<mul>(distrseq);
// Make sure that e.g. (x+y)^(1+a) -> x*(x+y)^a + y*(x+y)^a
ex r = dynallocate<mul>(distrseq);
- Order(power(var-point,i->coeff)).print(c);
+ Order(pow(var - point, i->coeff)).print(c);
throw (std::out_of_range("op() out of range"));
if (is_order_function(seq[i].rest))
throw (std::out_of_range("op() out of range"));
if (is_order_function(seq[i].rest))
- return Order(power(var-point, seq[i].coeff));
- return seq[i].rest * power(var - point, seq[i].coeff);
+ return Order(pow(var-point, seq[i].coeff));
+ return seq[i].rest * pow(var - point, seq[i].coeff);
}
/** Return degree of highest power of the series. This is usually the exponent
}
/** Return degree of highest power of the series. This is usually the exponent
ex newcoeff = i->rest.evalm();
if (!newcoeff.is_zero())
newseq.push_back(expair(newcoeff, i->coeff));
ex newcoeff = i->rest.evalm();
if (!newcoeff.is_zero())
newseq.push_back(expair(newcoeff, i->coeff));
ex newcoeff = i->rest.evalm();
if (!are_ex_trivially_equal(newcoeff, i->rest)) {
something_changed = true;
ex newcoeff = i->rest.evalm();
if (!are_ex_trivially_equal(newcoeff, i->rest)) {
something_changed = true;
for (auto & it : seq) {
if (is_order_function(it.rest)) {
if (!no_order)
for (auto & it : seq) {
if (is_order_function(it.rest)) {
if (!no_order)
- e += Order(power(var - point, it.coeff));
+ e += Order(pow(var - point, it.coeff));
- e += it.rest * power(var - point, it.coeff);
+ e += it.rest * pow(var - point, it.coeff);
int n;
for (n=1; n<order; ++n) {
int n;
for (n=1; n<order; ++n) {
// We need to test for zero in order to see if the series terminates.
// The problem is that there is no such thing as a perfect test for
// zero. Expanding the term occasionally helps a little...
// We need to test for zero in order to see if the series terminates.
// The problem is that there is no such thing as a perfect test for
// zero. Expanding the term occasionally helps a little...
coeff = deriv.subs(r, subs_options::no_pattern);
if (!coeff.is_zero())
coeff = deriv.subs(r, subs_options::no_pattern);
if (!coeff.is_zero())
- seq.push_back(expair(fac.inverse() * coeff, n));
+ seq.push_back(expair(fac * coeff, n));
}
// Higher-order terms, if present
}
// Higher-order terms, if present
// Compute coefficients of the powered series
exvector co;
co.reserve(numcoeff);
// Compute coefficients of the powered series
exvector co;
co.reserve(numcoeff);
- co.push_back(power(coeff(var, ldeg), p));
+ co.push_back(pow(coeff(var, ldeg), p));
for (int i=1; i<numcoeff; ++i) {
ex sum = _ex0;
for (int j=1; j<=i; ++j) {
for (int i=1; i<numcoeff; ++i) {
ex sum = _ex0;
for (int j=1; j<=i; ++j) {