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

Fortran help

  1. Mar 2, 2009 #1
    I am doing a problem with calculating orbits.
    The orbit can be expressed in polar coordinates as r=p/(1-ecos(theta)) where r and theta are the distance and angle of the satellite from the center of the earth, p is a paremter where p=1200 km, and e is a parameter representing eccentricity.
    I'm supposed to write a program to calculate the distance of the satellite from the earth as a function of theta if the satellite has an eccentrity of 0, .25, .5, .75, and 1.
    Write the program to input values of e and theta. Here is what I have done:

    program calculating_orbits
    implicit none
    real :: r !distance of the satellite from the center of the earth
    real :: theta !angle of the satellite from the center of the earth
    real, parameter :: p=1200 !parameter specifying the size of the orbit
    real :: e !parameter specifying the eccentricity of the orbit
    write (*,*) 'This program accepts inputs of theta and e and outputs the
    + value of r=p/(1-e*cos(theta)).'
    write (*,*) 'This program will run until a number not in the domain
    + is inputted.'
    write (*,*) 'Please input a real number.'
    read (*,*) e
    read (*,*) theta
    Now I get stuck. Any hints?
  2. jcsd
  3. Mar 6, 2009 #2
    can you try to write this in fortran and print r as your result?
  4. Apr 2, 2009 #3
    Few questions in fortran :)
    1. Which is the best plotting tool in fortran
    2. How to get out put in form of .dat files in fortran
    3. Can any one post a code for calculating floating point operations and finally plotting it..I read so many papers i never able to understand how they plot those
  5. Apr 3, 2009 #4


    User Avatar
    Science Advisor

    If you're using *NIX, you can use XMGRACE. Typically I just write a file which can be easily read into Excel.

    You can write in any form you want. I don't understand.

    Code (Text):

    DO i=1,10
      x = REAL(i)
      y = x**2
      WRITE(11,*) x,y
    END DO
  6. Apr 3, 2009 #5
    What about calculating floating point operation, suppose i have a mac and i am running a program then how to compare two programs ..how to plot graphs between floating point operations ......between these two programs
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook