time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1184B)


      1 
      2 {{alias}}( t, p )
      3     Evaluates the moment-generating function (MGF) for a Bernoulli
      4     distribution with success probability `p` at a value `t`.
      5 
      6     If provided `NaN` as any argument, the function returns `NaN`.
      7 
      8     If `p < 0` or `p > 1`, the function returns `NaN`.
      9 
     10     Parameters
     11     ----------
     12     t: number
     13         Input value.
     14 
     15     p: number
     16         Success probability.
     17 
     18     Returns
     19     -------
     20     out: number
     21         Evaluated MGF.
     22 
     23     Examples
     24     --------
     25     > var y = {{alias}}( 0.2, 0.5 )
     26     ~1.111
     27     > y = {{alias}}( 0.4, 0.5 )
     28     ~1.246
     29     > y = {{alias}}( NaN, 0.0 )
     30     NaN
     31     > y = {{alias}}( 0.0, NaN )
     32     NaN
     33     > y = {{alias}}( -2.0, -1.0 )
     34     NaN
     35     > y = {{alias}}( 0.2, 2.0 )
     36     NaN
     37 
     38 
     39 {{alias}}.factory( p )
     40     Returns a function for evaluating the moment-generating function (MGF) of a
     41     Bernoulli distribution with success probability `p`.
     42 
     43     Parameters
     44     ----------
     45     p: number
     46         Success probability.
     47 
     48     Returns
     49     -------
     50     mgf: Function
     51         Moment-generating function (MGF).
     52 
     53     Examples
     54     --------
     55     > var mymgf = {{alias}}.factory( 0.8 );
     56     > var y = mymgf( -0.2 )
     57     ~0.855
     58 
     59     See Also
     60     --------
     61