{"id":20581734,"url":"https://github.com/j-jith/orthopoly","last_synced_at":"2025-04-14T19:54:04.356Z","repository":{"id":51693337,"uuid":"113677982","full_name":"j-jith/orthopoly","owner":"j-jith","description":"Generate orthogonal polynomials for arbitrary probability density functions","archived":false,"fork":false,"pushed_at":"2017-12-09T15:07:16.000Z","size":150,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T08:12:14.821Z","etag":null,"topics":["orthogonal-polynomials","pce","polynomial-chaos-expansion"],"latest_commit_sha":null,"homepage":"","language":"Python","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/j-jith.png","metadata":{"files":{"readme":"README.rst","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":"2017-12-09T15:04:02.000Z","updated_at":"2024-01-06T18:29:46.000Z","dependencies_parsed_at":"2022-08-03T09:00:19.583Z","dependency_job_id":null,"html_url":"https://github.com/j-jith/orthopoly","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/j-jith%2Forthopoly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-jith%2Forthopoly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-jith%2Forthopoly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-jith%2Forthopoly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j-jith","download_url":"https://codeload.github.com/j-jith/orthopoly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248952057,"owners_count":21188421,"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":["orthogonal-polynomials","pce","polynomial-chaos-expansion"],"created_at":"2024-11-16T06:30:41.583Z","updated_at":"2025-04-14T19:54:04.326Z","avatar_url":"https://github.com/j-jith.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"OrthoPoly\n#########\n\n**OrthoPoly** is a Python class for generating orthogonal polynomials with\nrespect to arbitrary probability density functions. The primary application of\nthis script is in performing *Arbitrary* Polynomial Chaos Expansion (PCE) in\nuncertainty quantification studies.\n\nInstallation\n============\n\nOrthopoly is written in Python 3 and requires the following packages to be\npresent in your system:\n\n- `numpy \u003chttps://pypi.python.org/pypi/numpy\u003e`_\n\n- `scipy \u003chttps://pypi.python.org/pypi/scipy\u003e`_\n\nSince OrthoPoly is a simple class, no special installation steps are\nrequired. You can simply copy ``orthopoly.py`` to your working directory,\nand start using it.\n\nUsage\n=====\n\nOrthoPoly can be imported into your script as follows.\n\n.. code:: python\n\n   from orthopoly import OrthoPoly\n\nTo create an instance of OrthoPoly, you need to supply a probability density\nfunction (pdf). The code below defines the pdf of a random variable created by\nadding a uniform random variable and a normal random variable. This pdf is used\nto create an instance of OrthoPoly, and orthogonal polynomials are generated\nwith respect to the supplied pdf.\n\n.. code:: python\n\n    def pdf(z, coeffs):\n        mu, sigma, a, b = coeffs\n        return 0.5/(b-a) * ( erf((z-a-mu)/sigma/sqrt(2)) - erf((z-b-mu)/sigma/sqrt(2)) )\n\n    pp = OrthoPoly(pdf, margs=[0, 1, -1, 1])\n    pp.gen_poly(5)\n\nThe function ``gen_poly()`` takes as an argument the largest order of the\npolynomial to be generated, and populates the variable ``pp.poly`` with the\nappropriate polynomials (which are ``numpy.polynomial.polynomial``).\n\nFor numerical integration with respect to these polynomials, the quadrature\npoints and weights can be obtained as follows.\n\n.. code:: python\n\n   points, weights = pp.get_quad_rule()\n\nNumerical integration can also be performed directly using the ``quadrature()``\nfunction. For instance, to compute the mean of the supplied pdf, one can do the\nfollowing.\n\n.. code:: python\n\n   mean = pp.quadrature(lambda x: x)\n\n\nFor more examples, please look at the ``__main__`` section of ``orthopoly.py``,\nas well as the ``main.py`` script. ``main.py`` is a script which generates\northogonal polynomials for the pdf of a random variable which is a sum of a\nuniform and a normal random variable. It generates the polynomials, calculates\nthe quadrature points and weights, and writes them to an output file.\n\nReferences\n==========\n\nTo understand the mathematics behind OrthoPoly, please take a look at\n`notes.pdf \u003cnotes/notes.pdf\u003e`_. For a more in-depth reading, consult\n[gautschi1982]_ and [golub1969]_.\n\n.. [gautschi1982] Gautschi W. On Generating Orthogonal Polynomials. SIAM J Sci\n   and Stat Comput 1982;3:289–317. doi:10.1137/0903018.\n\n.. [golub1969] Golub GH, Welsch JH. Calculation of Gauss Quadrature Rules.\n   Mathematics of Computation 1969;23:221. doi:10.2307/2004418.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-jith%2Forthopoly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-jith%2Forthopoly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-jith%2Forthopoly/lists"}