Why this formula gives approximation of e?

mXparser code:

Function s = new Function("s(n, x) = if( x >= 1, n, s(n+1, x + rUni(0,1) ) )");
Expression e = new Expression("avg( i, 1, 10000, s(0,0) )", s);

Result:

[mXparser-v.4.1.1] 2.7194

Best regards,
Mariusz Gromada

Leave a Reply

Your email address will not be published. Required fields are marked *