1#ifndef CLASSIC_Taylor_CC
2#define CLASSIC_Taylor_CC
67template<
class T>
inline
74template<
class T>
inline
81template<
class T>
inline
88template<
class T>
inline
95template<
class T>
inline
101template<
class T>
inline
110 std::transform(
begin(),
end(), result.
begin(), std::negate<T>());
118 std::bind(std::multiplies<T>(), std::placeholders::_2, val));
126 std::bind(std::divides<T>(), std::placeholders::_2, val));
170 const T *x1 =
begin();
172 T *z = result.
begin();
175 for(
const T *x = x1; x < x2; ++x, ++z) {
187 return std::accumulate(
begin(),
end(), T(0));
191template <
class T>
inline
205 const T *x = lhs.
begin();
206 const T *y = rhs.
begin();
207 T *z = result.
begin();
208 while(x != lhs.
end() && y != rhs.
end()) {
211 while(x != lhs.
end()) *z++ = *x++;
212 while(y != rhs.
end()) *z++ = *y++;
221 const T *x = lhs.
begin();
222 const T *y = rhs.
begin();
223 T *z = result.
begin();
224 while(x != lhs.
end() && y != rhs.
end()) {
227 while(x != lhs.
end()) *z++ = *x++;
228 while(y != rhs.
end()) *z++ = - *y++;
237 const T *x = lhs.
begin();
238 T *z = result.
begin();
239 while(x != lhs.
end()) {
250 const T *x = rhs.
begin();
251 T *z = result.
begin();
252 while(x != rhs.
end()) {
263 const T *x = lhs.
begin();
264 T *z = result.
begin();
265 while(x != lhs.
end()) {
276 for(
int i = 0; i <= lhs.
getOrder(); ++i) {
277 if(! lhs[i].isZero()) {
278 for(
int j = 0; j <= rhs.
getOrder(); ++j) {
279 if(! rhs[j].isZero()) {
291 os <<
"Taylor" << std::setw(4) << series.
getOrder() << std::endl;
293 for(
int i = 0; i <= series.
getOrder(); ++i) {
294 os <<
"Terms of order" << std::setw(4) << i <<
" " << series[i];
Taylor< T > operator/(const Taylor< T > &lhs, double rhs)
Divide by scalar.
Taylor< T > operator*(const Taylor< T > &lhs, double rhs)
Multiply by scalar.
Taylor< T > operator-(const Taylor< T > &lhs, const Taylor< T > &rhs)
Subtract.
std::ostream & operator<<(std::ostream &os, const Taylor< T > &series)
Output.
Taylor< T > PoissonBracket(const Taylor< T > &lhs, const Taylor< T > &rhs)
Poisson bracket of two Taylor seriess.
Taylor< T > operator+(const Taylor< T > &lhs, const Taylor< T > &rhs)
Add.
PartBunchBase< T, Dim >::ConstIterator end(PartBunchBase< T, Dim > const &bunch)
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
A representation for a Taylor series in one variable,.
T * end()
Get pointer to end of series (one beyond highest term).
void clear()
Clear all coefficients.
int getOrder() const
Return order of this series.
Taylor operator-() const
Change sign of series.
Taylor(int)
Construct a zero series of a given order.
T * begin()
Get pointer to beginning of series (zero-order term).
Taylor & operator/=(const T &)
Divide by scalar and assign.
T sum() const
Return sum of series.
Taylor & operator-=(const Taylor &)
Subtract series and assign.
T & operator[](int n)
Get coefficient.
Taylor & operator+=(const Taylor &)
Add series and assign.
const Taylor & operator=(const Taylor &)
Taylor integrate() const
Integrate with respect to the variable.
Taylor & operator*=(const T &)
Multiply by scalar and assign.