PDF, CDF, and percent-point/quantile functions for the normal and Student’s t distributions
Run:
zig fetch --save git+https://github.com/ankane/dist-zig#v0.1.0And update build.zig:
exe.root_module.addImport("dist", b.dependency("dist", .{}).module("dist"));const dist = @import("dist");
const pdf = dist.normal.pdf(x, mean, std_dev);
const cdf = dist.normal.cdf(x, mean, std_dev);
const ppf = dist.normal.ppf(p, mean, std_dev);const dist = @import("dist");
const pdf = dist.t.pdf(x, df);
const cdf = dist.t.cdf(x, df);
const ppf = dist.t.ppf(p, df);- Algorithm AS 241: The Percentage Points of the Normal Distribution
- Algorithm 395: Student’s t-distribution
- Algorithm 396: Student’s t-quantiles
View the changelog
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/dist-zig.git
cd dist-zig
zig build test --summary new