QSIMP function [message #85827] |
Thu, 12 September 2013 06:31  |
fd_luni
Messages: 66 Registered: January 2013
|
Member |
|
|
Instead of using the QSIMP function can I write the code as a summation and use also the Simpson's rule?
|
|
|
|
|
|
|
|
|
Re: QSIMP function [message #85856 is a reply to message #85832] |
Fri, 13 September 2013 22:44   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Thursday, September 12, 2013 1:05:05 PM UTC-4, wlandsman wrote:
> One suggestion for improved accuracy is to interpolate your function at the midpoints of all your tabulated X values. You can use one of the options (e.g. spline,least-squares quadratic) in the INTERPOL() function without needing a loop. Then redo your trapezoidal integration routines but using twice as many points, then rebin your final answer by a factor of two.
Wayne, Maria asked me about this privately. Does interpolation really improve the accuracy? My first impression would be that it might help, or it might hurt, depending on how well the interpolation routine chosen reflects the underlying nature of the curve being sampled. I don't have any good intuition about how well this works in practice.
Thanks,
Craig
|
|
|
Re: QSIMP function [message #85863 is a reply to message #85856] |
Sat, 14 September 2013 19:58  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
The point is to interpolate using values at three or more local points, rather than just approximating the curve through consecutive points as a straight line, which is what trapezoidal integration does. INT_TABULATED works by interpolating over 5 points (using cubic spline interpolation). But the OP said that INT_TABULATED was too slow, so I was offering a next step of refinement from trapezoidal integration without being as compute intensive as INT_TABULATED.
--Wayne
On Saturday, September 14, 2013 1:44:07 AM UTC-4, Craig Markwardt wrote:
> Wayne, Maria asked me about this privately. Does interpolation really improve the accuracy? My first impression would be that it might help, or it might hurt, depending on how well the interpolation routine chosen reflects the underlying nature of the curve being sampled. I don't have any good intuition about how well this works in practice.
>
>
>
> Thanks,
>
> Craig
|
|
|