peppersley
Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Как вывести массив из подпрограммы? прога дает ошибку в подпрограмме RungeKutta error FOR3435: symbol U is a dummy argument - cannot be ALLOCATABLE detected between U and ( error FOR3435: symbol T is a dummy argument - cannot be ALLOCATABLE detected between T and ( program GOLOVA integer i i=3 call RungeKutta(i,u,t) print*,u !собственно этот массив значений и надо вывести из под РУнге-Кутты print*,t ! И этот массив тоже end program GOLOVA subroutine RungeKutta(i,u,t) integer nstep,stepmax real:: t0,tend,y1,k(4) real, allocatable :: u(,t( stepmax=100 allocate (u(stepmax+1),t(stepmax+1)) t0=0 tend=3 u(1)=1 t(1)=t0 step=abs(t0-tend)/stepmax do nstep=1,stepmax call Raschet(nn,x,i,t(nstep),u(nstep),y1) k(1)=y1 call Raschet(nn,x,i,t(nstep)+step/2,u(nstep)+step*k(1)/2,y1) k(2)=y1 call Raschet(nn,x,i,t(nstep)+step/2,u(nstep)+step*k(2)/2,y1) k(3)=y1 call Raschet(nn,x,i,t(nstep)+step,u(nstep)+step*k(3),y1) k(4)=y1 u(nstep+1)=u(nstep)+step*(k(1)+2*k(2)+2*k(3)+k(4))/6 t(nstep+1)=t(1)+step*nstep end do end subroutine RungeKutta !****************UNTER-UNTER-PROGRAM********************** subroutine Raschet(nn,x,i,t1,u1,y1) y1=u1*2*t1 end subroutine Raschet |