<commit_before>function diffraction_envelope(y, lambda, a, L) {
    // Compute the relative intensity for a diffraction envelope (Franhofer
    // approximation) on a screen at a distance y from the center.
    //
    // Parameters
    // ----------
    // y: float
    //    Position on screen
    // lambda: float
    //    Wavelength of incident light
    // a: float
    //    Width of each slit
    // L: float
    //    Distance between slits and screen
    //
    var intensity = 0
    var x = Math.PI * a * y / (lambda * L);

    if (x != 0) {
        intensity = Math.pow(Math.sin(x) / x, 2);
    } else {
        intensity = 1
    }
    return intensity;
}

function relative_intensity(y, lambda, a, d, n, L) {
    // Compute the relative intensity for a diffraction pattern (Franhofer
    // approximation) on a screen at a distance y from the center.
    //
    // Parameters
    // ----------
    // y: float
    //    Position on screen
    // lambda: float
    //    Wavelength of incident light
    // a: float
    //    Width of each slit
    // d: float
    //    Distance between adjacent slits
    // n: integer
    //    Number of slits
    // L: float
    //    Distance between slits and screen
    //
    var x = Math.PI * a * y / (lambda * L);
    var z = Math.PI * y * d / (lambda * L);
    var intensity = Math.pow(Math.sin(x) / x * Math.sin(n * z) / Math.sin(z), 2);
    return intensity;
}

function get_parameters() {
    // Return an array containing the physical parameters of the diffraction
    // experiment.  By default, assume 650 nm wavelength, 2 slits and a screen
    // that is at 1 m from the slits.<commit_msg>Proper interference<commit_after>function diffraction_envelope(y, lambda, a, L) {
    // Compute the relative intensity for a diffraction envelope (Franhofer
    // approximation) on a screen at a distance y from the center.
    //
    // Parameters
    // ----------
    // y: float
    //    Position on screen
    // lambda: float
    //    Wavelength of incident light
    // a: float
    //    Width of each slit
    // L: float
    //    Distance between slits and screen
    //
    var intensity = 1;
    var x = Math.PI * a * y / (lambda * L);

    if (x != 0) {
        intensity = Math.pow(Math.sin(x) / x, 2);
    }
    return intensity;
}

function relative_intensity(y, lambda, a, d, n, L) {
    // Compute the relative intensity for a diffraction pattern (Franhofer
    // approximation) on a screen at a distance y from the center.
    //
    // Parameters
    // ----------
    // y: float
    //    Position on screen
    // lambda: float
    //    Wavelength of incident light
    // a: float
    //    Width of each slit
    // d: float
    //    Distance between adjacent slits
    // n: integer
    //    Number of slits
    // L: float
    //    Distance between slits and screen
    //
    var x = Math.PI * a * y / (lambda * L);
    var z = Math.PI * y * d / (lambda * L);
    var sinx_over_x = 1;

    if (x != 0) {
        sinx_over_x = Math.sin(x) / x;
    }

    var intensity = Math.pow(sinx_over_x * Math.sin(n * z) / Math.sin(z), 2);
    return intensity;
}

function get_parameters() {
    // Return an array containing the physical parameters of the diffraction
    // experiment.  By default, assume 650 nm wavelength, 2 slits and a screen
    // that is at 1 m from the slits.
{'fraction_non_alphanumeric': 0.12128418549346016, 'fraction_numerical': 0.00624256837098692, 'mean_word_length': 1.760459392945037, 'pattern_counts': {'":': 0, '<': 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': '5493968', 'n_tokens_mistral': 1058, 'n_tokens_neox': 996, 'n_words': 387}