1
$\begingroup$

I have a list of data points that I would like to use as a weighted function. The data represents the number of particles within a bin of a particle distribution.

Ultimately I would like to multiply the distribution with a continuous function (i.e. x^3) and then NIntegrate the whole thing. So, I am a little confused on how to go about doing this with this data set. Do I:

  1. Fit the data to some continuous function?

  2. Leave the data in binned form and somehow multiply the binned data (particle distribution) against my function?

Any help would be greatly appreciated. The data is listed below:

z = {-5.347621813908679*10^-002, -4.916164579677237*10^-002, 
     -4.484707345445796*10^-002, -4.053250111214354*10^-002, 
     -3.621792876982912*10^-002, -3.190335642751470*10^-002, 
     -2.758878408520029*10^-002, -2.327421174288587*10^-002, 
     -1.895963940057145*10^-002, -1.464506705825704*10^-002, 
     -1.033049471594261*10^-002, -6.015922373628198*10^-003, 
     -1.701350031313782*10^-003, 2.613222311000633*10^-003, 
     6.927794653315056*10^-003, 1.124236699562947*10^-002, 
     1.555693933794389*10^-002, 1.987151168025830*10^-002, 
     2.418608402257272*10^-002, 2.850065636488713*10^-002, 
     3.281522870720156*10^-002, 3.712980104951598*10^-002, 
     4.144437339183039*10^-002, 4.575894573414481*10^-002, 
     5.007351807645923*10^-002, 5.438809041877364*10^-002, 
     5.870266276108806*10^-002, 6.301723510340247*10^-002, 
     6.733180744571690*10^-002, 7.164637978803132*10^-002, 
     7.596095213034573*10^-002, 8.027552447266015*10^-002, 
     8.459009681497456*10^-002, 8.890466915728898*10^-002, 
     9.321924149960340*10^-002, 9.753381384191781*10^-002, 
     1.018483861842322*10^-001, 1.061629585265466*10^-001, 
     1.104775308688611*10^-001, 1.147921032111755*10^-001, 
     1.191066755534899*10^-001, 1.234212478958043*10^-001, 
     1.277358202381188*10^-001, 1.320503925804332*10^-001, 
     1.363649649227476*10^-001, 1.406795372650620*10^-001, 
     1.449941096073764*10^-001, 1.493086819496908*10^-001, 
     1.536232542920052*10^-001, 1.579378266343197*10^-001, 
     1.622523989766341*10^-001, 1.665669713189485*10^-001, 
     1.708815436612629*10^-001, 1.751961160035773*10^-001, 
     1.795106883458917*10^-001, 1.838252606882062*10^-001, 
     1.881398330305206*10^-001, 1.924544053728350*10^-001, 
     1.967689777151494*10^-001, 2.010835500574638*10^-001, 
     2.053981223997782*10^-001, 2.097126947420926*10^-001, 
     2.140272670844071*10^-001, 2.183418394267215*10^-001, 
     2.226564117690359*10^-001, 2.269709841113504*10^-001, 
     2.312855564536648*10^-001, 2.356001287959792*10^-001, 
     2.399147011382936*10^-001, 2.442292734806080*10^-001, 
     2.485438458229224*10^-001, 2.528584181652369*10^-001, 
     2.571729905075513*10^-001, 2.614875628498657*10^-001, 
     2.658021351921801*10^-001, 2.701167075344945*10^-001, 
     2.744312798768089*10^-001, 2.787458522191234*10^-001, 
     2.830604245614378*10^-001, 2.873749969037522*10^-001, 
     2.916895692460666*10^-001, 2.960041415883810*10^-001, 
     3.003187139306954*10^-001, 3.046332862730098*10^-001, 
     3.089478586153243*10^-001, 3.132624309576387*10^-001, 
     3.175770032999531*10^-001, 3.218915756422675*10^-001, 
     3.262061479845819*10^-001, 3.305207203268963*10^-001, 
     3.348352926692108*10^-001, 3.391498650115252*10^-001, 
     3.434644373538396*10^-001, 3.477790096961540*10^-001, 
     3.520935820384684*10^-001, 3.564081543807828*10^-001, 
     3.607227267230973*10^-001, 3.650372990654117*10^-001, 
     3.693518714077261*10^-001, 3.736664437500405*10^-001};
