I decided to try and learn Julia for doing scientific computing, and I decided to tackle the problem of finding
$$ \int_{D_{\frac{1}{4}}} x^4 + y^2 dA $$
where \$ D_{\frac{1}{4}} \$ is the part of the unit circle in the first cuadrant.
My code in Julia is the following:
using Distributions
e = 10.0^(-3);
p = 0.85;
variance = 4;
N = floor(Int, variance / ((1-p)*((e/2)^2))) + 1
u = Uniform(0,2);
x = rand(N);
y = rand(N);
z = rand(u, N);
result = sum((x.^2 + y.^2 .<= 1) & (z .<= x.^4 + y.^2))*2.0 / N
which gives the nice result \$ = 0.2945746303294543 \$
I kindly ask for how to improve my implementation, and reduce the footprint of memory (it uses almost 2 to 3gb in RAM).