{"id":19636633,"url":"https://github.com/barton-willis/gamma_product_simp","last_synced_at":"2026-02-21T11:02:50.211Z","repository":{"id":48189498,"uuid":"516741960","full_name":"barton-willis/gamma_product_simp","owner":"barton-willis","description":"Maxima code for simplifying expressions that involve products of gamma functions.","archived":false,"fork":false,"pushed_at":"2022-09-05T21:28:45.000Z","size":134,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T19:12:47.793Z","etag":null,"topics":["gamma-function","maxima-cas","simplification"],"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/barton-willis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-22T12:27:47.000Z","updated_at":"2022-10-25T08:39:51.000Z","dependencies_parsed_at":"2023-01-17T22:02:03.848Z","dependency_job_id":null,"html_url":"https://github.com/barton-willis/gamma_product_simp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/barton-willis/gamma_product_simp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Fgamma_product_simp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Fgamma_product_simp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Fgamma_product_simp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Fgamma_product_simp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barton-willis","download_url":"https://codeload.github.com/barton-willis/gamma_product_simp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barton-willis%2Fgamma_product_simp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29679049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T09:33:50.764Z","status":"ssl_error","status_checked_at":"2026-02-21T09:33:19.949Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gamma-function","maxima-cas","simplification"],"created_at":"2024-11-11T12:30:14.042Z","updated_at":"2026-02-21T11:02:50.190Z","avatar_url":"https://github.com/barton-willis.png","language":"Common Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gamma function simplification\n\nMaxima code for simplifying expressions that involve gamma and factorial functions. \n\n## Installation\n\nTo use the `gamma_simp` package, copy the file `gamma_simp.mac` to a folder that Maxima can find. To load the package, enter `load(gamma_simp)` at the Maxima command line.\n\nTo view the paths that Maxima searches to find a *.mac file, enter \n`file_search_maxima;` at a Maxima command line. \n\n## Usage\n\nThere are two user level functions in the package. They are `gamma_simp` and `factorial_simp.` Both of these functions take a single Maxima expression as input and both return a simplification of the input. \n\nThe function `gamma_simp` matches subexpressions of the input to various gamma function identities and replaces the match with a simplification. The simplification process generally only converts gamma functions to gamma functions (not, for example,\ninto beta functions), but depending on the value of the option variable `pochhammer_max_index,` the output can involve a pochhammer symbol.\n\nThe function `factorial_simp` works similarly. \n\nTo simplify all gamma-like functions, including binomial coefficients, pochhammer symbols, beta functions, and factorials, apply the function `makegamma` to the input of `gamma_simp.` \n\n_Option variables:_ The option variables `radsubstflag,` `pochhammer_max_index,` and `ratfac` sometimes alter the results of `gamma_simp` and `factorial_simp.` \n\n_Related functions:_ `factcomb,` `minfactorial,` `makegamma,` and `makefactorial.`\n\n## Examples\n\nThe last example shows the use of `makegamma` to pre-process the input.\n~~~\n(%i1)\tload(gamma_simp)$\n\n(%i2)\tgamma_simp(gamma(z)*gamma(1-z));\n(%o2)\t%pi/sin(%pi*z)\n\n(%i3)\tgamma_simp(gamma(1/4)*gamma(3/4));\n(%o3)\tsqrt(2)*%pi\n\n(%i4)\tgamma_simp(gamma(z)*gamma(z + 1/2));\n(%o4)\tsqrt(%pi)*2^(1-2*z)*gamma(2*z)\n\n(%i5)\tgamma_simp(x*gamma(x)+gamma(x+3)/(x+2));\n(%o5)\tx*gamma(x+1)+2*gamma(x+1)\n\n(%i6)\tgamma_simp(makegamma((k - n) *binomial(n,k)  + n * binomial(n-1,k)));\n(%o6)\t0\n~~~\n\n## Details\n\nThe functions `gamma_simp` and `factorial_simp` make a good effort to simplify every vanishing expression to zero. But if an expression doesn't simplify to zero, it does _not_ mean that the expression is non vanishing.\n\nAdditionally, `gamma_simp` does not always simplify semantically identical expressions to syntactically identical expressions. That is, `gamma_simp` does not produce a canonical form. An example:\n\n~~~\n(%i1)\tload(gamma_simp)$\n\n(%i2)\tdeclare(n,integer)$\n\n(%i3)\txx : makegamma(pochhammer(a-n,n));\n(%o3)\tgamma(a)/gamma(a-n)\n\n(%i4)\tyy : makegamma(pochhammer(1-a,n)*(-1)^n);\n(%o4)\t((-1)^n*gamma(n-a+1))/gamma(1-a)\n\n(%i5)\tgamma_simp(xx) = gamma_simp(yy);\n(%o5)\tgamma(a)/gamma(a-n)=((-1)^n*gamma(n-a+1))/gamma(1-a)\n\n(%i6)\ttrigexpand(gamma_simp(xx-yy));\n(%o6)\t0\n~~~\n\nAlthough the expressions xx and yy are semantically the same (see %o6), `gamma_simp` does not simplify them to identical expressions.\n\n\n## Identities\n\nThe function `gamma_simp` matches subexpressions of the input to the left hand side of each of the following identities and replaces them by the right side:\n\n$$ \n\\dfrac{\\Gamma\\left(z+1\\right)}{z} = \\Gamma\\left(z\\right), \\quad z \\in \\mathbf{C_\\neq 0} \n$$ \n\n$$ \n\\Gamma\\left(z\\right)\\Gamma\\left(1-z\\right)= \\dfrac{\\uppi}{\\sin\\left(\\uppi z\\right)},  \\quad z \\in \\mathbf{C} \\setminus \\mathbf{Z}, \n$$\n\n$$\n\\prod_{k=0}^{n-1}\\Gamma\\left (z+\\frac{k}{n}\\right) = (2\\uppi)^{(n-1)/2}n^{1/2-nz}  \\Gamma \\left(n z \\right)\n$$\n\n$$\n\\Gamma\\left(\\dfrac{1}{2}+\\mathrm{i}y\\right)\\Gamma\\left(\\dfrac{1}{2}-\\mathrm{i}%\ny\\right)=\\dfrac{\\uppi}{\\cosh\\left(\\uppi y\\right)},\n$$\n\n$$\n\\Gamma\\left(\\mathrm{i} y\\right) \\Gamma\\left(-\\mathrm{i} y\\right)  = \n\\frac{\\uppi}{y\\sinh\\left(\\uppi y\\right)}, \\quad y \\in \\mathbf{R}_{\\neq 0}\n$$\n\nSee: http://dlmf.nist.gov/5.5.E1, http://dlmf.nist.gov/5.5.E3, http://dlmf.nist.gov/5.4.E4, and http://dlmf.nist.gov/5.4.E3 \n\n## Implementation\n\nThe package is written in the Maxima language.\n\nThe function `gamma_simp` matches subexpressions of the input to various gamma function identities. The function `gamma_simp` uses `radsubst` to match the subexpressions, it does _not_ explicitly use Maxima's pattern matcher.\n\nThe function `factorial_simp` converts all factorials to gamma form. It then dispatches `gamma_simp` and converts back to factorial form. Any gamma functions in\nthe input are protected from participating in the gamma function simplification process.\n\nThe only user level functions in the package are `gamma_simp` and `factorial_simp.`\nThe remaining functions in the package are _not_ intended to be user level functions. \n\n\n## Testing\n\nTo run the test suite for the package `gamma_simp,` enter `batch(rtest_gamma_simp, 'test)` at the Maxima prompt. To do this, you will need to copy the file `rtest_gamma_simp` to a folder that Maxima can find. \n\n\n## Thanks\n\nPart of the test file (`rtest_gamma_simp`) is adapted from the [SymPy package](https://www.sympy.org/en/index.html) for simplification of gamma functions. I thank the SymPy developers for making this resource available.\n\nAdditionally, I thank readers of the Maxima list, including Oscar Benjamin, Stavros Macrakis, Ray Rogers, and Raymond Toy, for suggestions and encouragement. Of course, all bugs are mine.\n\n_Reference:_ https://github.com/sympy/sympy/blob/master/sympy/simplify/tests/test_gammasimp.py\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarton-willis%2Fgamma_product_simp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarton-willis%2Fgamma_product_simp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarton-willis%2Fgamma_product_simp/lists"}