{"id":30846284,"url":"https://github.com/cycno/minimath","last_synced_at":"2026-06-15T20:31:08.866Z","repository":{"id":312690386,"uuid":"1048366827","full_name":"CYCNO/minimath","owner":"CYCNO","description":"A Simple math Lib purely built in python without any external lib like math","archived":false,"fork":false,"pushed_at":"2026-05-14T11:43:52.000Z","size":4822,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-14T13:39:38.757Z","etag":null,"topics":["math","mathemati","pyth"],"latest_commit_sha":null,"homepage":"","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/CYCNO.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-01T10:34:07.000Z","updated_at":"2026-05-14T11:43:55.000Z","dependencies_parsed_at":"2025-09-01T12:44:07.122Z","dependency_job_id":"db54a395-e70d-4246-a96b-31e66c3884ab","html_url":"https://github.com/CYCNO/minimath","commit_stats":null,"previous_names":["cycno/minimath"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CYCNO/minimath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CYCNO%2Fminimath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CYCNO%2Fminimath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CYCNO%2Fminimath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CYCNO%2Fminimath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CYCNO","download_url":"https://codeload.github.com/CYCNO/minimath/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CYCNO%2Fminimath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34379915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"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":["math","mathemati","pyth"],"created_at":"2025-09-07T00:06:39.727Z","updated_at":"2026-06-15T20:31:08.860Z","avatar_url":"https://github.com/CYCNO.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"image/logo.png\" height=\"200\"\u003e\n  \u003ch1 align=\"center\"\u003eMiniMath\u003c/h1\u003e\n  \u003ci\u003eminimath is a lightweight, pure-Python library for performing basic mathematical operations and utilities. It provides essential functions ranging from basic arithmetic to algebra and geometry, all implemented without any external libraries like math or numpy\u003c/i\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n    \u003cimg src=\"https://img.shields.io/badge/version-0.2.2-blue\"\u003e\n\u003c/div\u003e\n\n## Installation\n```\npip install git+https://github.com/CYCNO/minimath.git\n```\n\n## Features\n\n### 🔹 Basic Functions\n- **`factorial(n)`**: Calculate the factorial of a number `n`.\n- **`fibonacci(n)`**: Find the nth Fibonacci number.\n- **`gcd(a, b)`**: Calculate the greatest common divisor (GCD).\n- **`lcm(a, b)`**: Calculate the least common multiple (LCM).\n- **`is_prime(n)`**: Check if a number `n` is prime.\n- **`primes_upto(n)`**: Generate all primes ≤ `n`.\n- **`digit_sum(n)`**: Calculate the sum of the digits of `n`.\n- **`nCr(n, r)`**: Calculate combinations of `n` items taken `r` at a time.\n- **`nPr(n, r)`**: Calculate permutations of `n` items taken `r` at a time.\n- **`make_function(formula)`**: Convert String expression into python function\n\n### 🔹 Algebra / Functions\n- **`quadratic_roots(a, b, c)`**: Solve the quadratic equation `ax² + bx + c = 0`.\n\n### 🔹 Geometry\n- **`distance(p1, p2)`**: Calculate the Euclidean distance between points `p1` and `p2`.\n- **`triangle_area(a, b, c)`**: Calculate the area of a triangle using Heron's formula.\n- **`circle_area(r)`**: Calculate the area of a circle with radius `r`.\n\n### 🔹 Linear Algebra (Matrices)\n- **`Matrix(rows, columns)`**: Initialize a matrix using dimensions or an existing 2D list.\n- **`fill(value)`**: Fill the entire matrix with a specified scalar value.\n- **`random(lower, upper)`**: Fill the entire matrix with random values.\n- **Matrix Addition (`+`)**: Add two matrices together or add a scalar to a matrix.\n- **Matrix Multiplication (`*`)**: Multiply two matrices (dot product) or multiply a matrix by a scalar.\n\n### Calculus (Basic)\n- **`differentiate(formula)`**: Differentiate string formula\n- **`integrate(formula)`**: Integrate string formula\n\n### 🔹 Constants\n- **`pi()`**: Returns First 10 Digits of pi.\n- **`e()`**: Returns First 10 Digits of e.\n\n### Basic Usage\n```py\nfrom minimath import MiniMath\n\nmm = MiniMath()\n\n# Basic Functions\nprint(mm.factorial(5))          # 120\nprint(mm.fibonacci(10))         # 55\nprint(mm.gcd(24, 36))           # 12\nprint(mm.lcm(4, 6))             # 12\nprint(mm.is_prime(7))           # True\nprint(mm.primes_upto(20))       # [2, 3, 5, 7, 11, 13, 17, 19]\nf = mm.make_function(\"4x^2\")  \nprint(f(2))                     # 16.0\n\n# Number Utilities\nprint(mm.digit_sum(123))        # 6\nprint(mm.nCr(5, 2))             # 10\nprint(mm.nPr(5, 2))             # 20\n\n# Algebra / Functions\nprint(mm.quadratic_roots(1, -3, 2))      # [2.0, 1.0]\n\n# Geometry\nprint(mm.distance((0, 0), (3, 4)))        # 5.0\nprint(mm.triangle_area(3, 4, 5))          # 6.0\nprint(mm.circle_area(5))                  # 78.53981633974483\nprint(mm.circle_circumference(5))         # 31.41592653589793\n```\n\n### Matrix\n```py\n# Linear Algebra (Matrices)\nfrom minimath import Matrix\n\n# Creating matrices\nA = Matrix(2, 2)\nA.fill(2)\n\nC = Matrix(2, 2)\nC.random(lower=0, upper=10)\n# [2.168461692098128, 1.4370603430803508]\n# [9.340512613241474, 4.10989315114923]\n\nB = Matrix([[1, 2], [3, 4]])\n\n# Scalar operations\nprint(A + 5)\n# [7, 7]\n# [7, 7]\n\nprint(B * 2)\n# [2, 4]\n# [6, 8]\n\n# Matrix operations\nprint(A + B) # or Matrix.add(A, B)\n# [3, 4]\n# [5, 6]\n\nprint(A * B) # or Matrix.multiply(A, B)\n# Output:\n# [8, 12]\n# [8, 12]\n\n# Get Index Value\nprint(B[0][1])  \n# Output: 2\n```\n### Calculus \n```py\nfrom minimath import Calculus\n\nc = Calculus\nprint(c.integrate(\"4x^2\")) # 1.333x^3\nprint(c.differentiate(\"4x^2\")) # 8x\n\n# Later you can convert these result into function as \nfrom minimath import MiniMath\n\nfunc = c.differentiate(\"4x^2\")\nf = MiniMath.make_function(func)\nprint(f(2)) # 16.0\n```\n\n## Reporting Issues\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to view instructions for reporting issues\u003c/summary\u003e\n\n1. **Check Existing Issues**: Before creating a new issue, check if it’s already reported by searching through the [issues page](https://github.com/CYCNO/minimath/issues).\n\n2. **Create a New Issue**: If the issue isn’t listed, click on **New Issue** and provide:\n   - A clear description of the problem.\n   - Steps to reproduce the issue.\n   - Expected and actual results.\n   - Any relevant code snippets or error messages.\n\nWe appreciate your help in improving **minimath**!\n\n\u003c/details\u003e\n\n\n## Contribution Guide\n\u003cdetails\u003e\n  \u003csummary\u003eClick to view instructions for reporting issues\u003c/summary\u003e\n\nWe welcome contributions to **minimath**! To add a new function:\n\n1. **Create a New Module/Class**: If your function doesn’t fit into existing categories (e.g., basic, algebra, geometry), create a new file and class.\n\n   Example: `number_theory.py`, and a `NumberTheory` class.\n\n2. **Update `MiniMath`**: After adding a new class, update the `MiniMath` class in `minimath.py` to import your new class:\n   ```python\n   from .basic import Basic\n   from .algebra import Algebra\n   from .geometry import Geometry\n   from .your_new_module import YourNewClass\n\n   class MiniMath(Basic, Algebra, Geometry, YourNewClass):\n       pass\n       ```\n3. **Create a Pull Request** : Fork the repo, create a branch for your changes, and submit a pull request.\n\n\u003c/details\u003e\n\n## Changelog\n\u003cdetails\u003e\n\u003csummary\u003eUpdates\u003c/summary\u003e\nv0.2.2:\nadded Basic Calculus\nadded make_function\n\nv0.2.1:\nadded matrix.random()\n\nv0.2.0:\nadded matrix\n\u003c/details\u003e\n\n## License\n- MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycno%2Fminimath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycno%2Fminimath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycno%2Fminimath/lists"}