{"id":18892391,"url":"https://github.com/hf/polynome","last_synced_at":"2026-02-26T06:30:15.137Z","repository":{"id":143824620,"uuid":"41380545","full_name":"hf/polynome","owner":"hf","description":"A simple, generic implementation of polynomials and their arithmetic in Scala.","archived":false,"fork":false,"pushed_at":"2015-09-19T11:31:30.000Z","size":160,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-31T06:29:50.717Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","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/hf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-25T18:24:45.000Z","updated_at":"2015-08-25T18:25:06.000Z","dependencies_parsed_at":"2023-03-21T04:28:09.057Z","dependency_job_id":null,"html_url":"https://github.com/hf/polynome","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/hf%2Fpolynome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fpolynome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fpolynome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fpolynome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hf","download_url":"https://codeload.github.com/hf/polynome/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239868629,"owners_count":19710474,"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":[],"created_at":"2024-11-08T08:01:49.279Z","updated_at":"2026-02-26T06:30:15.096Z","avatar_url":"https://github.com/hf.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"Polynome\n========\n\n[![Build Status](https://travis-ci.org/hf/polynome.svg)](https://travis-ci.org/hf/polynome)\n\nPolynome is a simple implementation of polynomials (and their arithmetic) in\nScala. It solves the problem of having different types of coefficients, namely\n`BigInt`s or even implementing things like polynomial finite fields.\n\nIt uses a recursive, cons-like structure. Terms are immutable and operations\nare recursive.\n\n**Why Scala?**\n\nTurns out you can cleanly and in a type-safe way implement a lot of mathematical\nstructures in Scala. I wish scientific papers were written in Scala.\n\n## Use It\n\nPublished on Sonatype:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eme.stojan\u003c/groupId\u003e\n  \u003cartifactId\u003epolynome_2.11\u003c/artifactId\u003e\n  \u003cversion\u003e0.0.1-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n... or in SBT:\n\n```scala\nlibraryDependencies += \"me.stojan\" %% \"polynome\" % \"0.0.1-SNAPSHOT\"\n```\n\n## Example\n\n```scala\nimport me.stojan.polynome._\nimport me.stojan.polynome.concrete._\n\nval a = BigIntPolynomial(degree = 1, coefficient = 1)\n// a: Polynomial[BigInt] == [+ 1x^1, 0. ]\n\nval b = BigIntPolynomial(degree = 2, coefficient = 1, a)\n// b: Polynomial[BigInt] == [+ 1x^2, [+ 1x^1, 0. ]]\n\nval sum = a + b\n// sum == [+ 1x^2, [+ 2x^1, 0. ]]\n```\n\nThe tests are pretty readable, too.\n\n## Structure\n\nPolynomials should inherit from `Polynomial[V]`. That trait is basically a\ncons on steroids. Essentially, it represents a polynomial term with a pointer\nto terms of a lesser degree. 0-coefficient terms are not valid and should not be\nin the structure. It must terminate with an instance of the special case class\n`NullPolynomial[V]`.\n\nImplementors may want to make it a singleton instance, although this is not\nrequired.\n\nIt is important to mention that `NullPolynomial` has a degree of -1 and its\nmethods should really be left alone. They are used to terminate the recursions.\n\n### Interpreting the String\n\nIt's simple.\n\n```\n + 1x^3   + 1x^2   + 1x^1   + 1x^0  + 0\n[+ 1x^3, [+ 1x^2, [+ 1x^1, [+ 1x^0, 0. ]]]]\n```\n\n## License\n\nCopyright \u0026copy; 2015 Stojan Dimitrovski\n\nAll code contained herein is licensed under the\n[MIT License](http://opensource.org/licenses/MIT). See the full text in the\nincluded `LICENSE.txt` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhf%2Fpolynome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhf%2Fpolynome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhf%2Fpolynome/lists"}