Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // the actual functions come from particle physics and are extremely ugly
- double f(double x){
- return 2*x+1;
- }
- //in reality a numerical derivative term
- double F(const std::function<double(double)>& f, double x){
- return f(x) - f(x+1);
- }
- // in reality another higher order numerical derivative
- double G(const std::function<double(double)>& f, double x){
- return f(x) + f(x+1);
- }
- // in reality a function where the index is supposed to control the degree of derivatives of the function
- double H(const std::function<double(double)>& f, double x, int switch){
- if(0 == switch){
- return G(f(x));
- } else {
- return F(f(x));
- }
- }
- double sum=0;
- for(int i=0; i<1;++i){
- for(int j=0; j<1;++j){
- sum += H(H(f,i),j);
- }
- }
Add Comment
Please, Sign In to add comment