-
-
Save anthonymorast/298b43ad65a412afa620af7cb83c81d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def approximate_derivative(self, x): | |
""" | |
Estimates the derivative of a function f(x) from its Taylor series. | |
Useless since we need the derivative of the actual function to find the series | |
""" | |
value = 0 | |
for i in range(1, len(self.coefficients)): # skip the first value (constant) as the derivative is 0 | |
value += self.coefficients[i] * i * ((x - self.center)**(i-1)) # differentiate each term: x^n => n*x^(n-1) | |
return value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment