# Exercise scaffold. Reference implementation is in a separate directory."""W04: forward-mode automatic differentiation; each operation carries its tangent."""fromdataclassesimportdataclassimportmath@dataclass(frozen=True)classDual:value:floattangent:float=0.0def__post_init__(self):raiseNotImplementedError('Implement this contract from the book.')@staticmethoddefwrap(other):raiseNotImplementedError('Implement this contract from the book.')def__add__(self,other):raiseNotImplementedError('Implement this contract from the book.')__radd__=__add__def__neg__(self):raiseNotImplementedError('Implement this contract from the book.')def__sub__(self,other):raiseNotImplementedError('Implement this contract from the book.')def__rsub__(self,other):raiseNotImplementedError('Implement this contract from the book.')def__mul__(self,other):raiseNotImplementedError('Implement this contract from the book.')__rmul__=__mul__def__truediv__(self,other):raiseNotImplementedError('Implement this contract from the book.')def__rtruediv__(self,other):raiseNotImplementedError('Implement this contract from the book.')defsin(x):raiseNotImplementedError('Implement this contract from the book.')defexp(x):raiseNotImplementedError('Implement this contract from the book.')deflog(x):raiseNotImplementedError('Implement this contract from the book.')