[−][src]Struct statrs::distribution::Cauchy
Implements the Cauchy distribution, also known as the Lorentz distribution.
Examples
use statrs::distribution::{Cauchy, Continuous}; use statrs::statistics::Mode; let n = Cauchy::new(0.0, 1.0).unwrap(); assert_eq!(n.mode(), 0.0); assert_eq!(n.pdf(1.0), 0.1591549430918953357689);
Methods
impl Cauchy
[src]
pub fn new(location: f64, scale: f64) -> Result<Cauchy>
[src]
Constructs a new cauchy distribution with the given location and scale.
Errors
Returns an error if location or scale are NaN
or scale <= 0.0
Examples
use statrs::distribution::Cauchy; let mut result = Cauchy::new(0.0, 1.0); assert!(result.is_ok()); result = Cauchy::new(0.0, -1.0); assert!(result.is_err());
pub fn location(&self) -> f64
[src]
Returns the location of the cauchy distribution
Examples
use statrs::distribution::Cauchy; let n = Cauchy::new(0.0, 1.0).unwrap(); assert_eq!(n.location(), 0.0);
pub fn scale(&self) -> f64
[src]
Returns the scale of the cauchy distribution
Examples
use statrs::distribution::Cauchy; let n = Cauchy::new(0.0, 1.0).unwrap(); assert_eq!(n.scale(), 1.0);
Trait Implementations
impl Univariate<f64, f64> for Cauchy
[src]
fn cdf(&self, x: f64) -> f64
[src]
Calculates the cumulative distribution function for the
cauchy distribution at x
Formula
(1 / π) * arctan((x - x_0) / γ) + 0.5
where x_0
is the location and γ
is the scale
impl Continuous<f64, f64> for Cauchy
[src]
fn pdf(&self, x: f64) -> f64
[src]
Calculates the probability density function for the cauchy
distribution at x
Formula
1 / (πγ * (1 + ((x - x_0) / γ)^2))
where x_0
is the location and γ
is the scale
fn ln_pdf(&self, x: f64) -> f64
[src]
Calculates the log probability density function for the cauchy
distribution at x
Formula
ln(1 / (πγ * (1 + ((x - x_0) / γ)^2)))
where x_0
is the location and γ
is the scale
impl Min<f64> for Cauchy
[src]
fn min(&self) -> f64
[src]
Returns the minimum value in the domain of the cauchy distribution representable by a double precision float
Formula
NEG_INF
impl Max<f64> for Cauchy
[src]
fn max(&self) -> f64
[src]
Returns the maximum value in the domain of the cauchy distribution representable by a double precision float
Formula
INF
impl Entropy<f64> for Cauchy
[src]
fn entropy(&self) -> f64
[src]
Returns the entropy of the cauchy distribution
Formula
ln(γ) + ln(4π)
where γ
is the scale
impl Median<f64> for Cauchy
[src]
fn median(&self) -> f64
[src]
Returns the median of the cauchy distribution
Formula
x_0
where x_0
is the location
impl Mode<f64> for Cauchy
[src]
fn mode(&self) -> f64
[src]
Returns the mode of the cauchy distribution
Formula
x_0
where x_0
is the location
impl Copy for Cauchy
[src]
impl Clone for Cauchy
[src]
fn clone(&self) -> Cauchy
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<Cauchy> for Cauchy
[src]
impl Debug for Cauchy
[src]
impl Distribution<f64> for Cauchy
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,