Exemple #1
0
def cubic_derivative_approximation(f, t0, t1):
    f0 = f(t0)
    f1 = f(t1)
    diff_f = f.derivative()
    d0 = diff_f(t0)
    d1 = diff_f(t1)
    return CubicSpline.endpoint_slope_factory(t0, t1, f0, f1, d0, d1)
Exemple #2
0
def linear_approximation(f, t0, t1):
    f0 = f(t0)
    f1 = f(t1)
    slope = (f1-f0)/(t1-t0)
    return CubicSpline.endpoint_slope_factory(t0, t1, f0, f1, slope, slope)