Lesson goal: Iterating the "logistic" function with a for-loop

Previous: Iterating a function | Home | Next: Iterate for a square-root

We hope you liked the idea of interating a function as shown in a previous lesson. In this lesson, we'll iterate a famous function called the "logistic function," which is $x=cx(1-x)$. This function has a fascinating interation result, depending on what you assign to the variable $c$. In this lesson, you must keep your inital value of $x$ between $0$ and $1$, so $0< x <1$. Next try three different runs, each for these values of $c$: $c=1.5$, $c=3.2$ and $c=3.5$. See what pattern of numbers you might notice with each step.

Now you try. Try constructing a for loop that will count and display the count.

Type your code here:


See your results here:

This code will not run. Finish the for i=1, line to put in how many times you wish to interate the logistic funcxtion. Lastly, program in the logistic function in the x= line. Dismiss.
Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.