pub fn from_max_pool_1d<F>(f: F, (a, b): (f64, f64), n: usize, eps: f64) -> Result<Self>
    where
        F: Fn(f64) -> f64 + Copy,
    {
        // Find non-zero intervals
        let mut a = a;
        let mut b = b;
        let trial = seq(a, b, eps);
        for i in 0..trial.len() {
            let x = trial[i];
            if f(x) > 0f64 {
                a = if i > 0 { trial[i - 1] } else { x };
                break;
            }
        }
        for i in (0..trial.len()).rev() {
            let x = trial[i];
            if f(x) > 0f64 {
                b = if i < trial.len() - 1 { trial[i + 1] } else { x };
                break;
            }
        }
        if a >= b {
            bail!(NoNonZeroIntervalError);
        }
        let domain = linspace(a, b, n + 1);

        // Find intervals
        let intervals = auto_zip(&domain);

        // Find weights
        let weights: Vec<f64> = intervals
            .iter()
            .map(|(a, b)| seq(*a, *b + eps, eps).reduce(0f64, |acc, x| acc.max(f(x))))
            .collect();

        Self::new(weights, domain)
    }
Create WeightedUniform from max pooling

# Examples
```
use peroxide::fuga::*;

fn main() -> Result<(), Box<dyn Error>> {
let w = WeightedUniform::from_max_pool_1d(f, (-2f64, 3f64), 10, 1e-3)?;
w.weights().print();

Ok(())
}

fn f(x: f64) -> f64 {
if x.abs() < 1f64 {
1f64 - x.abs()
} else {
0f64
}
}
```
src/statistics/dist.rs