Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exploding Expectations in recursive Calls #199

Open
sumantrak opened this issue Mar 26, 2022 · 0 comments
Open

Exploding Expectations in recursive Calls #199

sumantrak opened this issue Mar 26, 2022 · 0 comments

Comments

@sumantrak
Copy link
Collaborator

sumantrak commented Mar 26, 2022

function example(t)
	new_t = t - 1
	if new_t == 0
		@show "block1"
		var = @~Normal()
		u = 蠅->饾敿2(mem(var))
		return u
	else
		@show "block2"
		var= Variable(example(new_t))
		u = 蠅->饾敿2(mem(var))
		return u
	end
end

the expectation function
蠅2 = def蠅(34432)
饾敿2(x) = mean(manynth(iid(x),1:10000)(蠅2))

This will work fine till t=2

but from t=3 onwards the expectation function is calling itself and so the number of copies of the random variable exponentially increases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant