25 #ifndef __ETL__CALCULUS_H
26 #define __ETL__CALCULUS_H
47 class derivative :
public std::unary_function<typename T::argument_type,typename T::result_type>
54 typename T::result_type
62 class derivative<
hermite<T> > :
public std::unary_function<typename hermite<T>::argument_type,typename hermite<T>::result_type>
73 return ((b-a)*y*y + (c-b)*x*y*2 + (d-c)*x*x) * 3;
78 class integral :
public std::binary_function<typename T::argument_type,typename T::argument_type,typename T::result_type>
85 typename T::result_type
86 operator()(
typename T::argument_type x,
typename T::argument_type y)
const
88 typename T::result_type ret=0;
90 const typename T::argument_type increment=(y-x)/i;
92 for(;i;i--,x+=increment)
93 ret+=(
func(x)+
func(x+increment))*increment/2;