From fa10dd64a49cc0d566850bad6a54ed922ec94a24 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 9 Mar 2022 21:19:26 -0500 Subject: [PATCH] changes --- TODO.md | 4 +++- src/function.rs | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 6b829de..3a06830 100644 --- a/TODO.md +++ b/TODO.md @@ -8,10 +8,12 @@ - Non `y=` functions. 3. Smart display of graph - Display of intersections between functions + - Add docs about roots and extrema 4. Fix integral line 5. re-add euler's number (well it works if you use capital e like `E^x`) 6. allow constants in min/max integral input (like pi or euler's number) 7. sliding values for functions (like a user-interactable slider that adjusts a variable in the function, like desmos) 8. Keybinds 9. nth derivative support (again) -10. add configs for toggling display of roots and extrema \ No newline at end of file +10. add configs for toggling display of roots and extrema +11. reduce jittering of roots and extrema points \ No newline at end of file diff --git a/src/function.rs b/src/function.rs index 33ddf16..a735f37 100644 --- a/src/function.rs +++ b/src/function.rs @@ -287,10 +287,10 @@ impl FunctionEntry { } if last_ele.unwrap().y.signum() != ele.y.signum() { - // Do 10 iterations of newton's method, should be more than accurate + // Do 50 iterations of newton's method, should be more than accurate let x = { let mut x1: f64 = last_ele.unwrap().x; - for _ in 0..10 { + for _ in 0..50 { x1 = last_ele.unwrap().x - (self.function.get(x1) / self.function.derivative(x1)) } @@ -314,10 +314,10 @@ impl FunctionEntry { } if last_ele.unwrap().y.signum() != ele.y.signum() { - // Do 10 iterations of newton's method, should be more than accurate + // Do 50 iterations of newton's method, should be more than accurate let x = { let mut x1: f64 = last_ele.unwrap().x; - for _ in 0..10 { + for _ in 0..50 { x1 = last_ele.unwrap().x - (self.function.derivative(x1) / self.function.get_derivative_2(x1)) }