python - Integrate array using scipy -


i looking find area under curve. curve cannot translated equation satisfactory. coding pretty straightforward.

from scipy.integrate import simps import numpy np y =     np.array([1489.263705,1226.774401,5576.973322,1394.189836,1151.001948,867.5819289,773.5496598,1076.135273,1067.513122,3072.972271,2826.697242,1200.779848]) x =     np.array([40126,40154,40193,40226,40295,40325,40352,40379,40406,40448,40476,40490]) print simps(y,x) 

since dataset isn't large, tried doing more manually in excel. once using =forecast function , 1 time manually splitting in linear equations between different measuring points. 3 different ways yield different results. =forecast (value = 686.6569835 ) , manual splitting (678.9578851) obvious - manual better, uses more points. python way yields 662.425396.

question 1 - mathematics behind discret integration - surely linear, how come doesn't yield same result?

question 2 - result correct , why? can integrate in several ways using scipy, how can quantify 1 better without knowing result?

hope question not off.

best regards, mathias

question 1: intro here http://en.wikipedia.org/wiki/numerical_integration

question 2: if not know curve (equation), hard integration result best.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -