ContentsFoundations to FrontierBezhig

integration_code/starters/calculus_bridge.py

All lab code. Download this file.

# Exercise scaffold. Reference implementation is in a separate directory.
"""W01: exact quadratic rates. Inputs are int or Fraction, not binary floats."""
from dataclasses import dataclass
from fractions import Fraction

def rational(value):
    raise NotImplementedError('Implement this contract from the book.')

@dataclass(frozen=True)
class Quadratic:
    a: Fraction
    b: Fraction
    c: Fraction

    def __post_init__(self):
        raise NotImplementedError('Implement this contract from the book.')

    def value(self, x):
        raise NotImplementedError('Implement this contract from the book.')

    def average_rate(self, x, h):
        raise NotImplementedError('Implement this contract from the book.')

    def tangent(self, x):
        raise NotImplementedError('Implement this contract from the book.')