//! Utility methods.
/// Compares two functions of a single variable.
pubfncmp<F, G>(n:u32,
start:f64,
end:f64,
f: F,
g: G
)->f64where F: Fn(f64) -> f64,
G: Fn(f64) -> f64{letmut sum =0.0;for i in0..n {let x = i asf64/ n asf64*(end - start)+ start;
sum +=(f(x)-g(x)).powi(2);}
sum / n asf64}