update
This commit is contained in:
parent
9237604532
commit
b4ec09c9af
|
@ -1,25 +1,5 @@
|
||||||
use crate::types::{CustomUnitIngestionDose, StandardIngestionDose};
|
use crate::types::{CustomUnitIngestionDose, StandardIngestionDose};
|
||||||
|
|
||||||
pub fn calculate_standard_deviation(
|
|
||||||
expectation_x: f64,
|
|
||||||
standard_deviation_x: f64,
|
|
||||||
expectation_y: f64,
|
|
||||||
standard_deviation_y: f64,
|
|
||||||
) -> Option<f64> {
|
|
||||||
let sum_x = standard_deviation_x.powi(2) + expectation_x.powi(2);
|
|
||||||
let sum_y = standard_deviation_y.powi(2) + expectation_y.powi(2);
|
|
||||||
|
|
||||||
let expectations = expectation_x.powi(2) * expectation_y.powi(2);
|
|
||||||
|
|
||||||
let product_variance = (sum_x * sum_y) - expectations;
|
|
||||||
println!("{} {} {} {}", sum_x, sum_y, expectations, product_variance);
|
|
||||||
if product_variance > 0.0000001 {
|
|
||||||
Some((product_variance.sqrt() * 100.0).round() / 100.0)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn calulate_custom_unit_ingestion_dose(
|
pub fn calulate_custom_unit_ingestion_dose(
|
||||||
dose: &CustomUnitIngestionDose,
|
dose: &CustomUnitIngestionDose,
|
||||||
custom_unit_dose: &CustomUnitIngestionDose,
|
custom_unit_dose: &CustomUnitIngestionDose,
|
||||||
|
|
Loading…
Reference in a new issue