simplify newtons_method_helper

Wohoo!! 1000th commit, I know this specific commit is super small, but the number of total commits is a large milestone.
This commit is contained in:
Simon Gardling 2022-06-02 22:27:11 -04:00
parent 789286d23f
commit e3128593e2

View File

@ -58,7 +58,8 @@ pub fn newtons_method_helper(
.tuple_windows()
.filter(|(prev, curr)| prev.y.is_finite() && curr.y.is_finite())
.filter(|(prev, curr)| prev.y.signum() != curr.y.signum())
.map(|(start, _)| newtons_method(f, f_1, start.x, range, threshold))
.map(|(start, _)| start.x)
.map(|x| newtons_method(f, f_1, x, range, threshold))
.filter(|x| x.is_some())
.map(|x| unsafe { x.unwrap_unchecked() })
.collect()