1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Simple Energy Question based on SHM

  1. Feb 20, 2016 #1


    User Avatar
    Gold Member

    1. The problem statement, all variables and given/known data
    I am taksed with putting some simple harmonic motion (in this case linear harmonic motion) into graphs.
    For my first graph, I am graphing theta vs. time and analyzing three different numerical methods for the solution (Euler, Euler-cramer, Runge Katta).
    For my second graph, I am looking at the Energy vs. time based on these results.
    Attached in the solutions are my results.

    2. Relevant equations

    3. The attempt at a solution



    Unfortuantely the labels are hard to read from jpg format. But the Euler method= black, the euler-cromer = red = runge-kutta method = blue.

    My question is this: I know that my linear harmonic oscillator graph for motion is correct. I have a feeling my energy calculation is wrong, which is why I am posting here.
    My energy calculation for euler method seems consistent. The energy continues to grow, infinite energy! Which is the problem with the Euler method here.

    But my energy calculation for Runge-kutta and Euler-cromer method, I would have thought, were supposed to be a constant.
    Or is my interpretation wrong and my graph actually correct?
  2. jcsd
  3. Feb 20, 2016 #2


    User Avatar
    Gold Member

    I am going to post my second problem as it is highly related:
    For this code, I am graphing Ideal Motion (red), Motion with dampening (black) , and then motion with dampening and a driving force (blue).

    The energy calculations should be the same from my initial post, which is why it is relevant.

    As we see, the black energy curve flatlines, which seems consistent with the graph of its motion. However, should it be flatlining at the 1800 mark like it does, or at the 0 mark? That's confusing to me.

    Similiarly, red and blue don't seem to be losing or gaining much energy in the graph of motion, but they shoot up linearly quite fast.

  4. Feb 20, 2016 #3


    User Avatar
    Gold Member

    I think I might have solved it while I was creating the post above!
    I deleted a part of my code for my energy calculation, and I get this:
    So the red curve we see a consistent energy which works with it's graph of motion.
    The blue energy curve also works with the motion seen as at first it starts high then goes consistent.
    The black curve now 0's out.

    Looking good?

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted

Similar Threads - Simple Energy Question Date
Simple Conservation of energy question Aug 12, 2016
Simple harmonic motion energy question Jun 5, 2015
Work and Energy Question Nov 27, 2014
Energy & work -- simple question Oct 5, 2014
Simple energy question with rotation Nov 10, 2012