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!

Homework Help: Numerical Integration

  1. Dec 2, 2013 #1
    1. The problem statement, all variables and given/known data

    This is for my computer simulations in physics class. The problem, as stated, is to numerically integrate a particular equation for a period of one year, given that the Earth starts at the point (1,0) with a velocity of (0,2pi). Then, I must plot the orbit.

    I am using Maple for this exercise. I know how to program in it just fine. I really just need help with understanding this problem.

    2. Relevant equations

    I must integrate this equation:

    [tex]G= 2\pi[/tex]
    [tex]M= Solar Mass[/tex]

    3. The attempt at a solution

    I knew that I would have to tackle this integration one part at a time, so I started by distributing the GM term. This part was simple. It is understanding the integration from this point on that I do not understand. I tried integrating in terms of x and then of y, but did not get the results I was expecting. For this plot to be a nice, circular orbit, the x and y components must be sin/cos graphs. I have gotten a few "answers" integrating it my way, but all of these answers were undefined for when x or y are 0. This should not be the case. I also know I am going wrong because I have 2 variables at the end, making the plot of the rotation impossible, even in Maple.

    I think I have started to approach the problem wrong as I have not found a way to incorporate the initial position or velocity. I doubt these are superficial pieces of information. My gut is telling me that the limits of integration are x and y, but I don't know how to make this work.

    I have tried looking up similar problems on other sites for several hours and I think I have a good handle on what the correct answer will look like when I get it, but at the moment, I'm a little stuck. I would appreciate any sort of help you could give me!

    [Note: I wasn't sure if I should post this in adv. physics or calculus help. I'm sorry if I didn't choose correctly!]
  2. jcsd
  3. Dec 2, 2013 #2
    This is a problem in finding the position of the earth moving in orbit about the sun as a function of time. Let x =x(t) and y = y(t) be the location of the earth at time t, and let vx(t) and vy(t) be the components of velocity of the earth at time t. You need to apply Newton's second law of motion to determine the differential equations (with respect to time) for how x, y, vx, and vy are varying with respect to time. Are you able to write down these equations? These are the equations that you need to integrate.

  4. Dec 3, 2013 #3
    I understand this in theory, but I'm not sure if I am doing it correctly in practice.

    The first thing I did was look at a picture of a unit circle to help orient me. I figured this would be the best course of action because I will end up with a perfectly circular rotation of the Earth around the Sun. My simulation will start at position (1,0), so that is where I started as well and began my rotation. What I noticed it that the X component of the position goes 1->0->-1>0, resembling a cosine wave. The Y-component, likewise, resembled a sine wave. Thus, the equations I settled on were:

    [tex] x=x(t)=cos(t)[/tex]
    [tex] y=y(t)=sin(t)[/tex]

    I plugged these into the equation I had for the acceleration due to gravity and then distributed. I did an indefinite integral for both the of the components and got:

    When I graph this in Maple, I seem to get something that looks like what I was looking for, in that it is a circle around the origin. Unfortunately, it looks like I am actually facing a few problems and I'm not sure if it is a programming error or an error with my math.

    Problem #1:
    I was expecting my graph to have a radius of 1AU, but I got a radius of 6E31. I don't know if it helps, but I set [tex]G=2pi*2, M=1.989E30[/tex]. I get the right radius if I set GM=1, but I don't know if there's any justification for doing so.

    Problem #2:
    I set [tex]t=0..2pi[/tex]. This seemed to be fine until I realized it causes the rotation to go clockwise when I was actually expecting counter-clockwise. I noticed that it goes the right way if I set [tex]t=0..-2pi[/tex], but I don't know if doing so is valid.

    Problem #3:
    I also noticed that I am having troubles solving the other problems related to this equation. When I increase or lower the velocity, I expect Earth to move closer or further away from the center, but my graphs just so a steady rotation, leading me to believe that even though the graph appeared correct for the first problem, I have a fundamental error somewhere.

    Thank you so much for all of your help, Chet! Your direction earlier was excellent and really got me on the right path, so I hope you don't mind helping me just a little bit more!
    Last edited: Dec 3, 2013
  5. Dec 3, 2013 #4
    This is all just a problem with units. Please check your units carefully.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted