I have defined a function:
myJ2[n_] := 1/n* Total[RandomVariate[NormalDistribution[0, 1], n]^2]
This is basically an approximation to the gaussian integral. I want to plot this and the error graph (difference between the approximation and the exact value) at the same time. Using a random variable makes this difficult. I tried this:
DiscretePlot[{myJ2[n], 1 - myJ2[n]}, {n, 1, 1000}, Filling -> None, Joined -> True]
However, this is not quite correct, since the myJ2 function is called twice and hence gives different values due to the randomness. I improved this by using:
DiscretePlot[{x, 1 - x} /. x -> myJ2[n], {n, 1, 1000}, Filling -> None, Joined -> True, PlotStyle -> {Red, Blue}]
This gives me the correct values but both in the same color. How can I get both the function and the error function displayed in two graphs or with two different colors?
Thanks
Charly