Fortran - equation of motion, astronomical units

In summary: What does this part -- "so for finding vx(i+1) I use Fx, as for vy and Fy." -- mean?This part of the code means that for finding vx(i+1) you use Fx, which is the function that takes the x component of the displacement vector vx(i+1) and the y component of the displacement vector vy(i+1).
  • #1
SalfordPhysics
69
1

Homework Statement


Euler method : Plot the trajectory of a body moving under the influence of the suns gravity from initial conditions x=1, y=0, vx=0, vy=1.
My trouble is figuring out my function.

Homework Equations


d2r / dt2 = -r/r3

The Attempt at a Solution


What I have been doing previously is breaking the function into x and y components, so for finding vx(i+1) I use Fx, as for vy and Fy.
So for this case;
Fx = -(x+0)/(SQRT(x2 + 0)3
Fy = -(0+y)/(SQRT(0 + y2)3

Is this right?
 
Physics news on Phys.org
  • #2
What you wrote doesn't seem right.

Are you familiar with polar coordinates?
 
  • #3
SalfordPhysics said:

Homework Statement


Euler method : Plot the trajectory of a body moving under the influence of the suns gravity from initial conditions x=1, y=0, vx=0, vy=1.
My trouble is figuring out my function.

Homework Equations


d2r / dt2 = -r/r3

The Attempt at a Solution


What I have been doing previously is breaking the function into x and y components, so for finding vx(i+1) I use Fx, as for vy and Fy.
So for this case;
Fx = -(x+0)/(SQRT(x2 + 0)3
Fy = -(0+y)/(SQRT(0 + y2)3

Is this right?
I wouldn't think so. Generally, for polar coordinates, r2 = x2 + y2, thus your definitions of Fx and Fy don't make sense.
 
  • #4
Im not here no, there is no mention on my handout but could you go on anyway? regarding polar that is
 
  • #5
SalfordPhysics said:

Homework Statement


Euler method : Plot the trajectory of a body moving under the influence of the suns gravity from initial conditions x=1, y=0, vx=0, vy=1.
My trouble is figuring out my function.
Where is the sun, at (0, 0)?
SalfordPhysics said:

Homework Equations


d2r / dt2 = -r/r3
Does the plain 'r' denote the magnitude of ##\vec{r}##? To be clearer, you can write it as |r|.
SalfordPhysics said:

The Attempt at a Solution


What I have been doing previously is breaking the function into x and y components, so for finding vx(i+1) I use Fx, as for vy and Fy.
What does this part -- "so for finding vx(i+1) I use Fx, as for vy and Fy." -- mean?
SalfordPhysics said:
So for this case;
Fx = -(x+0)/(SQRT(x2 + 0)3
Fy = -(0+y)/(SQRT(0 + y2)3

Is this right?
 
Last edited:
  • #6
I assume the Sun must be at (0,0) yes. And yes r = |r|.
Also, how do you do the vector notation?
Regarding your edit to the code;
I proceed as follows;
x(i+1) = x(i) + vx(i).dt
vx(i+1) = vx(i) + ax(i).dt where ax(i)=Fx i.e.; -r/|r|3
It follows as with my trajectory problem you helped with previously.
 
Last edited:
  • #7
I had another question that I didn't get the quotes right, so you might have missed it.
Mark44 said:
What does this part -- "so for finding vx(i+1) I use Fx, as for vy and Fy." -- mean?

Since I don't know what the above means, I can't comment on what you have for vx below.

SalfordPhysics said:
I assume the Sun must be at (0,0) yes. And yes r = |r|.
Also, how do you do the vector notation?
# # \vec{r} # # - take out the spaces between the first and second pair of # characters.
SalfordPhysics said:
Regarding your edit to the code;
I proceed as follows;
x(i+1) = x(i) + vx(i).dt
vx(i+1) = vx(i) + ax(i).dt where ax(i)=Fx i.e.; -r/|r|3
It follows as with my trajectory problem you helped with previously.
 
  • #8
I've solved it now I just had to go from the beginning to understand things, no need for polar.
 

Related to Fortran - equation of motion, astronomical units

1. What is Fortran?

Fortran is a computer programming language used primarily for numerical and scientific computing. It was developed in the 1950s by a team of programmers at IBM and is still widely used today in various scientific and engineering fields.

2. What is the equation of motion in Fortran?

The equation of motion in Fortran is a mathematical expression that describes the motion of an object or system as a function of time. This can include variables such as position, velocity, acceleration, and forces acting on the object.

3. How is Fortran used in astronomy?

Fortran is commonly used in astronomy for computational tasks such as simulating planetary orbits, analyzing large datasets, and solving complex equations. It is also used in developing and running numerical models for astrophysical simulations.

4. What are astronomical units in Fortran?

Astronomical units (AU) in Fortran are a unit of measurement used to represent distances in space, particularly in our solar system. 1 AU is equivalent to the average distance between the Earth and the Sun, approximately 149.6 million kilometers.

5. How can Fortran be beneficial for studying celestial bodies?

Fortran's ability to handle large datasets and perform complex calculations makes it a valuable tool for studying celestial bodies. It allows for efficient processing and analysis of astronomical data, aiding in the discovery and understanding of various phenomena in the universe.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
6
Views
938
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
1K
  • Introductory Physics Homework Help
Replies
11
Views
299
  • Engineering and Comp Sci Homework Help
Replies
18
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Advanced Physics Homework Help
Replies
3
Views
2K
  • Programming and Computer Science
Replies
4
Views
749
Replies
8
Views
848
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
Back
Top