Skip to content

Instantly share code, notes, and snippets.

@hierophantos
Created January 20, 2019 05:11
Show Gist options
  • Save hierophantos/d0c25278b3ef68eb77fa45295ca31561 to your computer and use it in GitHub Desktop.
Save hierophantos/d0c25278b3ef68eb77fa45295ca31561 to your computer and use it in GitHub Desktop.
logistic(X, R, N, Xs) :-
logistic_(X, R, N, [], Xs).
logistic_(_,_,0,Acc,Xs) :- !, flatten(Acc,Xs).
logistic_(X,R,N,Acc,Xs) :-
NewX is (R * X * (1 - X)),
NewN is N - 1,
logistic_(NewX,R,NewN, [Acc|X], Xs).
% :- logistic(0.2, 2.3, 10, Xs).
%@ Xs = [0.2, 0.368, 0.5349248, 0.572194594193408, 0.563012263309273, 0.5658677457470785, 0.5650213121614558, 0.5652761266190458, 0.5651997627753128, 0.5652226791482987].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment