{"id":16130535,"url":"https://github.com/afcms/math_algorithms","last_synced_at":"2025-04-06T14:17:26.396Z","repository":{"id":103042069,"uuid":"581302633","full_name":"AFCMS/math_algorithms","owner":"AFCMS","description":null,"archived":false,"fork":false,"pushed_at":"2023-11-21T13:22:24.000Z","size":413,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T20:21:51.585Z","etag":null,"topics":["math","python"],"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/AFCMS.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}},"created_at":"2022-12-22T20:13:01.000Z","updated_at":"2022-12-22T20:14:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"efb03e82-2ac8-48eb-b1a8-e79ddc195b6f","html_url":"https://github.com/AFCMS/math_algorithms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AFCMS%2Fmath_algorithms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AFCMS%2Fmath_algorithms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AFCMS%2Fmath_algorithms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AFCMS%2Fmath_algorithms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AFCMS","download_url":"https://codeload.github.com/AFCMS/math_algorithms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247492549,"owners_count":20947545,"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":["math","python"],"created_at":"2024-10-09T22:16:43.697Z","updated_at":"2025-04-06T14:17:26.365Z","avatar_url":"https://github.com/AFCMS.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Math Algorithms\n\nSome algorithms I made to understand maths better.\n\n| Name                          | Status | Tests? |\n|-------------------------------|--------|--------|\n| [Binomial Law](#binomial-law) | Done   | ✅      |\n| [Matrix](#matrix)             | WIP    | ✅      |\n| Sequences                     | WIP    | ❌      |\n| Vectors                       | TODO   | ❌      |\n\n## Binomial law\n\n```python\nfrom binomial_law import *\n\n# Binomial law of parameters n = 10 and p = 0.2\nX = Binomial(10, 0.2)\n\nprint(f\"X -\u003e {X}\")\nprint(f\"Expectation of X: {X.expected}\")\nprint(f\"Variance of X:  {X.variance}\")\nprint(f\"Sigma of X:  {X.sigma}\")\nprint(f\"P(X=8)  = {X == 8}\")\nprint(f\"P(X\u003e8)  = {X \u003e 8}\")\nprint(f\"P(X\u003e=8) = {X \u003e= 8}\")\nprint(f\"P(X\u003c8)  = {X \u003c 8}\")\nprint(f\"P(X\u003c=8) = {X \u003c= 8}\")\n```\n\nAlso provide function to visualize a law using `matplotlib.pyplot`:\n\n```python\nfrom binomial_law import *\n\nX = Binomial(10, 0.2)\n\nshow_graph(X)\n```\n\n![PyCharm Binomial Law](images/binomial_law.png)\n\n# Matrix\n\n```python\nfrom matrix import Matrix\n\nA = Matrix([\n\t[1, 2, 3],\n\t[0, 4, -1],\n])\n\nassert A.size == (2, 3)\nassert A.is_square == False\nassert A.is_line == False\nassert A.is_column == False\n\nB = Matrix([\n\t[1, 0, 0],\n\t[0, 2, 0],\n\t[0, 0, 0],\n])\n\nassert B.size == (3, 3)\nassert B.is_square == True\nassert B.is_line == False\nassert B.is_column == False\n\nassert A * B == Matrix([\n\t[1, 4, 0],\n\t[0, 8, 0]\n])\n\nassert -A == Matrix([\n\t[-1, -2, -3],\n\t[0, -4, 1],\n])\n\nI2 = Matrix.identity(2)\n\nO2 = Matrix.null(2)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafcms%2Fmath_algorithms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafcms%2Fmath_algorithms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafcms%2Fmath_algorithms/lists"}