Program Pendulum_motion_with_nonlinearlity
implicit none
real::x,y,dt
real,parameter::pi=3.141593
integer::i,n
open(11,file="ho1.dat",status="unknown")
open(12,file="ho2.dat",status="unknown")
open(13,file="ho3.dat",status="unknown")
open(14,file="ho4.dat",status="unknown")
open(15,file="ho5.dat",status="unknown")
open(16,file="ho6.dat",status="unknown")
!Initial condition y=0 and x=.5
x=0.5; y=0.0; dt=0.01
write(11,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(11,*)x,y
enddo
close(11)
!Initial condition y=0 x=1.8
x=1.8; y=0.0; dt=0.01
write(12,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(12,*)x,y
enddo
close(12)
!Initial condition x=pi-0.0001, y=-0.0001
x=pi-0.0001; y=-0.0001; dt=0.01
write(13,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(13,*)x,y
enddo
close(13)
!Initial condition x=-pi+0.0001 y=0.0001end
x=-pi+0.0001; y=0.0001; dt=0.01
write(14,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(14,*)x,y
enddo
close(14)
!initial condition x=0.0 y=5.0
x=-5; y=3; dt=0.01
write(15,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(15,*)x,y
enddo
close(15)
!Initial condition x=0.0 y=-5.0
x=5; y=-3; dt=0.01
write(16,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(16,*)x,y
enddo
close(16)
end
implicit none
real::x,y,dt
real,parameter::pi=3.141593
integer::i,n
open(11,file="ho1.dat",status="unknown")
open(12,file="ho2.dat",status="unknown")
open(13,file="ho3.dat",status="unknown")
open(14,file="ho4.dat",status="unknown")
open(15,file="ho5.dat",status="unknown")
open(16,file="ho6.dat",status="unknown")
!Initial condition y=0 and x=.5
x=0.5; y=0.0; dt=0.01
write(11,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(11,*)x,y
enddo
close(11)
!Initial condition y=0 x=1.8
x=1.8; y=0.0; dt=0.01
write(12,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(12,*)x,y
enddo
close(12)
!Initial condition x=pi-0.0001, y=-0.0001
x=pi-0.0001; y=-0.0001; dt=0.01
write(13,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(13,*)x,y
enddo
close(13)
!Initial condition x=-pi+0.0001 y=0.0001end
x=-pi+0.0001; y=0.0001; dt=0.01
write(14,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(14,*)x,y
enddo
close(14)
!initial condition x=0.0 y=5.0
x=-5; y=3; dt=0.01
write(15,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(15,*)x,y
enddo
close(15)
!Initial condition x=0.0 y=-5.0
x=5; y=-3; dt=0.01
write(16,*)x,y
do i=1,1500
x=x + y*dt
y=y - dt*sin(x)
write(16,*)x,y
enddo
close(16)
end
Comments
Post a Comment