doug reich
Some guy
- Joined
- 4/23/08
- Messages
- 684
- Points
- 28
I thought a good way to get some C++ practice and solidify the numerical integration methods (and do the practice problems) in Chapter 2 of Dan's Primer book would be to write numerical integration functions for the midpoint, trapezoidal, and simpson's rules that take the function to be integrated as an argument.
The way to do this in C++ seems to be to use functors (Function object - Wikipedia, the free encyclopedia). The only place I've come across these is in the documentation for the for_each function in VS (and now in wikipedia, which gives a good overview). These give me the general idea, but does anybody have a good resource that covers these more thoroughly?
The way to do this in C++ seems to be to use functors (Function object - Wikipedia, the free encyclopedia). The only place I've come across these is in the documentation for the for_each function in VS (and now in wikipedia, which gives a good overview). These give me the general idea, but does anybody have a good resource that covers these more thoroughly?