# Fortran - equation of motion, astronomical units

Tags:
1. Dec 14, 2014

### SalfordPhysics

1. The problem statement, all variables and given/known data
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.

2. Relevant equations
d2r / dt2 = -r/r3

3. 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?

2. Dec 14, 2014

### Staff: Mentor

What you wrote doesn't seem right.

Are you familiar with polar coordinates?

3. Dec 14, 2014

### SteamKing

Staff Emeritus
I wouldn't think so. Generally, for polar coordinates, r2 = x2 + y2, thus your definitions of Fx and Fy don't make sense.

4. Dec 14, 2014

### SalfordPhysics

Im not here no, there is no mention on my handout but could you go on anyway? regarding polar that is

5. Dec 14, 2014

### Staff: Mentor

Where is the sun, at (0, 0)?
Does the plain 'r' denote the magnitude of $\vec{r}$? To be clearer, you can write it as |r|.
What does this part -- "so for finding vx(i+1) I use Fx, as for vy and Fy." -- mean?

Last edited: Dec 14, 2014
6. Dec 14, 2014

### SalfordPhysics

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: Dec 14, 2014
7. Dec 14, 2014

### Staff: Mentor

I had another question that I didn't get the quotes right, so you might have missed it.
Since I don't know what the above means, I can't comment on what you have for vx below.

# # \vec{r} # # - take out the spaces between the first and second pair of # characters.

8. Dec 14, 2014

### SalfordPhysics

I've solved it now I just had to go from the beginning to understand things, no need for polar.