import numpy as np
import matplotlib.pyplot as plt

# Given a tuple quad = (xs, coeff) that describes a quadrature formula for the
# interval [0,1] uses that chained to calculate the integral of the given
# function f over the interval [a,b], iterating quad a total of n times.
def chainedQuad(quad, a, b, n, f):
    return 0

def chainedTrapezoid(a, b, n, f):
    xs, coeff = [], []
    return chainedQuad((xs, coeff), a, b, n, f)

def chainedSimpson(a, b, n, f):
    xs, coeff = [], []
    return chainedQuad((xs, coeff), a, b, n, f)

if __name__ == "__main__":
    f = lambda x: np.cos(x - 1)**2 + np.sin(0.7 * x) + x
    a, b = -1, 2 * np.pi

    # Integrate[f[x], {x, a, b}] ~ 23.998
    exactResult = (-10 + 10*np.sqrt(5) + 28*np.pi + 56*np.pi**2 + 7*(np.sin(4) - np.sin(2)) + 40*np.cos(7/10))/28

    print("Hello, World!")
