Skip to content

Instantly share code, notes, and snippets.

@anthonymorast
Created October 3, 2021 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonymorast/19e886d9a13117e62141137f0b222b5c to your computer and use it in GitHub Desktop.
Save anthonymorast/19e886d9a13117e62141137f0b222b5c to your computer and use it in GitHub Desktop.
def print_equation(self):
eqn_string = ""
for i in range(self.order + 1):
if self.coefficients[i] != 0:
eqn_string += str(self.coefficients[i]) + ("(x-{})^{}".format(self.center, i) if i > 0 else "") + " + "
eqn_string = eqn_string[:-3] if eqn_string.endswith(" + ") else eqn_string
print(eqn_string)
def print_coefficients(self):
print(self.coefficients)
def get_coefficients(self):
"""
Returns the coefficients of the taylor series
"""
return self.coefficients
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment