Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ fn stairwell_temperature(t_0: f64, eta: f64, t_b: f64) -> PyResult<f64> {
pub fn equation_50_17(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(stairwell_temperature, m)?)?;
Ok(())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ fn visibility(k: f64, l: f64, lambda: f64) -> PyResult<f64> {
pub fn equation_50_20(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(visibility, m)?)?;
Ok(())
}
}
2 changes: 1 addition & 1 deletion crates/sfpe_handbook/src/chapter_50/equation_50_16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ mod tests {
let expected = 2.035971223;
assert!((result - expected).abs() < 1e-6);
}
}
}
7 changes: 6 additions & 1 deletion crates/sfpe_handbook/src/chapter_50/equation_50_17.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
1 change: 1 addition & 0 deletions crates/sfpe_handbook/src/chapter_59.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod equation_59_4;
20 changes: 20 additions & 0 deletions crates/sfpe_handbook/src/chapter_59/equation_59_4.rs
Original file line number Diff line number Diff line change
@@ -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)
Comment on lines +1 to +7
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function parameters k, a, and d use single-letter names without documentation. While the Rust domain crates don't require docstrings, descriptive parameter names would improve code readability. Consider using more descriptive names like free_speed, coefficient, and density (or whatever these parameters represent in the context of equation 59.4).

Suggested change
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)
pub fn speed(free_speed: f64, coefficient: f64, density: f64) -> f64 {
free_speed - coefficient * free_speed * density
}
#[cfg(not(coverage))]
pub fn speed_equation(
result_symbol: String,
free_speed_symbol: String,
coefficient_symbol: String,
density_symbol: String,
) -> String {
format!(
"{} = {} - {} \\cdot {} \\cdot {}",
result_symbol, free_speed_symbol, coefficient_symbol, free_speed_symbol, density_symbol
)

Copilot uses AI. Check for mistakes.
}

#[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);
}
}
1 change: 1 addition & 0 deletions crates/sfpe_handbook/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod chapter_14;
pub mod chapter_50;
pub mod chapter_59;
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chapter 59 is missing Python bindings. To make this equation accessible from Python (consistent with other chapters like chapter_14 and chapter_50), you need to:

  1. Create crates/python_api/src/sfpe_handbook/chapter_59/ directory
  2. Add crates/python_api/src/sfpe_handbook/chapter_59/equation_59_4.rs with PyO3 bindings
  3. Add crates/python_api/src/sfpe_handbook/chapter_59.rs module file
  4. Update crates/python_api/src/sfpe_handbook.rs to include pub mod chapter_59; and add it to the module with wrap_pymodule!
  5. Update crates/python_api/docs/api/sfpe-handbook.rst to document the new chapter

See crates/python_api/src/sfpe_handbook/chapter_50/ as a reference implementation.

Copilot generated this review using guidance from repository custom instructions.