Numerical Integration Homework: Solve & Plot Earth's Orbit in 1 Year

In summary, the problem is to numerically integrate a particular equation for a period of one year, given the initial position and velocity of the Earth, and then plot the orbit. The equation involves the gravitational force and the solar mass. The attempt at a solution involved distributing the GM term and then trying to integrate in terms of x and y, but the results were not as expected. The correct approach involves using Newton's second law of motion to determine the differential equations and then integrating them. The simulation will start at position (1,0) and the resulting orbit will resemble a cosine and sine wave for the x and y components, respectively.
  • #1
slavito
3
0

Homework Statement



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.

Homework Equations



I must integrate this equation:
[tex]\frac{-GM}{r^2}\hat{r}=\frac{-GM}{(x^2+y^2)^\frac{3}{2}}(x\hat{i}+y\hat{j})[/tex]

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

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!]
 
Physics news on Phys.org
  • #2
slavito said:

Homework Statement



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.

Homework Equations



I must integrate this equation:
[tex]\frac{-GM}{r^2}\hat{r}=\frac{-GM}{(x^2+y^2)^\frac{3}{2}}(x\hat{i}+y\hat{j})[/tex]

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

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!]
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.

Chet
 
  • #3
Chestermiller said:
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.

Chet

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:
[tex]v_x=4pi^2Mcos(t)[/tex]
[tex]v_y=-4pi^2Msin(t)[/tex]

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:
  • #4
This is all just a problem with units. Please check your units carefully.
 
  • #5


Dear student,

First of all, great job on tackling this problem and trying to understand it on your own. It's always important to try to figure things out yourself before seeking help.

Now, let's break down the problem step by step. The equation you are given is the gravitational force equation, which describes the force between two objects due to gravity. In this case, the two objects are the Earth and the Sun, and the equation tells us how the Earth's position and velocity will change over time due to the gravitational force from the Sun.

To solve this problem, we will use numerical integration, which is a method of approximating the solution to a differential equation (in this case, the equation describing the Earth's orbit) by dividing it into small time steps and calculating the change in position and velocity at each time step.

Step 1: Setting up the problem
The first step is to set up the problem and define the initial conditions. In this case, the Earth starts at the point (1,0) with a velocity of (0,2pi) (assuming we are using a coordinate system where the Earth's orbit is in the x-y plane). We can also define the constants G and M.

Step 2: Choosing a time step
Next, we need to choose a time step. This is the amount of time that will pass between each calculation of the Earth's position and velocity. The smaller the time step, the more accurate our solution will be, but it will also take longer to calculate. For this problem, a time step of 1 day (or even smaller, if you want) should be sufficient.

Step 3: Calculating the forces
At each time step, we need to calculate the force on the Earth due to the Sun. This can be done using the equation you were given, where r is the distance between the Earth and the Sun. To calculate r, we can use the distance formula: r = sqrt((x-x_s)^2 + (y-y_s)^2), where (x_s, y_s) is the position of the Sun. Once we have calculated the force, we can use Newton's second law (F = ma) to calculate the acceleration of the Earth.

Step 4: Updating the position and velocity
Using the calculated acceleration, we can update the position and velocity of the Earth at each time step. This can be done using the equations x = x_0 + v_0
 

Related to Numerical Integration Homework: Solve & Plot Earth's Orbit in 1 Year

1. How do you solve for Earth's orbit using numerical integration?

To solve for Earth's orbit using numerical integration, you will need to use a computer program or mathematical software that has built-in numerical integration functions. You will also need to know the initial conditions of Earth's orbit, such as its position and velocity, and the force acting on Earth due to the gravitational pull of the sun. The numerical integration algorithm will then use these inputs to calculate the position of Earth at each time step, allowing you to plot its orbit over the course of one year.

2. What is the purpose of using numerical integration to solve for Earth's orbit?

Numerical integration allows us to accurately calculate the position of Earth at each time step, taking into account the changing forces acting on it due to the sun's gravity. This method is necessary because the equations governing Earth's orbit are complex and can't be solved analytically. By using numerical integration, we can create a plot of Earth's orbit that takes into account all the relevant variables and accurately reflects the elliptical shape of the orbit.

3. What is the difference between numerical integration and analytical integration?

Numerical integration is a method for approximating the solution to a complex mathematical problem, while analytical integration involves finding an exact solution using mathematical formulas. In the case of Earth's orbit, numerical integration is necessary because the equations governing the orbit cannot be solved analytically. Instead, we use numerical methods to calculate the position of Earth at each time step and create a plot of its orbit.

4. What are the advantages of using numerical integration to solve for Earth's orbit?

Numerical integration allows us to accurately model the behavior of complex systems, such as Earth's orbit, by taking into account multiple variables and forces. It is also a versatile and efficient method that can be applied to a wide range of problems in various fields, including physics, engineering, and economics. Additionally, numerical integration can handle nonlinear equations that cannot be solved analytically, making it an essential tool for many scientific and technological advancements.

5. What are some potential challenges when using numerical integration to solve for Earth's orbit?

One potential challenge when using numerical integration to solve for Earth's orbit is selecting an appropriate time step. If the time step is too large, the results may be inaccurate or unstable. However, if the time step is too small, the computation time and resources required may be too high. Another challenge is choosing the best numerical integration algorithm for the specific problem at hand, as different algorithms have different accuracy and stability properties. It is also essential to ensure that all the relevant forces and variables are correctly included in the calculations to obtain an accurate representation of Earth's orbit.

Similar threads

  • Advanced Physics Homework Help
Replies
1
Views
1K
  • Advanced Physics Homework Help
Replies
1
Views
536
  • Advanced Physics Homework Help
Replies
7
Views
1K
  • Advanced Physics Homework Help
Replies
24
Views
1K
  • Advanced Physics Homework Help
Replies
26
Views
3K
Replies
2
Views
1K
  • Advanced Physics Homework Help
Replies
9
Views
1K
  • Advanced Physics Homework Help
Replies
5
Views
879
Replies
1
Views
891
  • Advanced Physics Homework Help
Replies
1
Views
2K
Back
Top