This commit is contained in:
Simon Gardling
2022-03-09 21:19:26 -05:00
parent 232f470ce1
commit fa10dd64a4
2 changed files with 7 additions and 5 deletions

View File

@@ -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))
}