Screen Shot 2018-05-16 at 10.36.10 AM

Modelling more Chaos

This post was inspired by Rachel Thomas’ Nrich article on the same topic.  I’ll carry on the investigation suggested in the article.  We’re going to explore chaotic behavior – where small changes to initial conditions lead to widely different outcomes.  Chaotic behavior is what makes modelling (say) weather patterns so complex.

f(x) = sin(x)

This time let’s do the same with f(x) = sin(x).

Screen Shot 2018-05-16 at 10.12.48 AM

Starting value of x = 0.2

 

Screen Shot 2018-05-16 at 10.10.41 AM

 

Starting value of x = 0.2001

 

Screen Shot 2018-05-16 at 10.10.48 AM

 

Both graphs superimposed 

 

Screen Shot 2018-05-16 at 10.10.48 AM

This time the graphs do not show any chaotic behavior over the first 40 iterations – a small difference in initial condition has made a negligible difference to the output.  Even after 200 iterations we get the 2 values x = 0.104488151 and x = 0.104502319.

f(x) = tan(x)

Now this time with f(x) = tan(x).

Screen Shot 2018-05-16 at 10.21.55 AM

Starting value of x = 0.2

 

Screen Shot 2018-05-16 at 10.25.52 AM

 

Starting value of x = 0.2001

 

Screen Shot 2018-05-16 at 10.23.03 AM

 

Both graphs superimposed 

 

Screen Shot 2018-05-16 at 10.23.14 AM

This time both graphs remained largely the same up until around the 38th data point – with large divergence after that.  Let’s see what would happen over the next 50 iterations:

 

Screen Shot 2018-05-16 at 10.29.49 AM

Therefore we can see that tan(x) is much more susceptible to small initial state changes than sin(x).  This makes sense by considering the graphs of tan(x) and sin(x).  Sin(x) remains bounded between -1 and 1, whereas tan(x) is unbounded with asymptotic behaviour as we approach pi/2.