{"id":18495206,"url":"https://github.com/matheuscavini/numerical-methods","last_synced_at":"2026-01-03T02:58:09.471Z","repository":{"id":178146578,"uuid":"657823799","full_name":"MatheusCavini/Numerical-Methods","owner":"MatheusCavini","description":"Python library including some of the most common numerical methods, based on the course \"Numerical Methods and Applications (MAT3121)\" from Escola Politécnica da Universidade de São Paulo.","archived":false,"fork":false,"pushed_at":"2024-07-13T15:49:12.000Z","size":31,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T10:23:06.369Z","etag":null,"topics":["calculus","interpolation-methods","numerical-integration","numerical-methods","ode-solver","python","zeros-function-methods"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MatheusCavini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-06-24T00:17:47.000Z","updated_at":"2024-07-15T12:06:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"cf4e2c87-5023-4fa4-9f23-29a1c8b9e2fc","html_url":"https://github.com/MatheusCavini/Numerical-Methods","commit_stats":null,"previous_names":["matheuscavini/numerical-methods"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatheusCavini%2FNumerical-Methods","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatheusCavini%2FNumerical-Methods/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatheusCavini%2FNumerical-Methods/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatheusCavini%2FNumerical-Methods/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatheusCavini","download_url":"https://codeload.github.com/MatheusCavini/Numerical-Methods/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243954842,"owners_count":20374364,"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":["calculus","interpolation-methods","numerical-integration","numerical-methods","ode-solver","python","zeros-function-methods"],"created_at":"2024-11-06T13:23:53.307Z","updated_at":"2026-01-03T02:58:09.444Z","avatar_url":"https://github.com/MatheusCavini.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Numerical-Methods\n## Introduction\n\nThis projetcos consists of a Python library including some of the most common numerical methods, based on contents of the course \"Numerical Methods and Applications (MAT3121)\" from Escola Politécnica da Universidade de São Paulo. **This is a work in progress and other functions are yet to be implemented.**\n\n## Implemented Methods\n\n### Zeros of Functions\nThis group of functions in the library implements methods for finding the zero of a function $f$ inside a given interval $[a,b]$.\n-  **Bissection Method** - `zeros.bissection`: Takes a function `f`, the limits of the interval `a` and `b`, and optionaly the number of iterations `N` or maximum error `e`. Returns the zero of the function inside the interval, which may be not unique.\n- **Fixed Point Method** - `zeros.fixedPoint`: Takes a function `f`, an initial estimative `p0`and optionaly the number of iterations `N`. Returns the fixed point of the function.\n- **Newton's Method** - `zeros.Newton`: Takes a function `f`, an initial estimative `p0`and optionaly the number of iterations `N`. Returns the zero of the function to which Newton's method converge.\n\n### Derivatives\nThis group of functions is used to calculate the derivative of a function $f$ at a given point $p$.\n- **Central** - `derivative.central`: Takes a function `f`, a point `p` and optionaly the step size `h`. Returns the derivative at $f(p)$, using the central method with step `h`.\n- **Forward** - `derivative.forward`: Takes a function `f`, a point `p` and optionaly the step size `h`. Returns the derivative at $f(p)$, using the forward method with step `h`.\n- **Backward** - `derivative.backward`: Takes a function `f`, a point `p` and optionaly the step size `h`. Returns the derivative at $f(p)$, using the backward method with step `h`.\n\n### Integration\nThis group of functions is used to calculate the integral of a function $f$ in the interval $[a,b]$.\n- **Trapezoidal rule** - `integration.trapezoidal`: Takes a function `f`, two points `a` and `b`, and a number of divisions `N`in the interval. Returns the numerical value of the integral.\n- **Simpson's rule** - `integration.Simpson`: Takes a function `f`, two points `a` and `b`, and a number of divisions `N`in the interval. Returns the numerical value of the integral.\n\n### ODE Solver\nThis group of functions is used to solve 1st order ODE or systems of 1st order ODEs, in which the equations $y'_n(t) = f(t, y_1(t), y_2(t), ... )$ are passed in the form of a vector, along with their initial values $y_n(t_0)=y_{n,0}$. The solution is calculated for discrete time steps of size $h$, between $t_0$ and $t_f$.\n- **Euler's method** - `ode.Euler`: takes the list or array which represents the system of ODEs, the list or array of their initial values, initial time `t0`, end time `tf` and optionally the step size `h`. Returns a tuple containing: 1) Discrete time vector for which solutions are calculated; 2) An array in which each row is the solution for an ODE of the system.\n- **Runge-Kutta of 2nd order** - `ode.RK2`: takes the list or array which represents the system of ODEs, the list or array of their initial values, initial time `t0`, end time `tf` and optionally the step size `h`. Returns a tuple containing: 1) Discrete time vector for which solutions are calculated; 2) An array in which each row is the solution for an ODE of the system.\n- **Runge-Kutta of 4th order** - `ode.RK4`: takes the list or array which represents the system of ODEs, the list or array of their initial values, initial time `t0`, end time `tf` and optionally the step size `h`. Returns a tuple containing: 1) Discrete time vector for which solutions are calculated; 2) An array in which each row is the solution for an ODE of the system.\n\n\nExample of use:\n```python\n#Define the ODEs as functions of t and of \ndy1 = lambda t, y: y[1]   #y0'(t) =  y1(t)\ndy2 = lambda t, y: -y[0] - 0.5*y[1] #y1'(t) = -y0(t) - 0.5y1(t)\n\n#Pass the functions as a list to method\ntime, solutions = ode.RK4([dy1, dy2],[1,0],0, 50, 0.01)\n\n#Use the vectors returned to plot the behavior\nplt.plot(tempo, solutions[0], linewidth=2)\nplt.plot(tempo, solutions[1], linewidth=1)\nplt.xlabel(\"Time (s)\")\nplt.ylabel(\"y(t)\")\nplt.show()\n```\n\n\n\n## Usage\nThis library is not inteded to be published at PyPI.\nIf you want to use or try it on your machine:\n1. Install Git on your machine, via https://git-scm.com/downloads.\n2. Clone this repository to your machine. (more on how to do this [here](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)).\n3. Locate the file `NumMethPy-0.1.0-py3-none-any.whl` insider `dist`folder.\n4. Run `pip install your-path-to/NumMethPy-0.1.0-py3-none-any.whl` to install library.\n5. Use it on your programs via `import NumMethPy`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheuscavini%2Fnumerical-methods","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatheuscavini%2Fnumerical-methods","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheuscavini%2Fnumerical-methods/lists"}