{"id":15020418,"url":"https://github.com/yalishanda42/py-polynomial","last_synced_at":"2025-03-26T13:31:40.290Z","repository":{"id":34934515,"uuid":"138221847","full_name":"yalishanda42/py-polynomial","owner":"yalishanda42","description":"A python package attempting to fully implement single-variable polynomials and methods related to them.","archived":false,"fork":false,"pushed_at":"2023-08-30T09:59:33.000Z","size":726,"stargazers_count":16,"open_issues_count":6,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T19:48:21.632Z","etag":null,"topics":["algebra","derivatives","hacktoberfest","numpy","package","pip3","polynomials","pypi","pypi-package","python","scipy"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/py-polynomial","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/yalishanda42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","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},"funding":{"github":"yalishanda42","ko_fi":"yalishanda42"}},"created_at":"2018-06-21T21:07:39.000Z","updated_at":"2024-11-04T15:54:53.000Z","dependencies_parsed_at":"2024-09-23T01:30:55.650Z","dependency_job_id":null,"html_url":"https://github.com/yalishanda42/py-polynomial","commit_stats":{"total_commits":303,"total_committers":6,"mean_commits":50.5,"dds":0.4257425742574258,"last_synced_commit":"f320be81df724a7e1a630900fc64cdf7cecde292"},"previous_names":["allexks/py-polynomial"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yalishanda42%2Fpy-polynomial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yalishanda42%2Fpy-polynomial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yalishanda42%2Fpy-polynomial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yalishanda42%2Fpy-polynomial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yalishanda42","download_url":"https://codeload.github.com/yalishanda42/py-polynomial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245662919,"owners_count":20652099,"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":["algebra","derivatives","hacktoberfest","numpy","package","pip3","polynomials","pypi","pypi-package","python","scipy"],"created_at":"2024-09-24T19:55:03.896Z","updated_at":"2025-03-26T13:31:39.492Z","avatar_url":"https://github.com/yalishanda42.png","language":"Python","funding_links":["https://github.com/sponsors/yalishanda42","https://ko-fi.com/yalishanda42"],"categories":[],"sub_categories":[],"readme":"# Python package defining single-variable polynomials and operations with them\n\n[![PyPI version](https://badge.fury.io/py/py-polynomial.svg)](https://badge.fury.io/py/py-polynomial)\n[![Downloads](https://static.pepy.tech/personalized-badge/py-polynomial?period=total\u0026units=none\u0026left_color=grey\u0026right_color=brightgreen\u0026left_text=Downloads)](https://pepy.tech/project/py-polynomial)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/py-polynomial.svg)](https://pypi.python.org/pypi/py-polynomial/)\n[![PyPI license](https://img.shields.io/pypi/l/py-polynomial.svg)](https://pypi.python.org/pypi/py-polynomial/)\n\n![Unit Tests](https://github.com/yalishanda42/py-polynomial/workflows/Unit%20Tests/badge.svg)\n![Code Documentation Style](https://github.com/yalishanda42/py-polynomial/workflows/Code%20Documentation%20Style/badge.svg)\n[![CodeFactor](https://www.codefactor.io/repository/github/yalishanda42/py-polynomial/badge)](https://www.codefactor.io/repository/github/allexks/py-polynomial)\n[![codecov](https://codecov.io/gh/allexks/py-polynomial/branch/master/graph/badge.svg)](https://codecov.io/gh/allexks/py-polynomial)\n\n## Installation\n`pip install py-polynomial`\n\n## Documentation\n[Click here for code-derived documentation and help](https://yalishanda42.github.io/py-polynomial/)\n\n## Quick examples\n### Flexible initialization\n``` pycon\n\u003e\u003e\u003e from polynomial import Polynomial\n\n\u003e\u003e\u003e a = Polynomial(1, 2, 3, 4)\n\u003e\u003e\u003e str(a)\nx^3 + 2x^2 + 3x + 4\n\n\u003e\u003e\u003e b = Polynomial([4 - x for x in range(4)])\n\u003e\u003e\u003e str(b)\n4x^3 + 3x^2 + 2x + 1\n```\n\n### First derivative\n``` pycon\n\u003e\u003e\u003e b.derivative\nPolynomial(12, 6, 2)\n\n\u003e\u003e\u003e str(b.derivative)\n12x^2 + 6x + 2\n```\n\n### Second or higher derivative\n``` pycon\n\u003e\u003e\u003e str(b.nth_derivative(2))\n24x + 6\n```\n\n### Addition\n``` pycon\n\u003e\u003e\u003e str(a + b)\n5x^3 + 5x^2 + 5x + 5\n```\n\n### Calculating value for a given x\n``` pycon\n\u003e\u003e\u003e (a + b).calculate(5)\n780\n\n\u003e\u003e\u003e а(2)  #  equivalent to a.calculate(2)\n26\n```\n\n### Multiplication\n``` pycon\n\u003e\u003e\u003e p = Polynomial(1, 2) * Polynomial(1, 2)\n\u003e\u003e\u003e p\nPolynomial(1, 4, 4)\n```\n\n### Accessing coefficient by degree\n``` pycon\n\u003e\u003e\u003e p[0] = -4\n\u003e\u003e\u003e p\nPolynomial(1, 4, -4)\n```\n\n### Slicing\n``` pycon\n\u003e\u003e\u003e p[1:] = [4, -1]\n\u003e\u003e\u003e p\nPolynomial(-1, 4, -4)\n```\n\n### Accessing coefficients by name convention\n``` pycon\n\u003e\u003e\u003e (p.a, p.b, p.c)\n(-1, 4, -4)\n\n\u003e\u003e\u003e p.a, p.c = 1, 4\n\u003e\u003e\u003e (p.A, p.B, p.C)\n(1, 4, 4)\n```\n\n### Division and remainder\n``` pycon\n\u003e\u003e\u003e q, remainder = divmod(p, Polynomial(1, 2))\n\u003e\u003e\u003e q\nPolynomial(1.0, 2.0)\n\u003e\u003e\u003e remainder\nPolynomial()\n\n\u003e\u003e\u003e p // Polynomial(1, 2)\nPolynomial(1.0, 2.0)\n\n\u003e\u003e\u003e P(1, 2, 3) % Polynomial(1, 2)\nPolynomial(3)\n```\n\n### Check whether it contains given terms\n``` pycon\n\u003e\u003e\u003e Polynomial(2, 1) in Polynomial(4, 3, 2, 1)\nTrue\n```\n\n### Definite integral\n```pycon\n\u003e\u003e\u003e Polynomial(3, 2, 1).integral(0, 1)\n3\n```\n\n### Misc\n``` pycon\n\u003e\u003e\u003e str(Polynomial(\"abc\"))\nax^2 + bx + c\n```\n\n### Roots and discriminants\n``` pycon\n\u003e\u003e\u003e from polynomial import QuadraticTrinomial, Monomial\n\u003e\u003e\u003e y = QuadraticTrinomial(1, -2, 1)\n\u003e\u003e\u003e str(y)\nx^2 - 2x + 1\n\n\u003e\u003e\u003e y.discriminant\n0\n\n\u003e\u003e\u003e y.real_roots\n(1, 1)\n\n\u003e\u003e\u003e y.real_factors\n(1, Polynomial(1, -1), Polynomial(1, -1))\n\n\u003e\u003e\u003e str(Monomial(5, 3))\n5x^3\n\n\u003e\u003e\u003e y += Monomial(9, 2)\n\u003e\u003e\u003e y\nPolynomial(10, -2, 1)\n\n\u003e\u003e\u003e str(y)\n10x^2 - 2x + 1\n\n\u003e\u003e\u003e (y.a, y.b, y.c)\n(10, -2, 1)\n\n\u003e\u003e\u003e (y.A, y.B, y.C)\n(10, -2, 1)\n\n\u003e\u003e\u003e y.complex_roots\n((0.1 + 0.3j), (0.1 - 0.3j))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyalishanda42%2Fpy-polynomial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyalishanda42%2Fpy-polynomial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyalishanda42%2Fpy-polynomial/lists"}