I have a function that is randomly generated by another function. my goal is to have that function generated around 10 times, and find the expected value of all them.
Here is my problem: whenever I try to plot a random function directly (by plotting it the generating function for example) it all goes perfect, but when I try to have some kind of function in the middle it all goes down the hill.
I thought that maybe, because the generated function uses some variables I declare in it, then maybe it has some kind of problem with it when you try to pass it on to the next function, but even when I avoided using variables in it it still came out wierd
the working code:
plot(generatingFunction())
the bad code:
function R(x)
generatingFunction()(x)
end
plot(R)