Last active
May 26, 2020 20:39
-
-
Save tswedish/1d85741021961a9f7015857912b7e530 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 __add__(self, other): | |
if isinstance(other, self.__class__): | |
return Dual(self.value + other.value, self.derivative + other.derivative) | |
else: | |
return self + Dual(other) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment