diff --git a/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_17.rs b/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_17.rs index 3a72c4f..3fe7135 100644 --- a/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_17.rs +++ b/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_17.rs @@ -43,4 +43,4 @@ fn stairwell_temperature(t_0: f64, eta: f64, t_b: f64) -> PyResult { pub fn equation_50_17(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(stairwell_temperature, m)?)?; Ok(()) -} \ No newline at end of file +} diff --git a/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_20.rs b/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_20.rs index 2f2c6ba..f28b274 100644 --- a/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_20.rs +++ b/crates/python_api/src/sfpe_handbook/chapter_50/equation_50_20.rs @@ -43,4 +43,4 @@ fn visibility(k: f64, l: f64, lambda: f64) -> PyResult { pub fn equation_50_20(m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(visibility, m)?)?; Ok(()) -} \ No newline at end of file +} diff --git a/crates/sfpe_handbook/src/chapter_50/equation_50_16.rs b/crates/sfpe_handbook/src/chapter_50/equation_50_16.rs index b0a0a9f..7f839be 100644 --- a/crates/sfpe_handbook/src/chapter_50/equation_50_16.rs +++ b/crates/sfpe_handbook/src/chapter_50/equation_50_16.rs @@ -28,4 +28,4 @@ mod tests { let expected = 2.035971223; assert!((result - expected).abs() < 1e-6); } -} \ No newline at end of file +} diff --git a/crates/sfpe_handbook/src/chapter_50/equation_50_17.rs b/crates/sfpe_handbook/src/chapter_50/equation_50_17.rs index 79c8523..3b58b4d 100644 --- a/crates/sfpe_handbook/src/chapter_50/equation_50_17.rs +++ b/crates/sfpe_handbook/src/chapter_50/equation_50_17.rs @@ -3,7 +3,12 @@ pub fn stairwell_temperature(t_0: f64, eta: f64, t_b: f64) -> f64 { } #[cfg(not(coverage))] -pub fn stairwell_temperature_equation(t_s: String, t_0: String, eta: String, t_b: String) -> String { +pub fn stairwell_temperature_equation( + t_s: String, + t_0: String, + eta: String, + t_b: String, +) -> String { format!("{} = {} + {} \\times ( {} - {} )", t_s, t_0, eta, t_b, t_0) } diff --git a/crates/sfpe_handbook/src/chapter_59.rs b/crates/sfpe_handbook/src/chapter_59.rs new file mode 100644 index 0000000..bc3c565 --- /dev/null +++ b/crates/sfpe_handbook/src/chapter_59.rs @@ -0,0 +1 @@ +pub mod equation_59_4; diff --git a/crates/sfpe_handbook/src/chapter_59/equation_59_4.rs b/crates/sfpe_handbook/src/chapter_59/equation_59_4.rs new file mode 100644 index 0000000..3a27512 --- /dev/null +++ b/crates/sfpe_handbook/src/chapter_59/equation_59_4.rs @@ -0,0 +1,20 @@ +pub fn speed(k: f64, a: f64, d: f64) -> f64 { + k - a * k * d +} + +#[cfg(not(coverage))] +pub fn speed_equation(s: String, k: String, a: String, d: String) -> String { + format!("{} = {} - {} \\cdot {} \\cdot {}", s, k, a, k, d) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_speed() { + let result = speed(1.4, 0.266, 2.0); + let expected = 0.6552; + assert!((result - expected).abs() < 1e-6); + } +} diff --git a/crates/sfpe_handbook/src/lib.rs b/crates/sfpe_handbook/src/lib.rs index 3ca7985..59930f3 100644 --- a/crates/sfpe_handbook/src/lib.rs +++ b/crates/sfpe_handbook/src/lib.rs @@ -1,2 +1,3 @@ pub mod chapter_14; pub mod chapter_50; +pub mod chapter_59;