smooth function and rounding error [message #69209] |
Thu, 17 December 2009 15:20 |
simona bellavista
Messages: 56 Registered: December 2009
|
Member |
|
|
Hi,
there is something I do not understand about smooth function, or
probably about numerics in general.
I implemented my version of smooth function, following the
prescription in
http://idlastro.gsfc.nasa.gov/idl_html_help/SMOOTH.html
I compared these two versions on same data, ranging from ~10^-1 to
~10^-5
and I get a relative error between the methods up to ~10^-1. it looks
rather big.
it is the same prescription on same data. does it happen because my
implementation is too naive and I accumulate rounding errors in it? or
because of smooth function itself?
I am not worried about performance here, just accuracy.
my implementation is the following:
function smooth_equivalent, A, width
n=n_elements(A)
y=DBLARR(n)
y=A
for i=(width)/2,n-(width)/2-1,1 do begin
y[i]=total(A[i-width/2:i+width/2-1])/width
endfor
RETURN, y
end
many thanks,
simona
|
|
|