summaryrefslogtreecommitdiff
path: root/tests/mime-detection/test3.py
blob: 0703c659e0c0bf3b21f086408730d22c3cd55f7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3

from math import sin, pi


def f(x):
    return sin(x ** 2)


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


if __name__ == '__main__':
    print(integrate_f(0, pi, 1000))