Blog of Andrés Aravena
Share this page!
CMB2:

Homework 8

21 April 2019. Deadline: Friday, 26 April, 9:00.

Please download the file homework8.R and write your results there. Send the your answers to my mailbox.

1. Replicate plots from last class

In the last class we simulated the water formation system under different rates and initial conditions. The system is represented by this graph: water_system

The code to make one simulation is this:

Please write the code to draw the following plot. You will need to simulate several times for different rates and initial conditions

2. Simulate a chaotic system

In the class we also saw a chaotic system, that can have high sensitivity to initial conditions. The system is very simple

%3

After simplification, this system can be simulated by the following code:

As we said, the behavior depends on the value of A. Please write the code that simulates this system for different values of A from 2.9 to 4 by 0.001, with x_ini=0.4 and N=1500. Take the final 500 values of each simulation and draw them using pch=".". You should see this:

There are at least two ways to do this plot.

3. Many dice

In class we simulated throwing two dice at the same time. What if we throw 3 dice? Or 10? Or 100?

Please write the code to simulate N times the experiment “throw M dice and count the total of points”. Something like

If you do it right, you should be able to draw a plot like this:

Deadline: Friday, 26 April, 9:00.