Exemple #1
0
def pr1d(file_prefix):
    drive_freq = 7.4246
    pfunc2 = pendulum.pendulum(0.1, 0.1, 0.25, ampl=1, freq=drive_freq)
    ts3, xs3 = rungekutta.rk4(
                            pfunc2,
                            0.0, 
                            numpy.array([3.0, 0.1], dtype=numpy.float64),
                            0.02,
                            250000
                        )
    xs3[0,:] = numpy.array(
                        [pendulum.mod2pi(x) for x in xs3[0,:]], 
                        dtype=numpy.float64
                    )
    points3 = xs3.transpose()
    ps4 = poincare.section(ts3, points3, interval=2*numpy.pi/drive_freq)
    plot.mod2pi(
            ps4[:,0],
            ps4[:,1],
            'k.',
            xlabel=r'$\theta$', 
            ylabel=r'$\omega$', 
            markersize=0.6,
            title='Poincare section, increased step size',
            file_prefix=_suffixed(file_prefix, '_1d')
        )
Exemple #2
0
def pr2x(file_prefix, step, nsteps, title, suffix):
    drive_freq = 7.4246
    pfunc = pendulum.pendulum(0.1, 0.1, 0.25, ampl=1.0, freq=drive_freq)
    ts, xs = rungekutta.rk4(
                            pfunc,
                            0.0,
                            numpy.array([3.0, 0.1], dtype=numpy.float64),
                            step,
                            nsteps
                        )
    xs[0,:] = numpy.array(
                        [pendulum.mod2pi(x) for x in xs[0,:]],
                        dtype=numpy.float64
                    )
    points = xs.transpose()
    ps = poincare.linear(ts, points, interval=2*numpy.pi/drive_freq)
    plot.mod2pi(
            ps[:,0],
            ps[:,1],
            'k.',
            xlabel=r'$\theta$', 
            ylabel=r'$\omega$', 
            markersize=0.6,
            title=title,
            file_prefix=_suffixed(file_prefix, suffix)
        )
Exemple #3
0
def pr1c(file_prefix):
    drive_freq = 7.4246
    pfunc2 = pendulum.pendulum(0.1, 0.1, 0.25, ampl=1, freq=drive_freq)
    ts2, xs2 = rungekutta.rk4(
                            pfunc2, 
                            0.0, 
                            numpy.array([3.0, 0.1], dtype=numpy.float64), 
                            0.005, 
                            1000000
                        )
    xs2[0,:] = numpy.array(
                        [pendulum.mod2pi(x) for x in xs2[0,:]], 
                        dtype=numpy.float64
                    )
    points2 = xs2.transpose()
    ps3 = poincare.section(ts2, points2, interval=2*numpy.pi/drive_freq)
    plot.mod2pi(
            ps3[:,0],
            ps3[:,1],
            'k.',
            xlabel=r'$\theta$', 
            ylabel=r'$\omega$', 
            markersize=0.6,
            title='Poincare Section (Chaotic Trajectory)',
            file_prefix=_suffixed(file_prefix, '_1c')
        )
Exemple #4
0
def pr1(file_prefix=None):
    data = numpy.loadtxt('data/ps8/data1', dtype=numpy.float64)
    points = construct_angular_velocity(data[::30, 1], data[::30, 0])
    thetas = numpy.array([pendulum.mod2pi(theta) for theta in points[:, 1]],
                         dtype=numpy.float64)
    plot.render(thetas,
                points[:, 2],
                'b',
                xlabel=r'$\theta$',
                ylabel=r'$\omega$',
                title='State-space Trajectory, Data Set 1',
                file_prefix=suffixed(file_prefix, '_1'))
Exemple #5
0
def pr1(file_prefix=None):
    data = numpy.loadtxt('data/ps8/data1', dtype=numpy.float64)
    points = construct_angular_velocity(data[::30,1], data[::30,0])
    thetas = numpy.array([
                    pendulum.mod2pi(theta) for theta in points[:,1]
                ], dtype=numpy.float64)
    plot.render(
            thetas, 
            points[:,2], 
            'b', 
            xlabel=r'$\theta$',
            ylabel=r'$\omega$',
            title='State-space Trajectory, Data Set 1',
            file_prefix=suffixed(file_prefix, '_1')
        )
Exemple #6
0
def pr1d(file_prefix):
    drive_freq = 7.4246
    pfunc2 = pendulum.pendulum(0.1, 0.1, 0.25, ampl=1, freq=drive_freq)
    ts3, xs3 = rungekutta.rk4(pfunc2, 0.0,
                              numpy.array([3.0, 0.1], dtype=numpy.float64),
                              0.02, 250000)
    xs3[0, :] = numpy.array([pendulum.mod2pi(x) for x in xs3[0, :]],
                            dtype=numpy.float64)
    points3 = xs3.transpose()
    ps4 = poincare.section(ts3, points3, interval=2 * numpy.pi / drive_freq)
    plot.mod2pi(ps4[:, 0],
                ps4[:, 1],
                'k.',
                xlabel=r'$\theta$',
                ylabel=r'$\omega$',
                markersize=0.6,
                title='Poincare section, increased step size',
                file_prefix=_suffixed(file_prefix, '_1d'))
Exemple #7
0
def pr1c(file_prefix):
    drive_freq = 7.4246
    pfunc2 = pendulum.pendulum(0.1, 0.1, 0.25, ampl=1, freq=drive_freq)
    ts2, xs2 = rungekutta.rk4(pfunc2, 0.0,
                              numpy.array([3.0, 0.1], dtype=numpy.float64),
                              0.005, 1000000)
    xs2[0, :] = numpy.array([pendulum.mod2pi(x) for x in xs2[0, :]],
                            dtype=numpy.float64)
    points2 = xs2.transpose()
    ps3 = poincare.section(ts2, points2, interval=2 * numpy.pi / drive_freq)
    plot.mod2pi(ps3[:, 0],
                ps3[:, 1],
                'k.',
                xlabel=r'$\theta$',
                ylabel=r'$\omega$',
                markersize=0.6,
                title='Poincare Section (Chaotic Trajectory)',
                file_prefix=_suffixed(file_prefix, '_1c'))
Exemple #8
0
def pr2x(file_prefix, step, nsteps, title, suffix):
    drive_freq = 7.4246
    pfunc = pendulum.pendulum(0.1, 0.1, 0.25, ampl=1.0, freq=drive_freq)
    ts, xs = rungekutta.rk4(pfunc, 0.0,
                            numpy.array([3.0, 0.1], dtype=numpy.float64), step,
                            nsteps)
    xs[0, :] = numpy.array([pendulum.mod2pi(x) for x in xs[0, :]],
                           dtype=numpy.float64)
    points = xs.transpose()
    ps = poincare.linear(ts, points, interval=2 * numpy.pi / drive_freq)
    plot.mod2pi(ps[:, 0],
                ps[:, 1],
                'k.',
                xlabel=r'$\theta$',
                ylabel=r'$\omega$',
                markersize=0.6,
                title=title,
                file_prefix=_suffixed(file_prefix, suffix))