Python: правило Симпсона, отрицательный ответ для положительной площади под кривой?Python

Программы на Python
Anonymous
Python: правило Симпсона, отрицательный ответ для положительной площади под кривой?

Сообщение Anonymous »


У меня есть

Код: Выделить всё

y1=[  9.49110000e-004   4.74145420e-004   1.41847155e-008   3.33228420e-028
3.76352289e-081   4.48206815e-193   0.00000000e+000   0.00000000e+000
0.00000000e+000   0.00000000e+000   0.00000000e+000]

x=[ 112.  111.97667396  111.90666665  111.78989038  111.62619837
111.41538384  111.15717866  110.85125168  110.49720654  110.09457901
109.64283388]
All the values are positive, so the area under the curve should be positive. But when I try to use Simpson's rule to integrate

Код: Выделить всё

  from scipy.integrate import simps
b= simps(y1, x)

print b
I am getting

Код: Выделить всё

-2.45630795891e-05
as the answer. What am I doing wrong?


Источник: https://stackoverflow.com/questions/368 ... -the-curve

Вернуться в «Python»