How Can Numerical Methods in FORTRAN Solve Projectile Motion Problems?

  • Thread starter Thread starter polka129
  • Start date Start date
AI Thread Summary
The discussion centers around a FORTRAN coding challenge involving projectile motion, specifically using the Runge-Kutta 4th order method to solve for three key aspects: the maximum height attained, the time to reach that height, and the time to return to the original elevation. The user seeks guidance on how to modify their existing code to achieve these calculations, as they have not practiced FORTRAN in several years. Key points include the need to determine the maximum height when the projectile transitions from ascending to descending, which can be tracked by introducing a variable to store the maximum height. The endpoint for the projectile's motion is identified as the time when it returns to its original elevation. The discussion emphasizes that assistance will be provided only if the user demonstrates an effort in their coding attempts.
polka129
Messages
43
Reaction score
0
hello people...i have beeen given this projectile problem to be solved numerically in FORTRAN..i have coded it using runge0kutta 4th order ...now the thing is that i have not been given the end points of time,,;ie. the range.. and i am asked to

a)the maximum height attained by the projectile

what is to b added to the existing code to achive this?

b)the time required to reach the maximum height

what is to b added to the existing code to achive this?

c)the time required to return to the original elevation..

what is to b added to the existing code to achive this?

i did fortran 4 years ago...havent beeen in practice..this was the lone effort i cud recall...please help...


i have attached the question and the code..

heres the code
CODE


!**********************************************************************
! *
! projectile question *
! *
!***********************************************************************


DATA M,G,C/10.0,9.80665,0.1/

!FIRST i HAVE REDUCED THE GIVEN EQUATION IN TWO LINEAR 1ST-ORDER EQUATIONS
!FOR THE SOLUTION TO PROCEED


F1(T,U1,Y2) = U1
F2(T,U1,Y2) = (-M*G-C*U1**2)/M


!ASSIGNMENT OF VALUES TO CONSTANTS



WRITE(*,*) 'Input left and right endpoints separated by'
WRITE(*,*) 'blank'
WRITE(*,*) ' '
READ(*,*) A, B

WRITE(*,*) 'Input the two initial conditions.'
WRITE(*,*) ' '
READ(*,*) ALPHA1, ALPHA2

WRITE(6,*) 'Input a positive integer for the number'
WRITE(6,*) 'of subintervals '
WRITE(6,*) ' '
READ(5,*) N


WRITE(*,6)
6 FORMAT(12X,'t(i)',11X,'w1(i)',11X,'w2(i)')

H=(B-A)/N
T=A


! the initiaal conditions
W1=ALPHA1
W2=ALPHA2

WRITE(*,1) T,W1,W2

!RK PARAMETER EVALUATIONS HERE

DO 110 I=1,N

X11=H*F1(T,W1,W2)
X12=H*F2(T,W1,W2)

X21=H*F1(T+H/2,W1+X11/2,W2+X12/2)
X22=H*F2(T+H/2,W1+X11/2,W2+X12/2)

X31=H*F1(T+H/2,W1+X21/2,W2+X22/2)
X32=H*F2(T+H/2,W1+X21/2,W2+X22/2)

X41=H*F1(T+H,W1+X31,W2+X32)
X42=H*F2(T+H,W1+X31,W2+X32)

W1=W1+(X11+2*X21+2*X31+X41)/6
W2=W2+(X12+2*X22+2*X32+X42)/6

T=A+I*H

WRITE(*,1) T,W1,W2
110 CONTINUE


STOP
1 FORMAT(3(1X,E15.8))
END
 

Attachments

  • projectile question.png
    projectile question.png
    28.5 KB · Views: 465
Technology news on Phys.org
Don't use text speak and use code tags in your post with correct indentation to make it easier to read.

So what is your question? We won't solve it for you, only provide you help. I don't see any clear question outlined by yourself. What is it you want help with, the code or the questions?
 
i have attachd the question paper...it is a projectile problem...it has three parts...the answers of which have to b achieved using a numerical method in FORTRAN..i have employed runge-kutta method...i need the fortran commands for these three parts...

i guess the QUESTION is VERY CLEAR...!
 
polka129 said:
i have attachd the question paper...it is a projectile problem...it has three parts...the answers of which have to b achieved using a numerical method in FORTRAN..i have employed runge-kutta method...i need the fortran commands for these three parts...

i guess the QUESTION is VERY CLEAR...!

So where's your attempt? We're not going to give you the commands without some attempt on your part.

Drop the attitude and the text speak.
 
Maximum height is acheived when the projectile transitions from going upwards to downwards. You could optionally use another variable to hold the maximum height, initialize it to the starting height and update it when ever a calculated posiiton is greater.

As far as the end points go, you are given the starting point, and the "endpoint" would occur when the height returned back to it's original value.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
What percentage of programmers have learned to touch type? Have you? Do you think it's important, not just for programming, but for more-than-casual computer users generally? ChatGPT didn't have much on it ("Research indicates that less than 20% of people can touch type fluently, with many relying on the hunt-and-peck method for typing ."). 'Hunt-and-peck method' made me smile. It added, "For programmers, touch typing is a valuable skill that can enhance speed, accuracy, and focus. While...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top