some formatting

This commit is contained in:
Simon Gardling 2022-03-07 20:19:53 -05:00
parent a34e37e3f7
commit eaf2c8e6b8
2 changed files with 4 additions and 2 deletions

View File

@ -311,7 +311,7 @@ impl FunctionEntry {
self self
} }
pub fn get_derivative_str(&self) -> &str { self.function.get_derivative_str() } pub fn get_derivative_str(&self) -> String { self.function.get_derivative_str() }
} }
#[test] #[test]

View File

@ -19,7 +19,9 @@ impl BackingFunction {
} }
} }
pub fn get_derivative_str(&self) -> &str { self.derivative_1.unparse() } // TODO: maybe pretty-ify the output here? idk, it's pretty ugly pub fn get_derivative_str(&self) -> String {
String::from(self.derivative_1.unparse()).replace("{x}", "x")
}
pub fn get(&self, x: f64) -> f64 { self.function.eval(&[x]).unwrap_or(f64::NAN) } pub fn get(&self, x: f64) -> f64 { self.function.eval(&[x]).unwrap_or(f64::NAN) }