def affine_from_new_domain(old_domain, new_domain):
    """
    Get affine parameters a, b such that u(f(at+b)) has new_domain
    """
    s = old_domain
    t = new_domain
    a = (s[1] - s[0]) / (t[1] - t[0])
    b = s[0] - a * t[0]
    return (a, b)

    Get affine parameters a, b such that u(f(at+b)) has new_domain
    
infinigen/core/util/math.py