Science and Computers -- PHY307/607

Lab 2. - Editing and running Java applets

In the first part of this lab you will learn how to improve your HelloWorldApplet from lab 1. You will then use another Java applet - the MappingApplet to explore some of the properties of a simple system which can exhibit chaotic behavior.

Improving your HelloWorldApplet

  1. What do you see ?
  2. What do you think the routine (Java calls them methods) setColor() does ?
  3. What do you think the method fillRect() does ?
  4. Edit Hwa2.java so that the background color is now red and the writing is now yellow. Recompile and check your changes work ...

Running a real Java applet - a simple chaos experiment

  1. In Netscape go to the PHY307 homepage. Look under the LABS section and link to the Java applet MappingApplet. You should see a graph appear within your Web page.
  2. The graph shows successive iterates of the logistic map we discussed in class. That is a new value for x is gotten from the equation
    
    x_(n+1)=ax_n(1-x_n)
    
    
    A new iteration is done by clicking on the Iterate button. The value of the iterate x is shown by the y coordinate while the number of iterations is shown by the x coordinate. The x scale runs to 10 -- where is iterate 11 plotted ? The x-axis always shows (up to) the last 10 iterations.
  3. Type the value 0.8 into the a= box. Hit return now (this is very important - otherwise the change to a will not be registered). Also type a value of 0.1 into the x= box and also hit return. What is the value of x after many iterations ? Sketch a graph of what you see.
  4. Keeping the same value of a change the initial value of x to 0.05. What is final value of x after many iterations. What is the final value when the initial value of x is set as 0.2 ?
  5. Now change a to 1.5 and set x back to 0.1. Again sketch a graph of how x changes under repeated iteration. Does the final value of x depend on its initial value ?
  6. What happens to the iteration for a=2.5 ? All of the experiments so far have shown that after large numbers of iterations the values of x approach a constant (which depends on a) independent of the initial value of x. This is called fixed point behavior.
  7. Now set a=3.2 and x=0.5. Iterate again. What do you see ? Sketch the iterate graph after many iterations. Write down the values of x you see after many iterations (you can read them off the x= box). This is called periodic behavior.
  8. What happens if you set a=3.53 ? Sketch the iterate graph after many iterations. What are the values of x that you see ?
  9. Do a similar experiment at a=3.55 and now comment on the shape of the graph and the values of x that are seen.
  10. Finally set a=3.8 and iterate. Comment - you are now in a chaotic regime !
To get credit for this lab you need to
  1. Email me with the subject line lab2 and include in the body of your email the web address (url) of your Hwa2 applet.
  2. Answer the questions posed in the lab -- hand in your answers on paper.
The deadline to get these things to me is next Thursday. Remember to Log off before leaving the computer !

Back to the PHY307 Homepage

This page maintained by Simon Catterall, last updated 7 September, 1998.