* happens through the Horner scheme which provides both numerical
* stability and a minimal number of numerical operations.
*
- * @author Ralf Hartmann, Guido Kanschat, 2000
+ * @author Ralf Hartmann, Guido Kanschat, 2000, 2006
*/
template <typename number>
class Polynomial : public Subscriptor
void shift (const number2 offset);
/**
- * Compute the derivative of
- * the polynomial.
+ * Compute the derivative of a
+ * polynomial.
*/
Polynomial<number> derivative () const;
+ /**
+ * Compute the primitive of a
+ * polynomial. the coefficient
+ * of the zero order term of
+ * the polynomial is zero.
+ */
+ Polynomial<number> primitive () const;
+
/**
* Multiply with a scalar.
*/
// $Id$
// Version: $Name$
//
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
}
+ template <typename number>
+ Polynomial<number>
+ Polynomial<number>::primitive () const
+ {
+ std::vector<number> newcoefficients (coefficients.size()+1);
+ newcoefficients[0] = 0.;
+ for (unsigned int i=0 ; i<coefficients.size() ; ++i)
+ newcoefficients[i+1] = coefficients[i]/(i+1.);
+
+ return Polynomial<number> (newcoefficients);
+ }
+
+
template <typename number>
void
Polynomial<number>::print (std::ostream& out) const