@@ -11,13 +11,14 @@ use std::f64;
1111/// # Examples
1212///
1313/// ```
14- /// use statrs::distribution::{ChiSquared, Continuous};
15- /// use statrs::statistics::Distribution ;
14+ /// use statrs::distribution::{ChiSquared, Continuous, GammaError };
15+ /// use statrs::statistics::* ;
1616/// use statrs::prec;
1717///
18- /// let n = ChiSquared::new(3.0).unwrap() ;
19- /// assert_eq!(n.mean().unwrap() , 3.0);
18+ /// let n = ChiSquared::new(3.0)? ;
19+ /// assert_eq!(n.mean(), 3.0);
2020/// assert!(prec::almost_eq(n.pdf(4.0), 0.107981933026376103901, 1e-15));
21+ /// # Ok::<(), GammaError>(())
2122/// ```
2223#[ derive( Copy , Clone , PartialEq , Debug ) ]
2324pub struct ChiSquared {
@@ -56,10 +57,11 @@ impl ChiSquared {
5657 /// # Examples
5758 ///
5859 /// ```
59- /// use statrs::distribution::ChiSquared;
60+ /// use statrs::distribution::{ ChiSquared, GammaError} ;
6061 ///
61- /// let n = ChiSquared::new(3.0).unwrap() ;
62+ /// let n = ChiSquared::new(3.0)? ;
6263 /// assert_eq!(n.freedom(), 3.0);
64+ /// # Ok::<(), GammaError>(())
6365 /// ```
6466 pub fn freedom ( & self ) -> f64 {
6567 self . freedom
@@ -70,10 +72,11 @@ impl ChiSquared {
7072 /// # Examples
7173 ///
7274 /// ```
73- /// use statrs::distribution::ChiSquared;
75+ /// use statrs::distribution::{ ChiSquared, GammaError} ;
7476 ///
75- /// let n = ChiSquared::new(3.0).unwrap() ;
77+ /// let n = ChiSquared::new(3.0)? ;
7678 /// assert_eq!(n.shape(), 3.0 / 2.0);
79+ /// # Ok::<(), GammaError>(())
7780 /// ```
7881 pub fn shape ( & self ) -> f64 {
7982 self . g . shape ( )
@@ -84,10 +87,11 @@ impl ChiSquared {
8487 /// # Examples
8588 ///
8689 /// ```
87- /// use statrs::distribution::ChiSquared;
90+ /// use statrs::distribution::{ ChiSquared, GammaError} ;
8891 ///
89- /// let n = ChiSquared::new(3.0).unwrap() ;
92+ /// let n = ChiSquared::new(3.0)? ;
9093 /// assert_eq!(n.rate(), 0.5);
94+ /// # Ok::<(), GammaError>(())
9195 /// ```
9296 pub fn rate ( & self ) -> f64 {
9397 self . g . rate ( )
0 commit comments