rename BackingFunction::derivative to BackingFunction::get_derivative_1
This commit is contained in:
parent
7e77f8b40d
commit
cda3853a01
@ -138,7 +138,7 @@ impl FunctionEntry {
|
||||
if let Some(i) = x_data.get_index(x) {
|
||||
derivative_cache[i]
|
||||
} else {
|
||||
Value::new(x, self.function.derivative(x))
|
||||
Value::new(x, self.function.get_derivative_1(x))
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@ -175,7 +175,7 @@ impl FunctionEntry {
|
||||
self.output.derivative = Some(
|
||||
(0..self.pixel_width)
|
||||
.map(|x| (x as f64 / resolution as f64) + self.min_x)
|
||||
.map(|x| Value::new(x, self.function.derivative(x)))
|
||||
.map(|x| Value::new(x, self.function.get_derivative_1(x)))
|
||||
.collect(),
|
||||
);
|
||||
}
|
||||
@ -311,7 +311,7 @@ impl FunctionEntry {
|
||||
let mut x2: f64;
|
||||
let mut fail: bool = false;
|
||||
loop {
|
||||
x2 = x1 - (self.function.get(x1) / self.function.derivative(x1));
|
||||
x2 = x1 - (self.function.get(x1) / self.function.get_derivative_1(x1));
|
||||
if !(self.min_x..self.max_x).contains(&x2) {
|
||||
fail = true;
|
||||
break;
|
||||
@ -365,7 +365,8 @@ impl FunctionEntry {
|
||||
let mut fail: bool = false;
|
||||
loop {
|
||||
x2 = x1
|
||||
- (self.function.derivative(x1) / self.function.get_derivative_2(x1));
|
||||
- (self.function.get_derivative_1(x1)
|
||||
/ self.function.get_derivative_2(x1));
|
||||
if !(self.min_x..self.max_x).contains(&x2) {
|
||||
fail = true;
|
||||
break;
|
||||
|
||||
@ -34,7 +34,9 @@ impl BackingFunction {
|
||||
|
||||
pub fn get(&self, x: f64) -> f64 { self.function.eval(&[x]).unwrap_or(f64::NAN) }
|
||||
|
||||
pub fn derivative(&self, x: f64) -> f64 { self.derivative_1.eval(&[x]).unwrap_or(f64::NAN) }
|
||||
pub fn get_derivative_1(&self, x: f64) -> f64 {
|
||||
self.derivative_1.eval(&[x]).unwrap_or(f64::NAN)
|
||||
}
|
||||
|
||||
pub fn get_derivative_2(&self, x: f64) -> f64 {
|
||||
self.derivative_2.eval(&[x]).unwrap_or(f64::NAN)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user