(self,t, n_simulations = 10000)
return sum/n_simulations
This needs to solve the following:
          E[ min(N) | T_1 + T_2 + .. T_N >= t ]
        <=>
          E[ N | T_1 + T_2 + .. T_{N-1} < t, T_1 + T_2 + .. T_N >= t ]
        where we can sample T only.
This needs to solve the following:
          E[ min(N) | T_1 + T_2 + .. T_N >= t ]
        <=>
          E[ N | T_1 + T_2 + .. T_{N-1} < t, T_1 + T_2 + .. T_N >= t ]
        where we can sample T only.
This needs to solve the following : E [ min ( N ) | T_1 + T_2 + .. T_N > = t ] < = > E [ N | T_1 + T_2 + .. T_ { N - 1 } < t T_1 + T_2 + .. T_N > = t ] where we can sample T only .
def _mean_number_of_jumps(self,t, n_simulations = 10000):
        self._check_time(t)
        """
        This needs to solve the following:
          E[ min(N) | T_1 + T_2 + .. T_N >= t ]
        <=>
          E[ N | T_1 + T_2 + .. T_{N-1} < t, T_1 + T_2 + .. T_N >= t ]
        where we can sample T only. 
        
        """
        warnings.warn("Attn: performing MC simulation. %d simulations."%n_simulations)
        v = np.zeros( n_simulations )
        continue_ = True
        i = 1
        t = t - self.startTime #should be positive.
        size = v.shape[0]
        sum = 0
        sum_sq = 0
        while continue_:
            v += self.T.rvs( size )
            #count how many are greater than t
            n_greater_than_t = (v>=t).sum()
            sum += n_greater_than_t*i 
            
            v = v[v < t]
            i+=1
            size = v.shape[0]
            empty = size == 0
            
            
            if empty:
                continue_ = False
                
            if i > 10000:
                warnings.warn("The algorithm did not converge. Be sure 'T' is a non negative random \
                                variable, or set 't' lower.")
                break

        return sum/n_simulations
def _mean_number_of_jumps ( self , t , n_simulations = 10000 ) : self . _check_time ( t ) warnings . warn ( "Attn: performing MC simulation. %d simulations." % n_simulations ) v = np . zeros ( n_simulations ) continue_ = True i = 1 t = t - self . startTime #should be positive. size = v . shape [ 0 ] sum = 0 sum_sq = 0 while continue_ : v += self . T . rvs ( size ) #count how many are greater than t n_greater_than_t = ( v >= t ) . sum ( ) sum += n_greater_than_t * i v = v [ v < t ] i += 1 size = v . shape [ 0 ] empty = size == 0 if empty : continue_ = False if i > 10000 : warnings . warn ( "The algorithm did not converge. Be sure 'T' is a non negative random \
                                variable, or set 't' lower." ) break return sum / n_simulations