plot_points = p1.discrete_func(math.sin, -4, 4, 400)

plt.plot(plot_points[0], plot_points[1], 'g.')
plt.show()

"""
Explanation: Classwork 5
Michael Seaman, Taylor Patti, Austin Ayers, Chinmai Raman, Andrew Malfavon
3/1/16
The calculus module contains 3 main functions in it. The first is the discrete funk function, which takes a function f, endpoints a and b, and the number of points to be calculated n. The function returns a 2 dimensional list containing a list of inputs x equally spaced along a-b and then a list of outputs y for y = f(x).
End of explanation
"""


print p1.diff(math.sin, 0, 2 * math.pi, 1000)[1][-1]

"""
Explanation: That's nice, but we also did stuff with it. For example, we wrote two functions which obtain the derrivative of a function at various points. The first was an iterative version. We display it below here, taking the derivative of sin at the x value of 2 pi. Note that it approaches the actual value of 1 with incredible accuracy and precision.
End of explanation
"""


print p1.diff2(math.sin, 0, 2 * math.pi, 1000)[-1]

"""
Explanation: We also implemented a superior version in the form of a derrivative matrix. This takes the matrix product of an n by n matrix with an n length vector utilizing numpy functions. This is far better, not only due to the speed of numpy functions, but rather, by the ability to rapidly differentiate other functions with the generated matrix should we need be so that there.
End of explanation
"""


print p1.trapezoidal_matrix(np.sin, 0, np.pi/2.0, 100000)

"""
Explanation: Finally, trapezoidal_matrix takes a function, two endpoints, and an interval number n and returns the integral of the function from the dot product of the function vector with a 1 by n matrix for integration.
End of explanation
"""


