Exemplo n.º 1
0
def pr2(file_prefix):
    df = threebody(1.0, 0.5, 0.5, 0.5)
    x0 = numpy.array(
        [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 20, 0, 0, -0.15, 0],
        dtype=numpy.float64)
    ts, xs = rungekutta.rk4(df, 0, x0, 0.005, 50000)
    xs = xs.transpose()
    plot.render(xs[:5500, 0],
                xs[:5500, 1],
                'b',
                xs[:5500, 6],
                xs[:5500, 7],
                'r',
                xs[:5500, 12],
                xs[:5500, 13],
                'g',
                xlabel='x (normalized AU)',
                ylabel='y (normalized AU)',
                title='3-body Orbital Interaction',
                legend=('Star A', 'Star B', 'Star C'),
                file_prefix=suffixed(file_prefix, '_2a'))
    plot.render(xs[:, 0],
                xs[:, 1],
                'b',
                xs[:, 12],
                xs[:, 13],
                'g',
                xlabel='x (normalized AU)',
                ylabel='y (normalized AU)',
                title='3-body Orbital Interaction',
                legend=('Star A', 'Star C'),
                file_prefix=suffixed(file_prefix, '_2b'))
Exemplo n.º 2
0
def pr1(file_prefix):
    df = threebody(1.0, 0.5, 0.5, 0.5)
    x0 = numpy.array([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 3000, 0, 0, 0, 0],
                     dtype=numpy.float64)
    ts, xs = rungekutta.rk4(df, 0, x0, 0.005, 7600)
    xs = xs.transpose()
    plot.render(xs[:, 0],
                xs[:, 1],
                'b',
                xs[:, 6],
                xs[:, 7],
                'r',
                xs[:, 12],
                xs[:, 13],
                'g',
                xlabel='x (normalized AU)',
                ylabel='y (normalized AU)',
                xbound=(-10.0, 10.0),
                ybound=(0.0, 20.0),
                aspect='equal',
                title='3-body Orbital Trajectory',
                legend=('Star A', 'Star B'),
                file_prefix=suffixed(file_prefix, '_1a'))
    plot.render(xs[:, 6] - xs[:, 0],
                xs[:, 7] - xs[:, 1],
                'r',
                xlabel='x (normalized AU)',
                ylabel='y (normalized AU)',
                aspect='equal',
                title='3-body Trajectory, Star A at origin',
                legend=('Star B', ),
                file_prefix=suffixed(file_prefix, '_1b'))
Exemplo n.º 3
0
def pr2(file_prefix):
    df = threebody(1.0, 0.5, 0.5, 0.5)
    x0 = numpy.array([
                0, 0, 0,
                0, 0, 0,
                1, 0, 0,
                0, 1, 0,
                0, 20, 0,
                0, -0.15, 0
            ], dtype=numpy.float64)
    ts, xs = rungekutta.rk4(df, 0, x0, 0.005, 50000)
    xs = xs.transpose()
    plot.render(xs[:5500,0], xs[:5500,1], 'b', xs[:5500,6], xs[:5500,7], 'r', xs[:5500,12], xs[:5500,13], 'g',
            xlabel='x (normalized AU)',
            ylabel='y (normalized AU)',
            title='3-body Orbital Interaction',
            legend=('Star A', 'Star B', 'Star C'),
            file_prefix=suffixed(file_prefix, '_2a')
        )
    plot.render(xs[:,0], xs[:,1], 'b', xs[:,12], xs[:,13], 'g',
            xlabel='x (normalized AU)',
            ylabel='y (normalized AU)',
            title='3-body Orbital Interaction',
            legend=('Star A', 'Star C'),
            file_prefix=suffixed(file_prefix, '_2b')
        )
Exemplo n.º 4
0
def pr1(file_prefix):
    df = threebody(1.0, 0.5, 0.5, 0.5)
    x0 = numpy.array([
                0, 0, 0,
                0, 0, 0,
                1, 0, 0,
                0, 1, 0,
                0, 3000, 0,
                0, 0, 0
            ], dtype=numpy.float64)
    ts, xs = rungekutta.rk4(df, 0, x0, 0.005, 7600)
    xs = xs.transpose()
    plot.render(xs[:,0], xs[:,1], 'b', xs[:,6], xs[:,7], 'r', xs[:,12], xs[:,13], 'g',
            xlabel='x (normalized AU)',
            ylabel='y (normalized AU)',
            xbound=(-10.0, 10.0),
            ybound=(0.0, 20.0),
            aspect='equal',
            title='3-body Orbital Trajectory',
            legend=('Star A', 'Star B'),
            file_prefix=suffixed(file_prefix, '_1a')
        )
    plot.render(xs[:,6] - xs[:,0], xs[:,7] - xs[:,1], 'r',
            xlabel='x (normalized AU)',
            ylabel='y (normalized AU)',
            aspect='equal',
            title='3-body Trajectory, Star A at origin',
            legend=('Star B',),
            file_prefix=suffixed(file_prefix, '_1b')
        )
Exemplo n.º 5
0
def pr3(file_prefix):
    ic = lambda y: numpy.array([
                        0, 0, 0,
                        0, 0, 0,
                        1, 0, 0,
                        0, 1, 0,
                        0, y, 0,
                        0, -0.15, 0
                    ], dtype=numpy.float64)
    df = threebody(1.0, 0.5, 0.5, 0.5)
    for i in xrange(8):
        ts, xs = rungekutta.rk4(df, 0, ic(0.3*i + 20.0), 0.005, 8000)
        xs = xs.transpose()
        plot.render(xs[:,0], xs[:,1], 'b', xs[:,6], xs[:,7], 'r', xs[:,12], xs[:,13], 'g',
                xlabel='x (normalized AU)',
                ylabel='y (normalized AU)',
                title=r'3-body Orbital Interaction ($x_{14}=%.1f$)' % (0.3*i+20.0),
                legend=('Star A', 'Star B', 'Star C'),
                file_prefix=suffixed(file_prefix, '_3{0}'.format(chr(97+i)))
            )
Exemplo n.º 6
0
def pr3(file_prefix):
    ic = lambda y: numpy.array(
        [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, y, 0, 0, -0.15, 0],
        dtype=numpy.float64)
    df = threebody(1.0, 0.5, 0.5, 0.5)
    for i in xrange(8):
        ts, xs = rungekutta.rk4(df, 0, ic(0.3 * i + 20.0), 0.005, 8000)
        xs = xs.transpose()
        plot.render(xs[:, 0],
                    xs[:, 1],
                    'b',
                    xs[:, 6],
                    xs[:, 7],
                    'r',
                    xs[:, 12],
                    xs[:, 13],
                    'g',
                    xlabel='x (normalized AU)',
                    ylabel='y (normalized AU)',
                    title=r'3-body Orbital Interaction ($x_{14}=%.1f$)' %
                    (0.3 * i + 20.0),
                    legend=('Star A', 'Star B', 'Star C'),
                    file_prefix=suffixed(file_prefix,
                                         '_3{0}'.format(chr(97 + i))))