Re: interpolate large numbers [message #76469] |
Wed, 08 June 2011 08:35 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Jun 8, 4:51 am, ece <ecekile...@gmail.com> wrote:
> Thank you very much.
>
> My L values are in ergs/sec/Hz and frequency values are in Hz. I want
> the integral result to be in erg/s.
>
> I didn't get where I should use the binsize.
My second example was unevenly sampled, which means that the
Integral[f dx] the differential size "dx" is variable.
> Do you have any suggestion how to deal with errors that i have in the
> L values. The error of the integral value?
I don't have any easy suggestions. The dynamic range of your data is
huge, which could be the source of huge errors.
If it were me, I would fit a continuous model to the data and errors.
For example, the model could be a power law with break at a fitted
frequency. Once the parameters of your smooth function are determined
- with errors - the area under the curve can be estimated - with
errors.
Craig
|
|
|
Re: interpolate large numbers [message #76474 is a reply to message #76469] |
Wed, 08 June 2011 01:51  |
ece
Messages: 12 Registered: June 2011
|
Junior Member |
|
|
Thank you very much.
My L values are in ergs/sec/Hz and frequency values are in Hz. I want
the integral result to be in erg/s.
I didn't get where I should use the binsize.
Do you have any suggestion how to deal with errors that i have in the
L values. The error of the integral value?
|
|
|
Re: interpolate large numbers [message #76475 is a reply to message #76474] |
Tue, 07 June 2011 17:41  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Jun 7, 5:35 pm, ece <ecekile...@gmail.com> wrote:
> Hi,
> I have a problem. i want to interpolate linearly some large numbers
> such as:
>
> frequency L
> 6.28865e+14 8.2654538e+28
> 1.66951e+15 4.0936348e+28
> 1.75106e+15 3.9580807e+28
> 2.05175e+15 3.4878620e+28
> 2.31700e+15 3.0611352e+28
> 4.90883e+17 1.0399752e+25
> 1.47366e+18 1.2454723e+24
> 2.44933e+18 4.6650308e+23
>
> First I created the interval for the interpolation :
> range=maken(6.28865E+14,2.44933E+18,1000)
> I used the interpol:
> Lum=interpol(L,frequency,range)
>
> But when I plot the result it does not look a linear interpolation,
> there are gaps and curves between data points. Do you have a
> suggestion?
>
> My aim is to integrate this data points and get L. If I di it same way
> in the alog10(freq) and alog10(L) values the intepolation looks nice,
> but I couldn't figure out how to convert integral result in alog10
> values to normal scale.
As Paolo points out, your range is 6e14 to 2e18, or a factor of
3333x. Therefore, your interpolation grid has to have at least 3333
samples, but you would be better off using 33333 instead (a factor of
10x more).
You would probably be better off starting with logarithmically spaced
grid points instead of linear. That is a little harder to do since
the "bin" size is variable.
;; Sample logarithmically
alog10_range=maken(alog10(6.28865E+14),alog10(2.44933E+18),1 000)
alog10_Lum=interpol(alog10(L),alog10(frequency),range)
;; Convert to linear space
range = 10^(alog10_range)
Lum = 10^(alog10_Lum)
binsize = (range[1:*] - range)
binsize = [binsize[0], binsize]
;; Then integrate ...
It looks like you might have an astronomical spectrum. Some care
needs to be taken that the units are correct. Sometimes for example
the "L" values of your table might already be expressed as "per
logarithmic frequency interval."
Craig
|
|
|
Re: interpolate large numbers [message #76476 is a reply to message #76475] |
Tue, 07 June 2011 14:42  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
On Jun 7, 5:35 pm, ece <ecekile...@gmail.com> wrote:
> Hi,
> I have a problem. i want to interpolate linearly some large numbers
> such as:
>
> frequency L
> 6.28865e+14 8.2654538e+28
> 1.66951e+15 4.0936348e+28
> 1.75106e+15 3.9580807e+28
> 2.05175e+15 3.4878620e+28
> 2.31700e+15 3.0611352e+28
> 4.90883e+17 1.0399752e+25
> 1.47366e+18 1.2454723e+24
> 2.44933e+18 4.6650308e+23
>
> First I created the interval for the interpolation :
> range=maken(6.28865E+14,2.44933E+18,1000)
1000 points will not divide that range in a fine enough
grid - the first few data points will all be around the
first element of your range array.
You could increase the resolution of your range, or
use a logarithmic scaling instead (which is probably
better).
Ciao,
Paolo
> I used the interpol:
> Lum=interpol(L,frequency,range)
>
> But when I plot the result it does not look a linear interpolation,
> there are gaps and curves between data points. Do you have a
> suggestion?
>
> My aim is to integrate this data points and get L. If I di it same way
> in the alog10(freq) and alog10(L) values the intepolation looks nice,
> but I couldn't figure out how to convert integral result in alog10
> values to normal scale.
|
|
|