What Should Be the Values of Ax and Ay in This Fortran 90 Code?

  • Topic: Fortran 
  • Thread starter Thread starter jhosamelly
  • Start date Start date
  • Tags Tags
    Fortran Machine
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 2K views
jhosamelly
Messages
125
Reaction score
0
5by0hs.jpg


I have the code.
Code:
program star
implicit none
real (kind=8) :: x
integer :: i

dt=0.001
pi=4*(atan1.0)

do i=1, Nsteps
     t = n*dt
     !calculate acceleration
     ax= 
     ay=...
     !calculate values at next step
     vy=vy+ay*dt
     vx=vx+ax*dt
     x=x+vx*dt
     y=y+vy*dt
end do

print *, "vx= ", vx
     
end program star
What should I put as Ax and Ay??
 
Last edited:
Physics news on Phys.org
like the question says, use a = -r/r^3 in component form... you'll need to start the program with some initial x and y value.

I don't know fortran very well, but it looks like you haven't defined Nsteps or n. Also the syntax for defining pi looks dodgy.
 
Last edited:
atan is an intrinsic function.

atan(1.0) is proper syntax