"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ginac/pseries.cpp" between
ginac-1.7.11.tar.bz2 and ginac-1.8.0.tar.bz2

About: GiNaC (GiNaC is Not a CAS (Computer Algebra System)) is a C++ library for symbolic calculations.

pseries.cpp  (ginac-1.7.11.tar.bz2):pseries.cpp  (ginac-1.8.0.tar.bz2)
skipping to change at line 883 skipping to change at line 883
buf = it.rest; buf = it.rest;
factor = ex_to<numeric>(expon).to_int(); factor = ex_to<numeric>(expon).to_int();
} else { } else {
buf = recombine_pair_to_ex(it); buf = recombine_pair_to_ex(it);
} }
int real_ldegree = 0; int real_ldegree = 0;
bool flag_redo = false; bool flag_redo = false;
try { try {
real_ldegree = buf.expand().ldegree(sym-r.rhs()); real_ldegree = buf.expand().ldegree(sym-r.rhs());
} catch (std::runtime_error) {} } catch (std::runtime_error &) {}
if (real_ldegree == 0) { if (real_ldegree == 0) {
if ( factor < 0 ) { if ( factor < 0 ) {
// This case must terminate, otherwise we would h ave division by // This case must terminate, otherwise we would h ave division by
// zero. // zero.
int orderloop = 0; int orderloop = 0;
do { do {
orderloop++; orderloop++;
real_ldegree = buf.series(r, orderloop, o ptions).ldegree(sym); real_ldegree = buf.series(r, orderloop, o ptions).ldegree(sym);
} while (real_ldegree == orderloop); } while (real_ldegree == orderloop);
skipping to change at line 1069 skipping to change at line 1069
ex power::series(const relational & r, int order, unsigned options) const ex power::series(const relational & r, int order, unsigned options) const
{ {
// If basis is already a series, just power it // If basis is already a series, just power it
if (is_exactly_a<pseries>(basis)) if (is_exactly_a<pseries>(basis))
return ex_to<pseries>(basis).power_const(ex_to<numeric>(exponent) , order); return ex_to<pseries>(basis).power_const(ex_to<numeric>(exponent) , order);
// Basis is not a series, may there be a singularity? // Basis is not a series, may there be a singularity?
bool must_expand_basis = false; bool must_expand_basis = false;
try { try {
basis.subs(r, subs_options::no_pattern); basis.subs(r, subs_options::no_pattern);
} catch (pole_error) { } catch (pole_error &) {
must_expand_basis = true; must_expand_basis = true;
} }
bool exponent_is_regular = true; bool exponent_is_regular = true;
try { try {
exponent.subs(r, subs_options::no_pattern); exponent.subs(r, subs_options::no_pattern);
} catch (pole_error) { } catch (pole_error &) {
exponent_is_regular = false; exponent_is_regular = false;
} }
if (!exponent_is_regular) { if (!exponent_is_regular) {
ex l = exponent*log(basis); ex l = exponent*log(basis);
// this == exp(l); // this == exp(l);
ex le = l.series(r, order, options); ex le = l.series(r, order, options);
// Note: expanding exp(l) won't help, since that will attempt // Note: expanding exp(l) won't help, since that will attempt
// Taylor expansion, and fail (because exponent is "singular") // Taylor expansion, and fail (because exponent is "singular")
// Still l itself might be expanded in Taylor series. // Still l itself might be expanded in Taylor series.
skipping to change at line 1145 skipping to change at line 1145
} while (real_ldegree == orderloop); } while (real_ldegree == orderloop);
} }
if (!(real_ldegree*numexp).is_integer()) if (!(real_ldegree*numexp).is_integer())
throw std::runtime_error("pseries::power_const(): trying to assem ble a Puiseux series"); throw std::runtime_error("pseries::power_const(): trying to assem ble a Puiseux series");
ex e = basis.series(r, (order + real_ldegree*(1-numexp)).to_int(), option s); ex e = basis.series(r, (order + real_ldegree*(1-numexp)).to_int(), option s);
ex result; ex result;
try { try {
result = ex_to<pseries>(e).power_const(numexp, order); result = ex_to<pseries>(e).power_const(numexp, order);
} catch (pole_error) { } catch (pole_error &) {
epvector ser { expair(Order(_ex1), order) }; epvector ser { expair(Order(_ex1), order) };
result = pseries(r, std::move(ser)); result = pseries(r, std::move(ser));
} }
return result; return result;
} }
/** Re-expansion of a pseries object. */ /** Re-expansion of a pseries object. */
ex pseries::series(const relational & r, int order, unsigned options) const ex pseries::series(const relational & r, int order, unsigned options) const
{ {
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)