Machine Problem in Fortran 90


by jhosamelly
Tags: fortran, machine
jhosamelly
jhosamelly is offline
#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
SensaBubble: It's a bubble, but not as we know it (w/ video)
The hemihelix: Scientists discover a new shape using rubber bands (w/ video)
Microbes provide insights into evolution of human language
JesseC
JesseC is offline
#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
SteamKing is offline
#3
Dec16-12, 07:37 PM
HW Helper
Thanks
P: 5,598
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