|
From: Daniel J S. <dan...@ie...> - 2006-06-22 01:43:21
|
Ah! Very nice. Thank you. This should be moved into CVS as soon as possible. Developers are probably being overwhelmed with patches, so perhaps place in SourceForge if it isn't attended to in the near future. Dan James R. Van Zandt wrote: > Daniel J Sebald <dan...@ie...> wrote: > >> Paging through all.dem, something caught my eye in the bivariat.dem demo. >> ... >> The first example is of approximating integration of a function. >> Unfortunately it appears to be a bad approximation. > > > I looked the integration demo some time ago. Attached are some > suggested changes. It might be worth while including two versions - > one to show the basic approach, and the other to show possible > refinements that improve the results at the cost of some obscurity. Not following what you mean. Do you mean use a lower order approximation such as trapezoidal to compare against Simpson's rule? > - Jim Van Zandt > > These are the changes: > - Adjusting the step size so the range of integration is an integral > number of steps. > - Using Simpson's rule rather than just taking the function value at > one end of each step. > - Define the first integrand immediately before the plot command. > - Add points from the real erf(x) to the first plot, for comparison. Very nice. Could add a note about the accuracy of the third order Simpson's for approximating a second order function at the sample points, i.e., exact. Is that the kind of thing you meant? > - For the second plot, define the integrand f(x)=cos(x). That way, > the integral is sin(x) instead of being offset by a constant of > integration. I didn't go much beyond the first, but studying it, that jumps out now. > - For the last plot, use "with points" to make the patterns more > apparent, and because the function is only defined over the integers. Much better. Dan |