Advertisement
Guest User

Logistic function

a guest
Oct 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function logistic_chaos(r,x,n){
  3.   if (isNaN(r) || r <0 || r > 4){
  4.     throw "logistic_chaos: r has to be a number in between 0 and 4 (inclusive)! r="+r;
  5.   }else if(isNaN(r) || x <0 || x > 1 ){
  6.     throw "logistic_chaos: x0 has to be a number in between 0 and 4 (inclusive)! r="+r;
  7.   }else if(isNaN(n) || n < 0) {
  8.     for(let i = 0; i < n; i++){
  9.       let newF = r*x*(1-x);
  10.       document.writeln(newF+"<br>");
  11.       x = newF;
  12.     }
  13.   }
  14. }
  15.  
  16. logistic_chaos(2, 0.3, 10);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement