Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Machine Problem in Fortran 90

  1. Dec 16, 2012 #1
    5by0hs.jpg

    I have the code.
    Code (Text):


    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: Dec 16, 2012
  2. jcsd
  3. Dec 16, 2012 #2
    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: Dec 16, 2012
  4. Dec 16, 2012 #3

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    atan is an intrinsic function.

    atan(1.0) is proper syntax
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook