mathigon / fermat.js

Mathematics and statistics library for TypeScript.
http://mathigon.io/fermat
MIT License
103 stars 15 forks source link

Enhancement: Addition of Probability Functions #168

Open Srimans7 opened 9 months ago

Srimans7 commented 9 months ago

Dear Fermat.js Maintainers,

I hope this message finds you well. I am writing to submit a pull request that enhances Fermat.js by adding a comprehensive set of probability functions to the library. This addition extends the library's capabilities from number theory to probability theory, providing users with a robust suite of tools for statistical analysis.

Usage Example: Screenshot 2024-02-14 at 10 59 47 AM

Changes Made: Added probability functions covering factorial, permutations, combinations, probability mass function (PMF), cumulative distribution function (CDF), binomial distribution, geometric distribution, Poisson distribution, normal distribution, exponential distribution, uniform distribution, joint probability, and conditional probability. Included TypeScript type annotations for improved code readability and maintainability. Exported all functions for ease of use in various contexts.

Purpose: The purpose of this contribution is to make Fermat.js a more versatile and comprehensive mathematics and statistics library. With the addition of these probability functions, users will be able to perform a wide range of statistical analyses, from basic calculations to advanced probability distributions.

I have thoroughly tested these functions to ensure their correctness and have added appropriate error handling. I am open to feedback and am willing to make any necessary adjustments to align with Fermat.js's coding standards.

Thank you for considering this contribution. I believe it will enhance the library's utility for a broader audience.

Best regards, Sriman Tharun Kumar S Sriman7

plegner commented 9 months ago

Thanks for your contributions! However, rather than adding lots of new functions, can we update the existing functions here: https://github.com/mathigon/fermat.js/blob/master/src/random.ts#L73 https://github.com/mathigon/fermat.js/blob/master/src/combinatorics.ts#L19