{"id":25059910,"url":"https://github.com/stla/mpolynomials","last_synced_at":"2025-03-31T11:15:02.731Z","repository":{"id":49034508,"uuid":"517092564","full_name":"stla/mpolynomials","owner":"stla","description":"Simple multivariate polynomials. Obsolete; use 'hspray' instead.","archived":false,"fork":false,"pushed_at":"2022-12-12T06:07:26.000Z","size":52,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-11T13:09:35.514Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stla.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-23T15:20:49.000Z","updated_at":"2023-09-12T00:47:38.000Z","dependencies_parsed_at":"2023-01-27T14:46:49.165Z","dependency_job_id":null,"html_url":"https://github.com/stla/mpolynomials","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stla%2Fmpolynomials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stla%2Fmpolynomials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stla%2Fmpolynomials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stla%2Fmpolynomials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stla","download_url":"https://codeload.github.com/stla/mpolynomials/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246458010,"owners_count":20780678,"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":"2025-02-06T15:55:46.378Z","updated_at":"2025-03-31T11:15:02.714Z","avatar_url":"https://github.com/stla.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mpolynomials\n\nSimple multivariate polynomials in Haskell.\n\n*This package won't be developed anymore*. Please use [**hspray**](https://github.com/stla/hspray).\n\n___\n\n\n```haskell\nimport Math.Algebra.MultiPol\nx = lone 1 :: Polynomial Double\ny = lone 2 :: Polynomial Double\nz = lone 3 :: Polynomial Double\npoly = (2 *^ (x^**^3 ^*^ y ^*^ z) ^+^ x^**^2) ^*^ (4 *^ (x ^*^ y ^*^ z))\npoly\n-- M (Monomial {coefficient = 4.0, powers = fromList [3,1,1]}) \n-- :+: \n-- M (Monomial {coefficient = 8.0, powers = fromList [4,2,2]})\nprettyPol show \"x\" poly\n-- \"(4.0) * x^(3, 1, 1) + (8.0) * x^(4, 2, 2)\"\n```\n\nMore generally, one can use the type `Polynomial a` as long as the type `a` has \nthe instances `Eq` and `Algebra.Ring` (defined in the **numeric-prelude** \nlibrary). For example `a = Rational`:\n\n```haskell\nimport Math.Algebra.MultiPol\nimport Data.Ratio\nx = lone 1 :: Polynomial Rational\ny = lone 2 :: Polynomial Rational\nz = lone 3 :: Polynomial Rational\n((2%3) *^ (x^**^3 ^*^ y ^*^ z) ^+^ x^**^2) ^*^ ((7%4) *^ (x ^*^ y ^*^ z))\n-- M (Monomial {coefficient = 7 % 4, powers = fromList [3,1,1]}) \n-- :+: \n-- M (Monomial {coefficient = 7 % 6, powers = fromList [4,2,2]})\n```\n\nOr `a = Polynomial Double`:\n\n```haskell\nimport Math.Algebra.MultiPol\np = lone 1 :: Polynomial Double\nx = lone 1 :: Polynomial (Polynomial Double)\ny = lone 2 :: Polynomial (Polynomial Double)\npoly = (p *^ x) ^+^ (p *^ y)  \npoly ^**^ 2 \n-- (M (Monomial {\n--   coefficient = M (Monomial {coefficient = 1.0, powers = fromList [0,2]}), \n--   powers = fromList [0,2]}) \n-- :+: \n--  M (Monomial {\n--    coefficient = M (Monomial {coefficient = 2.0, powers = fromList [1,1]}), \n--    powers = fromList [1,1]})) \n-- :+: \n--  M (Monomial {\n--    coefficient = M (Monomial {coefficient = 1.0, powers = fromList [2,0]}), \n--    powers = fromList [2,0]})\nprettyPol (prettyPol show \"a\") \"X\" (poly ^**^ 2)\n-- \"((1.0) * a^(2)) * X^(0, 2) + ((2.0) * a^(2)) * X^(1, 1) + ((1.0) * a^(2)) * X^(2, 0)\"\n```\n\nEvaluation:\n\n```haskell\nimport Math.Algebra.MultiPol\nx = lone 1 :: Polynomial Double\ny = lone 2 :: Polynomial Double\nz = lone 3 :: Polynomial Double\npoly = 2 *^ (x ^*^ y ^*^ z) \n-- evaluate poly at x=2, y=1, z=2\nevalPoly poly [2, 1, 2]\n-- 8.0\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstla%2Fmpolynomials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstla%2Fmpolynomials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstla%2Fmpolynomials/lists"}