Register to reply

Machine Problem in Fortran 90

by jhosamelly
Tags: fortran, machine
Share this thread:
jhosamelly
#1
Dec16-12, 02:54 AM
P: 126


I have the 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??
Phys.Org News Partner Science news on Phys.org
Sapphire talk enlivens guesswork over iPhone 6
Geneticists offer clues to better rice, tomato crops
UConn makes 3-D copies of antique instrument parts
JesseC
#2
Dec16-12, 05:52 PM
P: 281
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.
SteamKing
#3
Dec16-12, 07:37 PM
Emeritus
Sci Advisor
HW Helper
Thanks
PF Gold
P: 6,307
atan is an intrinsic function.

atan(1.0) is proper syntax


Register to reply

Related Discussions
Fortran 77 help making an empty array (or blank list if they exist in fortran) Programming & Computer Science 5
Material in machine tool body (milling machine) Materials & Chemical Engineering 0
Machine Problem Introductory Physics Homework 3
Accessing Fortran Modules within a Fortran library from Fortran Programming & Computer Science 0