comp1 - mine if the total energy behaves the way that you...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer project 1 PHZ 5156 Results due Thursday, August 31 Please submit your code and plots wherever requested. Results can be handed in either as a hardcopy, or as an electronic document (e.g. tex, latex, MS word, or even a .pdf) sent via email. 1. Look over the code handed out for a simple-harmonic oscillator. The idea is to integrate the equation of motion m d 2 y dt 2 + ky = 0 . (1) using a centered difference approach (a.k.a. the Leap Frog method). This algorithm is also often called the Verlet algorithm. 2. Using the time-step dt = 0 . 01 run the code for time = 100. Using gnuplot, produce a plot of the numerically-integrated y ( t ) and compare with the analytical result, which is also output by the code. Do they agree? Include a plot with your results. 3. Next use gnuplot to output the kinetic, potential, and total energies for the system. Make an analytical prediction for these. Explain what you expect for the total energy. Do you get what you expect? 4. Experiment with changing dt while keeping a fixed total simulation time. Deter-
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: mine if the total energy behaves the way that you expect. Notice that the way in which we have given the initial conditions, that the magnitude of the total energy depends on dt . As you increase dt , at some point you should produce poor results. Make an argument for how small the time step needs to be for good integration (Hint: what is the relevant time scale set by the problem?). 5. Add a damping and driving force to the problem, so that the equation of motion you will solve for is, m d 2 y dt 2 + v + ky = F cos t. (2) where the velocity v = dy dt Write a new code using the one in the handout that you were given as a starting point. Using the analytical solution, predict the resonance point and run a simulation at the resonance point. You might have to run awhile for transients to die away (i.e. consider the homogeneous solution without the driving 1 force and you determine the time). Do the computed amplitude and phase agree with analytical predictions? 2...
View Full Document

Page1 / 2

comp1 - mine if the total energy behaves the way that you...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online