LazyMath mm_cPr Library
Continuous probability distribution routines for expectation, variance, median, confidence intervals, and quantile solvers.
For full asymptotic time/space proofs and benchmarks across the
mm_*library, see the Algorithm & Complexity Report.
mm_cPr\continfo(fun, var, low, up)
fun: Probability density function \(f(x)\)var: Continuous variablelow: Domain lower boundup: Domain upper bound
Complexity Refactoring: Cached Antiderivative \(\mathcal{O}(M \cdot \text{Integration}) \to \mathcal{O}(1)\)
- Time Complexity: \(\mathcal{O}(M \cdot \text{Int}) \to \mathcal{O}(1)\) algebraic root evaluation.
- Space Complexity: \(\mathcal{O}(1)\) antiderivative scalar cache.
- Optimization: Pre-computes indefinite CDF \(F(x) = \int f(x)\,dx\) once and evaluates \(F(m) - F(a) = \frac{1}{2}\) with \(\mathcal{O}(\log \epsilon)\) numerical fallback, dropping runtime to 279.0 ms.
Exam question example:
Find the mean, standard deviation, and median for $f(x) = \frac{x^2(30-x)}{67500}$ on $[0, 30]$.
CAS Output:
mm_cPr\normsolve(x1, p1, x2, p2)
x1: First quantile score value \(x_1\)p1: Cumulative probability \(\Pr(X \le x_1)\)x2: Second quantile score value \(x_2\)p2: Cumulative probability \(\Pr(X \le x_2)\)
Exam question example:
Given $\Pr(X < 180) = 0.086$ and $\Pr(X < 200) = 0.325$, find $\mu$ and $\sigma$.
CAS Output:
mm_cPr\confintsolve(lower, upper, c)
lower: Lower confidence interval boundupper: Upper confidence interval boundc: Confidence level (e.g. 0.95) or sample size \(n\)
Exam question example:
Given 95% confidence interval $[0.248, 0.552]$, find $\hat{p}$ and $n$.
CAS Output:
mm_cPr\confint(n, phat, c)
n: Sample size \(n\)phat: Sample proportion \(\hat{p}\)c: Confidence level (e.g. 0.95)
Exam question example:
Calculate an approximate 95% confidence interval for $p$ with $n = 50$ and $\hat{p} = 0.2$.
CAS Output: