program ex072 c c This program solves the equation c h = v0**2/g*log(cosh(g*t/v0)) c by using the Newton's method implicit real*8 (a-h,o-z) real*8 m ! Declare m is double precision real variable c c Statement function x(t)= h - v0**2/g*log(cosh(g*t/v0)) v(t)= - v0*tanh(g*t/v0) c eps = 1.0d-10 ! Allowed Error nmax = 100 h0 = 20.0d0 ! Max. Height g = 9.8d0 ! Gravitation Acceleration gam = 1.0d0 ! Friction Constant a = 0.035d0 ! 3.5 cm (baseball) ?? m = 0.40d0 ! 400 g (baseball) ?? c a = 0.15d0 ! 15 cm (football) ?? c m = 1.00d0 ! 1 kg (football) ?? c Parameter Inputs write(*,800) "# a, m, h, nmax = ?" read(*,*) a, m, h0, nmax write(*,800) "# a, m, h, nmax =", a, m, h0, nmax write(*,800) & "# h t t (no fric.) Steps" 800 format(a,3(1x,f10.5),1x,i5) c dh = h0 / nmax ! step of h v0 = sqrt(m*g/gam/a/a) c t = sqrt(2*dh/g) ! If gam=0, x(t)=g*t**2/2 do i = 1, nmax h = i*dh ! We study various h c t = sqrt(2*h/g) ! If gam=0, x(t)=g*t**2/2 n1 = 1 do n=1,1000 xt = x(t) n1 = n if(abs(xt).lt.eps) goto 20 dt = -xt/v(t) ! Newton 法 t = t + dt enddo c 20 continue write(*,100) h, t, sqrt(2*h/g), n1 ! 最終的な答えを書く end do c stop 100 format(3(1x,f15.7),1x,i4) end