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

  • Thread starter Thread starter jhosamelly
  • Start date Start date
  • Tags Tags
    Fortran Machine
AI Thread Summary
The discussion revolves around a Fortran program designed to simulate motion under gravitational acceleration. The main focus is on defining the acceleration components, Ax and Ay, using the formula a = -r/r^3 in component form. Participants note the necessity of initializing variables such as Nsteps and n, which are currently undefined in the code. Additionally, there are concerns about the syntax used for defining pi, with a suggestion to use atan(1.0) for proper implementation. The conversation highlights the importance of correctly setting initial x and y values for the simulation to function effectively.
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:
Technology 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
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
2
Views
2K
Replies
1
Views
14K
Replies
8
Views
2K
Replies
4
Views
2K
Replies
2
Views
3K
Back
Top