Exemplo n.º 1
0
    def test_plot_bounded_coal(self):
        n = 1000
        k = 6
        T = 500

        # plots should differ
        p = plotfunc(lambda t: coal.prob_bounded_coal(t, k, n, T),
                     0, 1000, 10)
        p.plotfunc(lambda t: coal.prob_coal(t, k, n),
                   0, 1000, 10)
Exemplo n.º 2
0
def bspline2(pts, times, t):
    p = len(times) - len(pts) - 1
    b = []
    for i in range(len(pts)):
        b.append(bbasis(i, p, t, times))
    return b


if __name__ == "__main__":

    f = lambda x: hermite(0, 0, 1, -1, x)
    g = lambda x: bezier(0, 1, 1, 0, x)
    h = lambda x: catmullrom(-3, 0, 0, -3, x)

    if False:
        p = gnuplot.plotfunc(f, 0, 1, .1)
        p.plotfunc(g, 0, 1, .1)
        p.plotfunc(h, 0, 1, .1)

    if False:
        pts = [1, 2, 2, 3, 3, 1, -5, -4, -5, -3, -5, -2, -5, 0]
        p = gnuplot.plotfunc(interpolate(pts), 0, len(pts)-1, .1)

    def frange(n):
        return map(lambda x: x/float(n), range(n+1))

    pts = [0, 4, 0]
    pts2 = [0, 4, 6]

    p = gnuplot.Gnuplot()