Course Hero Logo

05 is the difference e n uniformly small throughout

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 151 - 153 out of 614 pages.

05. Is the difference ∆Enuniformlysmall throughout the cycle? Does ∆Endrift, that is, become bigger with time? What is theoptimum choice of ∆t?b.Use the Euler-Cromer algorithm to answer the same questions as in part (a).c.Modify the program so that the Euler-Richardson algorithm is used and answer the same ques-tions as in part (a).d.Compute ∆Enand describe the qualitative difference between the time dependence of ∆Enus-ing the three algorithms. Which method is most consistent with the requirement of conservationof energy? For fixed ∆t, which algorithm yields better results for the position in comparison tothe analytical solution (6.4)? Is the requirement of conservation of energy consistent with therelative accuracy of the computed positions? For which algorithm does the total energy driftthe least?e.Choose the best algorithm based on the criteria of your choice and determine the values of ∆tthat are needed to conserve the total energy to within 0.1% over one cycle forω0= 3 and forω0= 6. Can you use the same value of ∆tfor both values ofω0? If not, how do the values oftcorrespond to the relative values of the period in the two cases?f.It might occur to you that adding a correction for the acceleration to the Euler method wouldproduce more accurate results. TheVerletalgorithm is based on this idea. One form of thisalgorithm is given by:xn+1=xn+vnt+12an(∆t)2,(6.9a)andvn+1=vn+12(an+1+an)∆t.(6.9b)Modify the program so that the Verlet algorithm is used.You might have noticed that modifying your program each time so that a different algorithmcan be tested is not very object oriented. In Chapter7we will introduce theODEinterface to allowchanges in the algorithm to be made easily.6.3ThreadsIn Chapter5and Section6.2we simulated the motion of a particle by solving Newton’s equationsof motion using several simple numerical methods. The solutions that we obtained were plotted,but we did not attempt to visualize the motion as it occurred, and all our plots were generatedafterthe calculations were completed. You probably also noticed that our programs ran for anumber of time steps that was determined by a while statement or predetermined by the user.
CHAPTER 6. OSCILLATIONS AND THE SIMULATION INTERFACE101Hence, we could not intervene to stop the simulation or change a parameter. In the following wewill find that in order to visualize the motion as it occurs or to intervene during the simulation tochange a parameter, it is necessary to usethreads.TheCalculationinterface has an important limitation — it is unable to respond to the clickof a button while the calculation is being performed. This lack of response is not a problem if thecalculation is short. However, if the calculation takes a long time, the user might assume that theprogram has crashed or is an infinite loop.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 614 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Summer
Professor
S.B.Ghosh

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture