mirror of
https://github.com/codeflash-ai/codeflash.git
synced 2026-05-04 18:25:17 +00:00
10 lines
160 B
Python
10 lines
160 B
Python
def f(x):
|
|
return x * (x - 1)
|
|
|
|
|
|
def integrate_f(a, b, N):
|
|
s = 0
|
|
dx = (b - a) / N
|
|
for i in range(N):
|
|
s += f(a + i * dx)
|
|
return s * dx
|