Function fang_oost::get_expectation_single_element_real[][src]

pub fn get_expectation_single_element_real<'a, U>(
    x_min: f64,
    x_max: f64,
    x: f64,
    fn_inv_discrete: &[Complex<f64>],
    vk: U
) -> f64 where
    U: Fn(f64, f64, usize) -> f64 + Sync + Send + 'a, 

Returns expectation at point supplied by the user

Remarks

The endpoints of the vector should have a large enough domain for accuracy.
The "type" of the expecation is handled by the vk function.

Examples

extern crate num_complex;
use num_complex::Complex;
extern crate fang_oost;
let x_min = -20.0;
let x_max = 25.0;
let x = 3.0;
let norm_cf_discrete = vec![Complex::new(1.1, 1.0), Complex::new(0.2, 0.3)];
let result=fang_oost::get_expectation_single_element_real(
   x_min, x_max, x, &norm_cf_discrete, 
    |u, x, k|{
        if k==0{x-x_min} else { ((x-x_min)*u).sin()/u }
    }
);