frequency = {8.100000000000000*10^+001, 1.610000000000000*10^+003, 
             8.081000000000000*10^+003, 1.370800000000000*10^+004, 
             1.071500000000000*10^+004, 7.606000000000000*10^+003, 
             5.665000000000000*10^+003, 4.728000000000000*10^+003, 
             4.215000000000000*10^+003, 3.590000000000000*10^+003, 
             3.190000000000000*10^+003, 2.795000000000000*10^+003, 
             2.468000000000000*10^+003, 2.261000000000000*10^+003, 
             2.069000000000000*10^+003, 1.914000000000000*10^+003, 
             1.736000000000000*10^+003, 1.705000000000000*10^+003, 
             1.490000000000000*10^+003, 1.396000000000000*10^+003, 
             1.182000000000000*10^+003, 1.178000000000000*10^+003, 
             1.003000000000000*10^+003, 9.440000000000000*10^+002, 
             9.150000000000000*10^+002, 8.160000000000000*10^+002, 
             7.100000000000000*10^+002, 7.240000000000000*10^+002, 
             7.000000000000000*10^+002, 6.700000000000000*10^+002, 
             6.210000000000000*10^+002, 5.100000000000000*10^+002, 
             5.000000000000000*10^+002, 4.870000000000000*10^+002, 
             4.640000000000000*10^+002, 4.030000000000000*10^+002, 
             3.560000000000000*10^+002, 3.540000000000000*10^+002, 
             3.700000000000000*10^+002, 3.470000000000000*10^+002, 
             3.330000000000000*10^+002, 3.140000000000000*10^+002, 
             2.710000000000000*10^+002, 2.630000000000000*10^+002, 
             2.540000000000000*10^+002, 2.480000000000000*10^+002, 
             2.260000000000000*10^+002, 2.250000000000000*10^+002, 
             2.240000000000000*10^+002, 1.810000000000000*10^+002, 
             1.730000000000000*10^+002, 2.090000000000000*10^+002, 
             1.210000000000000*10^+002, 1.550000000000000*10^+002, 
             1.240000000000000*10^+002, 1.200000000000000*10^+002, 
             1.270000000000000*10^+002, 1.140000000000000*10^+002, 
             1.390000000000000*10^+002, 1.340000000000000*10^+002, 
             1.230000000000000*10^+002, 1.080000000000000*10^+002, 
             9.900000000000000*10^+001, 8.600000000000000*10^+001, 
             8.300000000000000*10^+001, 9.100000000000000*10^+001, 
             8.600000000000000*10^+001, 7.700000000000000*10^+001, 
             8.100000000000000*10^+001, 6.200000000000000*10^+001, 
             6.600000000000000*10^+001, 6.800000000000000*10^+001, 
             4.500000000000000*10^+001, 4.900000000000000*10^+001, 
             3.900000000000000*10^+001, 5.000000000000000*10^+001, 
             3.600000000000000*10^+001, 4.500000000000000*10^+001, 
             3.600000000000000*10^+001, 2.900000000000000*10^+001, 
             4.300000000000000*10^+001, 2.600000000000000*10^+001, 
             3.200000000000000*10^+001, 3.000000000000000*10^+001, 
             2.000000000000000*10^+001, 2.700000000000000*10^+001, 
             2.300000000000000*10^+001, 2.400000000000000*10^+001, 
             1.700000000000000*10^+001, 2.300000000000000*10^+001, 
             2.500000000000000*10^+001, 2.300000000000000*10^+001, 
             1.800000000000000*10^+001, 2.000000000000000*10^+001, 
             2.100000000000000*10^+001, 1.100000000000000*10^+001, 
             9.000000000000000*10^+000, 7.000000000000000*10^+000, 
             5.000000000000000*10^+000, 5.000000000000000*10^+000};
 data = Transpose@{z, frequency};
 ListPlot[data, Axes -> True, Joined -> True, PlotRange -> All]
$\endgroup$
  • $\begingroup$ Have a look at Interpolation. $\endgroup$ – Verbeia Nov 13 '14 at 5:39
2
$\begingroup$

1. "Multiply the distribution with a continuous function (i.e. x^3)"
I'll call the new data data2

data2 = Transpose@{z, frequency*z^3}

ListPlot[data2, Axes -> True, Joined -> True, PlotRange -> All]

data2

2. "NIntegrate the whole thing"
An InterpolatingFunction for data2 can be found with

data2IP = Interpolation[data2]

and numerically integrated with

NIntegrate[data2IP[x], {x, 0, Max@z}]

$\ $0.227143

The final result depends on the chosen InterpolationOrder (with the default being 3):

NIntegrate[
   Interpolation[data2, InterpolationOrder -> #][x], {x, 0, Max@z}] & /@ Range[0, 5]

$\ ${0.227745, 0.227182, 0.227303, 0.227143, 0.227002, 0.227153}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.