{"id":19418485,"url":"https://github.com/sudipto3331/integration-using-simpson-s-3-8-rule-numerical-method-implementation-in-python","last_synced_at":"2025-08-25T16:19:45.178Z","repository":{"id":254984735,"uuid":"848174846","full_name":"sudipto3331/Integration-Using-Simpson-s-3-8-Rule-Numerical-Method-Implementation-in-Python","owner":"sudipto3331","description":"This repository contains a Python implementation of Simpson’s 3/8 Rule for numerical integration. The code computes the integral of the function \\( F(x) = x^2 + 5x - 9 \\) over a specified interval using Simpson's 3/8 Rule.","archived":false,"fork":false,"pushed_at":"2024-08-27T09:20:10.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-17T07:47:37.509Z","etag":null,"topics":["numerical-analysis","numerical-methods","python3","simpson-method","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:19:22.000Z","updated_at":"2024-08-27T09:20:45.000Z","dependencies_parsed_at":"2024-08-27T10:50:22.793Z","dependency_job_id":null,"html_url":"https://github.com/sudipto3331/Integration-Using-Simpson-s-3-8-Rule-Numerical-Method-Implementation-in-Python","commit_stats":null,"previous_names":["sudipto3331/integration-using-simpson-s-3-8-rule-numerical-method-implementation-in-python"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sudipto3331/Integration-Using-Simpson-s-3-8-Rule-Numerical-Method-Implementation-in-Python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudipto3331%2FIntegration-Using-Simpson-s-3-8-Rule-Numerical-Method-Implementation-in-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudipto3331%2FIntegration-Using-Simpson-s-3-8-Rule-Numerical-Method-Implementation-in-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudipto3331%2FIntegration-Using-Simpson-s-3-8-Rule-Numerical-Method-Implementation-in-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sudipto3331%2FIntegration-Using-Simpson-s-3-8-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-3-8-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-3-8-Rule-Numerical-Method-Implementation-in-Python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272094141,"owners_count":24872299,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["numerical-analysis","numerical-methods","python3","simpson-method","simpson-rule"],"created_at":"2024-11-10T13:14:06.119Z","updated_at":"2025-08-25T16:19:45.135Z","avatar_url":"https://github.com/sudipto3331.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Integration Using Simpson’s 3/8 Rule Numerical Method Implementation in Python\n\nThis repository contains a Python implementation of Simpson’s 3/8 Rule for numerical integration. The code computes the integral of the function \\( F(x) = x^2 + 5x - 9 \\) over a specified interval using Simpson's 3/8 Rule.\n\n### Table of Contents\n- [Simpson’s 3/8 Rule Theory](#simpsons-38-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 3/8 Rule Theory\nSimpson's 3/8 Rule is a method for numerical integration that estimates the value of a definite integral by interpolating the integrand using polynomial segments. This rule divides the interval into smaller segments, applying a weighted average at various points to obtain a more accurate approximation of the integral.\n\n**Formula:**\nFor \\( n \\) intervals where \\( n \\) is divisible by 3:\n\\[\n\\int_a^b f(x) \\, dx \\approx \\frac{3h}{8} \\left[ f(x_0) + 3f(x_1) + 3f(x_2) + 2f(x_3) + \\ldots + f(x_n) \\right]\n\\]\nWhere:\n- \\( h = \\frac{b-a}{n} \\)\n\n### Dependencies\nThis implementation does not require any external libraries; it uses standard Python functions.\n\n### Installation\nNo additional installation is required. Ensure you have Python installed on your system.\n\n### Usage\n1. Clone the repository.\n2. Run the script using Python:\n    ```sh\n    python simpsons_38_rule.py\n    ```\n3. Input the required parameters when prompted:\n    - Enter the lower limit of integration.\n    - Enter the upper limit of integration.\n    - Enter the step size (number of sub-intervals).\n\n4. The script will calculate the integral and display the result.\n\n### Code Explanation\nThe code defines a function `F(x)` representing the integrand and another function `Simpsons_38_interpolation(a, b, n)` to compute the integral using Simpson’s 3/8 Rule. The main program prompts the user for input values and computes the integration.\n\nBelow is a snippet from the code illustrating the main logic:\n\n```python\ndef F(x):\n    return x**2 + 5*x - 9\n\ndef Simpsons_38_interpolation(a, b, n):\n    h = (b - a) / n\n    integration = 0\n    for i in range(n):\n        x0 = a + i * h\n        x1 = x0 + h / 3\n        x2 = x1 + h / 3\n        x3 = a + (i + 1) * h\n        val = (h * (F(x0) + 3 * F(x1) + 3 * F(x2) + F(x3))) / 8\n        integration += val\n    return integration\n\nprint(\"____Simpson's 3/8 Rule____\")\na = float(input(\"Enter the lower limit: \"))\nb = float(input(\"Enter the upper limit: \"))\nstep_size = int(input(\"Enter the number of intervals (step size): \"))\nintegration = Simpsons_38_interpolation(a, b, step_size + 1)\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_38_rule.py\n    ```\n\n2. **Enter the input values**:\n    ```\n    Enter the lower limit: 0\n    Enter the upper limit: 2\n    Enter the number of intervals (step size): 3\n    ```\n\n3. **Output**:\n    - The script will calculate the integration using Simpson's 3/8 Rule and print the result:\n    ```\n    Integrated value = 10.666667\n    ```\n\n### Files in the Repository\n- `simpsons_38_rule.py`: The main script for performing the integration using Simpson's 3/8 Rule.\n\n### Input Parameters\nThe script prompts for the following input values:\n- Lower limit of integration (`a`).\n- Upper limit of integration (`b`).\n- Number of sub-intervals (`n`, which must be a multiple of 3).\n\n### Troubleshooting\n1. **Interval Size**: Ensure that the number of intervals entered is a multiple of 3 to apply Simpson’s 3/8 rule.\n2. **Function Definition**: The function \\( F(x) = x^2 + 5x - 9 \\) is hardcoded. Modify this function as necessary to integrate a different function.\n3. **Python Version**: This script is compatible with Python 3. Ensure you have Python 3 installed.\n\n## Author\nScript created by [Your Name].\n\n---\n\nThis documentation should guide you through understanding, installing, and using the Simpson’s 3/8 Rule script for numerical integration. For further issues or feature requests, please open an issue in the repository. 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-3-8-rule-numerical-method-implementation-in-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsudipto3331%2Fintegration-using-simpson-s-3-8-rule-numerical-method-implementation-in-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsudipto3331%2Fintegration-using-simpson-s-3-8-rule-numerical-method-implementation-in-python/lists"}