{"id":17595205,"url":"https://github.com/dcasella/multivariate-polynomials","last_synced_at":"2026-01-07T19:06:03.997Z","repository":{"id":74791457,"uuid":"73795741","full_name":"dcasella/multivariate-polynomials","owner":"dcasella","description":"Multivariate polynomials manipulation libraries for Lisp and Prolog","archived":false,"fork":false,"pushed_at":"2017-02-14T13:58:59.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T02:51:25.741Z","etag":null,"topics":["common-lisp","multivariate-polynomials","prolog"],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","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/dcasella.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}},"created_at":"2016-11-15T09:05:28.000Z","updated_at":"2023-03-13T16:51:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"2c222001-cbf7-4eaf-9eaa-cfa3e2bfb38e","html_url":"https://github.com/dcasella/multivariate-polynomials","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/dcasella%2Fmultivariate-polynomials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcasella%2Fmultivariate-polynomials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcasella%2Fmultivariate-polynomials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcasella%2Fmultivariate-polynomials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcasella","download_url":"https://codeload.github.com/dcasella/multivariate-polynomials/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246237418,"owners_count":20745348,"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":["common-lisp","multivariate-polynomials","prolog"],"created_at":"2024-10-22T07:43:52.999Z","updated_at":"2026-01-07T19:06:03.933Z","avatar_url":"https://github.com/dcasella.png","language":"Common Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multivariate Polynomials\n\n\u003e Translated and adapted from MV-201701 PDF written by Marco Antoniotti and Gabriella Pasi.\n\nOne of the first and most important computer applications was the _symbolic_ manipulation of mathematical operations. In particular, known systems like _Computer Algebra Systems_ preoccupy to offer _multivariate polynomials_ manipulation functionalities.  \nThe Project consists in Common Lisp and Prolog libraries implementing multivariate polynomials manipulation.  \n\u0026nbsp;\n\n## List of contents\n\n- [Representation](#representation)  \n- [Interface](#interface)  \n- [Examples](#examples)  \n\u0026nbsp;\n\n## Representation\n\n### Common Lisp\n\nExpression:\n\n```\nVariable   X          → 'x\n\nMonomial   XY^3       → '(* x (expt y 3))\n\nMonomial   5XW        → '(* 5 x w)\n\nPolynomial XY^3 + 5XW → '(+ (* x (expt y 3)) (* 5 x w))\n```\n\nVarPower: (__V__ _Power_ _Variable_)  \n\n```lisp\n; X^5\n(V 5 X)\n```\n\nMonomial: (__M__ _Coefficient_ _TotalDegree_ _VarPowers_)  \n\n```lisp\n; 2*X^4*Y\n(M 2 5 ((V 4 X) (V 1 Y)))\n```\n\nPolynomial: (__P__ _Monomials_)  \n\n```lisp\n; 4*X*Y + 2*Y*Z\n(P ((M 4 2 ((V 1 X) (V 1 Y))) (M 2 2 ((V 1 Y) (V 1 Z)))))\n```\n\u0026nbsp;\n\n### Prolog\n\nExpression:\n\n```\nVariable   X          → x\n\nMonomial   XY^3       → x * y^3\n\nMonomial   5XW        → 5 * x * w\n\nPolynomial XY^3 + 5XW → x * y^3 + 5 * x * w\n```\n\nVarPower: __v__(_Power_, _Variable_)  \n\n```prolog\n% X^5\nv(5, x)\n```\n\nMonomial: __m__(_Coefficient_, _TotalDegree_, _VarPowers_)  \n\n```prolog\n% 2*X^4*Y\nm(2, 5, [v(4, x), v(1, y)])\n```\n\nPolynomial: __poly__(_Monomials_)  \n\n```prolog\n% 4*X*Y + 2*Y*Z\npoly(m(4, 2, [v(1, x), v(1, y)]), m(2, 2, [v(1, y), v(1, z)]))\n```\n\u0026nbsp;\n\n## Interface\n\n### Common Lisp\n(__coefficients__ _Poly_) → _Coefficients_  \n\n(__variables__ _Poly_) → _Variables_  \n\n(__monomials__ _Poly_) → _Monomials_  \n\n(__maxdegree__ _Poly_) → _Degree_  \n\n(__mindegree__ _Poly_) → _Degree_  \n\n(__polyplus__ _Poly1_ _Poly2_) → _Result_  \n\n(__polyminus__ _Poly1_ _Poly2_) → _Result_  \n\n(__polytimes__ _Poly1_ _Poly2_) → _Result_  \n\n(__as_monomial__ _Expression_) → _Monomial_  \n\n(__as_polynomial__ _Expression_) → _Monomial_  \n\n(__polyval__ _Polynomial_ _VariableValues_) → _Value_  \n\n(__pprint_polynomial__ _Polynomial_) → _NIL_  \n\u0026nbsp;\n\n### Prolog\n\n__coefficients__(_+Poly_, _-Coefficients_)  \n\n__variables__(_+Poly_, _-Variables_)  \n\n__monomials__(_+Poly_, _-Monomials_)  \n\n__maxdegree__(_+Poly_, _-Degree_)  \n\n__mindegree__(_+Poly_, _-Degree_)  \n\n__polyplus__(_+Poly1_, _+Poly2_, _-Result_)  \n\n__polyminus__(_+Poly1_, _+Poly2_, _-Result_)  \n\n__polytimes__(_+Poly1_, _+Poly2_, _-Result_)  \n\n__as_monomial__(_+Expression_, _-Monomial_)  \n\n__as_polynomial__(_+Expression_, _-Monomial_)  \n\n__polyval__(_+Polynomial_, _+VariableValues_, _-Value_)  \n\n__pprint_polynomial__(_+Polynomial_)  \n\u0026nbsp;\n\n## Examples\n\n### Common Lisp\n\n```lisp\nCL-USER\u003e (as-monomial '(* 3 y w (expt u 3)))\n(M 3 5 ((V 3 U) (V 1 W) (V 1 Y)))\n\nCL-USER\u003e (setf qd (as-monomial 42))\n(M 42 0 NIL)\n\nCL-USER\u003e (setf m1 (as-monomial '(* y (expt s 3) (expt u 3))))\n(M 1 7 ((V 3 S) (V 3 U) (V 1 Y)))\n\nCL-USER\u003e (setf p1 (as-polynomial '(+ (* -1 x) (* x y))))\n(P ((M -1 1 ((V 1 X))) (M 1 2 ((V 1 X) (V 1 Y)))))\n\nCL-USER\u003e (setf p2 (as-polynomial '(+ (* y (expt s 3) (expt u 3)) -4 (* x y))))\n(P ((M -4 0 NIL)\n    (M 1 2 ((V 1 X) (V 1 Y)))\n    (M 1 7 ((V 3 S) (V 3 U) (V 1 Y)))))\n\nCL-USER\u003e (polytimes m1 p1)\n(P ((M -1 8 ((V 3 S) (V 3 U) (V 1 X) (V 1 Y)))\n    (M 1 9 ((V 3 S) (V 3 U) (V 1 X) (V 2 Y)))))\n\nCL-USER\u003e (pprint-polynomial *)\n-1 * S^3 * U^3 * X * Y + S^3 * U^3 * X * Y^2\nNIL\n```\n\u0026nbsp;\n\n### Prolog\n\n```prolog\n?- as_monomial(3 * y * w * u^3, M).\nM = m(3, 5, [v(3, u), v(1, w), v(1, y)]).\n\n?- as_monomial(42, QD).\nQD = m(42, 0, []).\n\n?- as_polynomial(-1 * x + x * y, P1), variables(P1, Vs).\nP1 = poly([m(-1, 1, [v(1, x)]), m(1, 2, [v(1, x), v(1, y)])]),\nVs = [x, y].\n\n?- as_monomial(y * s^3 * u^3, M1),\n|  as_polynomial(-1 * x + x * y, P1),\n|  polytimes(M1, P1, R),\n|  pprint_polynomial(R).\n-1 * S^3 * U^3 * X * Y + S^3 * U^3 * X * Y^2\nM1 = m(1, 7, [v(3, s), v(3, u), v(1, y)]),\nP1 = poly([m(-1, 1, [v(1, x)]), m(1, 2, [v(1, x), v(1, y)])]),\nR = poly([m(-1, 8, [v(3, s), v(3, u), v(1, x), v(1, y)]),\n          m(1, 9, [v(3, s), v(3, u), v(1, x), v(2, y)])]).\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcasella%2Fmultivariate-polynomials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcasella%2Fmultivariate-polynomials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcasella%2Fmultivariate-polynomials/lists"}