import numpy


class InitialDataControlSine:
    def __init__(self, coefficients):
        self.coefficients = coefficients

    def __call__(self, x):
        u = numpy.zeros_like(x)

        for k, coefficient in enumerate(self.coefficients):
            u += coefficient  * numpy.sin(k * numpy.pi * x)

        return u

    def exact_solution(self, x, t, q=1):
        return sum(coefficient * numpy.exp(-q * (k * numpy.pi) ** 2 * t) * numpy.sin(
            k * numpy.pi * x) for k, coefficient in enumerate(self.coefficients))

[(9, 'numpy.zeros_like', 'numpy.zeros_like', False, 'import numpy\n'), (12, 'numpy.sin', 'numpy.sin', False, 'import numpy\n'), (17, 'numpy.sin', 'numpy.sin', False, 'import numpy\n'), (17, 'numpy.exp', 'numpy.exp', False, 'import numpy\n')]