<commit_before>#!/usr/bin/env python

"""
Integrating the driven pendulum.
"""

import math
from matplotlib import pyplot
from mathsci.physics import mechanics
from mathsci.math import odeint

def main():
    # Set the integration paramters
    f = mechanics.driven_pendulum
    dt = 0.0035
    t0 = 0.0
    X0 = [0.0, 0.0]

    # Set constants
    l = 0.1
    a = 5.0
    omegad = 10.0

    # Integrate it...

    # Using RK4:
    drivpend = odeint.RK4(f, t0, X0, l=l, a=a, omegad=omegad)
    drivpend.integrate(dt, 10000, True)

    # Unpack data
    t = drivpend.t
    theta, omega = drivpend.unpack()

    # Plot it
    fig1 = pyplot.figure()
    fig1_sp1 = fig1.add_subplot(111)
    fig1_sp1.plot(t, theta)
    fig1_sp1.set_xlabel("Time [s]")
    fig1_sp1.set_ylabel("Angle from vertical [rad]")

    fig2 = pyplot.figure()
    fig2_sp1 = fig2.add_subplot(111)
    fig2_sp1.plot(t, omega)
    fig2_sp1.set_xlabel("Time [s]")
    fig2_sp1.set_ylabel("Angular velocity [rad/s]")

    pyplot.show()

if __name__ == "__main__":
    main()<commit_msg>Fixed plotting<commit_after>#!/usr/bin/env python

"""
Integrating the driven pendulum.
"""

import math
from matplotlib import pyplot
from mathsci.physics import mechanics
from mathsci.math import odeint

def main():
    # Set the integration paramters
    f = mechanics.driven_pendulum
    dt = 0.0035
    t0 = 0.0
    X0 = [0.0, 0.0]

    # Set constants
    l = 0.1
    a = 5.0
    omegad = 10.0

    # Integrate it...

    # Using RK4:
    drivpend = odeint.RK4(f, t0, X0, l=l, a=a, omegad=omegad)
    drivpend.integrate(dt, 10000, True)

    # Unpack data
    t = drivpend.t
    theta, omega = drivpend.unpack()

    # Plot it
    fig1 = pyplot.figure()
    fig1_sp1 = fig1.add_subplot(111)
    fig1_sp1.plot(t, theta)
    fig1_sp1.set_xlabel("Time [s]")
    fig1_sp1.set_ylabel("Angle from vertical [rad]")

    pyplot.show()

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.12643080124869926, 'fraction_numerical': 0.050468262226847034, 'mean_word_length': 2.7412451361867705, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6799159', 'n_tokens_mistral': 827, 'n_tokens_neox': 761, 'n_words': 177}