{"id":25059893,"url":"https://github.com/stla/gmpoly","last_synced_at":"2025-03-31T11:15:00.799Z","repository":{"id":56930204,"uuid":"460334483","full_name":"stla/gmpoly","owner":"stla","description":"Multivariate polynomials with 'gmp' rational coefficients","archived":false,"fork":false,"pushed_at":"2022-03-20T03:34:26.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-07T00:29:01.202Z","etag":null,"topics":["gmp","multivariate-polynomials","r"],"latest_commit_sha":null,"homepage":"","language":"R","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.Rmd","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}},"created_at":"2022-02-17T07:54:46.000Z","updated_at":"2022-02-17T13:30:30.000Z","dependencies_parsed_at":"2022-08-21T05:50:19.278Z","dependency_job_id":null,"html_url":"https://github.com/stla/gmpoly","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%2Fgmpoly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stla%2Fgmpoly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stla%2Fgmpoly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stla%2Fgmpoly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stla","download_url":"https://codeload.github.com/stla/gmpoly/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246458009,"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":["gmp","multivariate-polynomials","r"],"created_at":"2025-02-06T15:55:32.947Z","updated_at":"2025-03-31T11:15:00.778Z","avatar_url":"https://github.com/stla.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\r\ntitle: \"The 'gmpoly' package\"\r\noutput: github_document\r\n---\r\n\r\n\u003c!-- badges: start --\u003e\r\n[![R-CMD-check](https://github.com/stla/gmpoly/workflows/R-CMD-check/badge.svg)](https://github.com/stla/gmpoly/actions)\r\n\u003c!-- badges: end --\u003e\r\n\r\n*R package for multivariate polynomials with rational coefficients.*\r\n\r\n```{r setup, include=FALSE}\r\nknitr::opts_chunk$set(echo = TRUE, collapse = TRUE)\r\n```\r\n\r\n```{r}\r\nlibrary(gmpoly)\r\n```\r\n\r\nDefine a polynomial with the `gmpoly` function:\r\n\r\n```{r}\r\npol \u003c- gmpoly(\"4 x^(2, 1, 1) + 1/2 x^(0,1,0)\")\r\npol\r\n```\r\n\r\nSome arithmetic on this polynomial:\r\n\r\n```{r}\r\n-pol\r\n2 * pol\r\npol / 2\r\npol + 5\r\npol - 5\r\npol^2\r\n```\r\n\r\nNote that you cannot directly use a `bigq` scalar, e.g. you can't do \r\n`gmp::as.bigq(5, 3) * pol`. To perform such an operation, you have to use \r\n`gmpolyConstant`:\r\n\r\n```{r}\r\ngmpolyConstant(3, \"5/3\") * pol\r\n```\r\n\r\nThe `gmpolyConstant` function converts a scalar to a constant polynomial, and \r\ntwo polynomials can be added and multiplied:\r\n\r\n```{r}\r\npol1 \u003c- gmpoly(\"2 x^(1,1) - 5/3 x^(0,1)\")\r\npol2 \u003c- gmpoly(\"-2 x^(1,1) + 3 x^(2,1)\")\r\npol1 + pol2\r\npol1 * pol2\r\n```\r\n\r\nUse `gmpolyEval` to evaluate a polynomial for some values of the variables:\r\n\r\n```{r}\r\nlibrary(gmp, warn.conflicts = FALSE)\r\npol \u003c- gmpoly(\"5/2 x^(2,3) + 3 x^(1,1)\")\r\ngmpolyEval(pol, x = as.bigq(c(1, 1)))\r\n```\r\n\r\nTo evaluate the polynomial for several sets of variables, supply a matrix to \r\nthe second argument:\r\n\r\n```{r}\r\nX \u003c- rbind(\r\n  t(as.bigq(c(1, 1))),\r\n  t(as.bigq(c(3, 4), c(4, 3)))\r\n)\r\ngmpolyEval(pol, x = X)\r\n```\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstla%2Fgmpoly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstla%2Fgmpoly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstla%2Fgmpoly/lists"}