{"id":19418487,"url":"https://github.com/sudipto3331/integration-using-simpson-s-1-3-rule-numerical-method-implementation-in-python","last_synced_at":"2025-06-25T07:07:18.344Z","repository":{"id":254983802,"uuid":"848171143","full_name":"sudipto3331/Integration-Using-Simpson-s-1-3-Rule-Numerical-Method-Implementation-in-Python","owner":"sudipto3331","description":"This repository contains a Python implementation of Simpson's 1/3 Rule for numerical integration. The code estimates the integral of a given function \\( f(x) \\) within specified limits using Simpson's 1/3 Rule, a method for approximating the definite integral of a function.","archived":false,"fork":false,"pushed_at":"2024-08-27T09:14:13.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T03:42:17.461Z","etag":null,"topics":["integration","methods","numerical","numerical-methods","python3","simpson-rule"],"latest_commit_sha":null,"homepage":"http://sudiptomondal.me/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sudipto3331.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-27T09:10:46.000Z","updated_at":"2024-08-27T09:14:52.000Z","dependencies_parsed_at":"2024-08-27T10:30:32.345Z","dependency_job_id":"62f1ae7f-2810-4ec7-b4e4-d93d60854807","html_url":"https://github.com/sudipto3331/Integration-Using-Simpson-s-1-3-Rule-Numerical-Method-Implementation-in-Python","commit_stats":null,"previous_names":["sudipto3331/integration-using-simpson-s-1-3-rule-numerical-method-implementation-in-python"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sudipto3331/Integration-Using-Simpson-s-1-3-Rule-Numerical-Method-Implementation-in-Python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudipto3331%2FIntegration-Using-Simpson-s-1-3-Rule-Numerical-Method-Implementation-in-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudipto3331%2FIntegration-Using-Simpson-s-1-3-Rule-Numerical-Method-Implementation-in-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudipto3331%2FIntegration-Using-Simpson-s-1-3-Rule-Numerical-Method-Implementation-in-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudipto3331%2FIntegration-Using-Simpson-s-1-3-Rule-Numerical-Method-Implementation-in-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sudipto3331","download_url":"https://codeload.github.com/sudipto3331/Integration-Using-Simpson-s-1-3-Rule-Numerical-Method-Implementation-in-Python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudipto3331%2FIntegration-Using-Simpson-s-1-3-Rule-Numerical-Method-Implementation-in-Python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261823770,"owners_count":23215145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["integration","methods","numerical","numerical-methods","python3","simpson-rule"],"created_at":"2024-11-10T13:14:06.302Z","updated_at":"2025-06-25T07:07:18.313Z","avatar_url":"https://github.com/sudipto3331.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Integration Using Simpson’s 1/3 Rule Numerical Method Implementation in Python\n\nThis repository contains a Python implementation of Simpson's 1/3 Rule for numerical integration. The code estimates the integral of a given function \\( f(x) \\) within specified limits using Simpson's 1/3 Rule, a method for approximating the definite integral of a function.\n\n## Table of Contents\n- [Simpson’s 1/3 Rule Theory](#simpsons-13-rule-theory)\n- [Dependencies](#dependencies)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Code Explanation](#code-explanation)\n- [Example](#example)\n- [Files in the Repository](#files-in-the-repository)\n- [Input Parameters](#input-parameters)\n- [Troubleshooting](#troubleshooting)\n- [Author](#author)\n\n## Simpson’s 1/3 Rule Theory\n\nSimpson’s 1/3 Rule is a method for numerical integration that approximates the integral of a function by fitting parabolas to segments of the function over the specified interval. It is particularly effective when the function is relatively smooth.\n\n### Formula:\nThe formula for Simpson's 1/3 Rule is as follows:\n\\[\n\\int_{a}^{b} f(x) \\, dx \\approx \\frac{h}{3} \\left[ f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + \\ldots + 4f(x_{n-1}) + f(x_n) \\right]\n\\]\nwhere:\n- \\( h = \\frac{b - a}{n} \\)\n- \\( n \\) is an even number of subintervals.\n\n### Note:\nFor Simpson's 1/3 Rule to be applicable, the number of segments \\( n \\) must be even.\n\n## Dependencies\nTo run this code, you only need the built-in Python libraries. This script does not require any external libraries.\n\n## Installation\nSimply clone the repository or copy the script into your desired working directory.\n\n## Usage\n1. Clone the repository.\n2. Run the script using Python:\n    ```sh\n    python simpsons_13_rule.py\n    ```\n3. Provide the required input when prompted:\n    - Enter the lower limit.\n    - Enter the upper limit.\n    - Enter the number of segments (must be even).\n\n## Code Explanation\nThe code defines a function for \\( f(x) \\), which is the function we want to integrate. It includes a main function that applies Simpson's 1/3 Rule to calculate the integral over the specified limits.\n\nHere is a breakdown of the code:\n\n```python\ndef F(x):\n    return x*x  # The function to integrate (x^2)\n\ndef Simpsons_13_interpolation(a, b, n):\n    h = (b - a) / n  # Compute the width of each segment\n    integration = 0\n    for i in range(n):\n        x0 = a + i * h\n        x1 = x0 + h / 2\n        x2 = a + (i + 1) * h\n        val = h * (F(x0) + 4 * F(x1) + F(x2)) / 6  # Calculate the area for this segment\n        integration += val  # Sum up the area contributions\n    return integration\n\n# User input section\nprint(\"____Simpson's 1/3 Rule____\")\na = float(input(\"Enter the lower limit: \"))\nb = float(input(\"Enter the upper limit: \"))\nstep_size = int(input(\"Enter the number of segments (must be even): \"))\nintegration = Simpsons_13_interpolation(a, b, step_size)\nprint(\"\\nIntegrated value = %.6f\" % (integration))\n```\n\n## Example\nBelow is an example of how to use the script:\n\n1. **Run the script**:\n    ```sh\n    python simpsons_13_rule.py\n    ```\n\n2. **Enter the input values**:\n    ```\n    Enter the lower limit: 0\n    Enter the upper limit: 5\n    Enter the number of segments (must be even): 4\n    ```\n\n3. **Output**:\n    ```\n    Integrated value = 41.666667\n    ```\n\n## Files in the Repository\n- `simpsons_13_rule.py`: The main script for performing integration using Simpson's 1/3 Rule.\n\n## Input Parameters\nThe script prompts for the following input values:\n- **Lower Limit (a)**: The lower bound of the definite integral.\n- **Upper Limit (b)**: The upper bound of the definite integral.\n- **Number of Segments (n)**: The number of segments over which to perform the integration (must be even).\n\n## Troubleshooting\n1. **Input Values**: Ensure that the input values are appropriate for the function being integrated and cover the range of interest.\n2. **Number of Segments**: Make sure that \\( n \\) (the number of segments) is an even number.\n3. **Python Version**: This script is compatible with Python 3. Ensure you have Python 3 installed.\n\n## Author\nScript created by sudipto3331.\n\n---\n\nThis documentation should guide you through understanding, installing, and using the Simpson’s 1/3 Rule script for numerical integration. For further issues or feature requests, please open an issue in the repository on GitHub. Feel free to contribute by creating issues and submitting pull requests. Happy coding!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudipto3331%2Fintegration-using-simpson-s-1-3-rule-numerical-method-implementation-in-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsudipto3331%2Fintegration-using-simpson-s-1-3-rule-numerical-method-implementation-in-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudipto3331%2Fintegration-using-simpson-s-1-3-rule-numerical-method-implementation-in-python/lists"}