Integration after importing data, how to set the variables

GROUPS:

 Dear Community :I’m learning doing the integration. I know how to import data and integration. But I do not how to set the variables after importing it. The screencapture is as below.Please advise me Thanks in advance Lee
POSTED BY: Chenyen Lee
1 Day ago
• Edit
• |
• |
• Flag
6 Replies

 Hi. I’m not sure what you would like to do with Mathematica. What do you want this code to do?Import will give you a list of numbers, not a function. If you would like to make the list of numbers into a function, please try using the Interpolationfunction.If you are new to Mathematica, you may want to read an overview of how to use it. You can do this by looking at the Mathematica Virtual Book.
POSTED BY: Sean Clarke
1 Day ago
• |
• Flag

 I would like to know how to do a definite integral of sigma(E) over an defined region. The distribution of Sigma is  http://ppt.cc/-5Z5  , and the values are in the file O8p18Ft.xls. ex.   The sigma(E) varies with E (2.5, 2.74) (2.6, 52  ) (2.7, 6.6 ) …. … (20,    )
POSTED BY: Chenyen Lee
22 Hours ago
• Edit
• |
• |
• Flag

 You may take a look at this funciton after you import the data: http://reference.wolfram.com/mathematica/ref/Interpolation.html
POSTED BY: Shenghui Yang
20 Hours ago
• |
• Flag

 Let’s make up some data close to yours: data = Table[{x, 700 x Exp[-x] + 50 RandomReal[]}, {x, 0, 9, .1}]; When you have just list of points you have three choices for integration: integrate data integrate interpolation integrate model fit Let’s first get all three on the same figure. (* interpolation *) f = Interpolation[data];(* model fit *) model = a x Exp[-b x]; fit = FindFit[data, model, {a, b}, x] modelf = Function[{t}, Evaluate[model /. fit]]; Out[] = {a -> 678.552, b -> 0.892996} Show[ Plot[{f[x], modelf[x]}, {x, 0, 9}], ListPlot[data, PlotStyle -> Red] , PlotRange -> All] Now we can compute the integrals – which all are pretty close to each other. You should pick a method more appropriate to your case. The 1st one – integration of data – is the simplest. You just have to sum all the Y-values and multiply them by the step between the points – in our case it is 0.1 .  (* integrate data *) .1 Total[data[[All, 2]]] Out[]= 1911.23(* integrate interpolation *) NIntegrate[f[x], {x, 0, 9}] Out[]= 1901.01(* integrate model fit *) NIntegrate[modelf[x], {x, 0, 9}] Out[]= 1756.51
POSTED BY: Vitaliy Kaurov
20 Hours ago
• |
• Flag

 Thank you so much for the instruction. I understand much more how to do the interpolation and integral now. But I still do not know how to set the variables after importing data,  how to correspond the importing data to variables Please advise me. The data  O8p18Ft.xls. (2.5, 2.74) (2.6, 52 ) (2.7, 6.6 ) …. … (20, )   is attached in the link belowhttps://www.dropbox.com/s/f90z14hxwgbzxn6/O8p18Ft.xls
POSTED BY: Chenyen Lee
12 Hours ago
• Edit
• |