Function cmp
Source pub fn cmp<F, G>(n: u32, start: f64, end: f64, f: F, g: G) -> f64
Expand description
Compares two functions of a single variable.
3pub fn lin(ws: &[f64]) -> f64 {
4 utils::cmp(20, 0.0, 6.283185307179586,
5 |x| x.sin(),
6 |x| (x + ws[0]).cos())
7}
More examples
Hide additional examples
3pub fn lin(ws: &[f64]) -> f64 {
4 utils::cmp(20, 0.0, 6.283185307179586,
5 |x| x.sin(),
6 |x| (x - 0.25 * ws[0]).cos())
7}
3pub fn lin(ws: &[f64]) -> f64 {
4 utils::cmp(20, 0.0, 10.0,
5 |x| 0.12345678987654321 - 9.876543210123456789 * x,
6 |x| ws[0] + ws[1] * x)
7}
3pub fn lin(ws: &[f64]) -> f64 {
4 utils::cmp(20, 0.0, 10.0,
5 |x| x * (0.123456789 + x).sin() - 9.87654321,
6 |x| x * (ws[0] + x).sin() - ws[1])
7}
3pub fn lin(ws: &[f64]) -> f64 {
4 utils::cmp(20, 0.0, 10.0,
5 |x| 0.123456789 - 9.87654321 * x + 0.123456789 * x * x,
6 |x| ws[0] + ws[1] * x + ws[2] * x * x)
7}