본문내용
1,n
k(3,i)=h*f(i)
40 xn(i)=tx(i)+k(3,i)
call dots(tn+h,xn,f)
do 50 i=1,n
50 k(4,i)=h*f(i)
do 60 i=1,n
sk=k(1,i)+2*k(2,i)+2*k(3,i)+k(4,i)
60 xn(i)=tx(i)+sk/6
do 70 i=1,n
70 tx(i)=xn(i)
80 tn=tn+h
return
end
subroutine dots(t,x,f)
real x(10),f(10)
f(1)=x(2)
f(2)=x(3)
f(3)=t+2*x(1)+t*f(1)-t*f(2)
return
end
data : 03xypq
0.0 0.6 0.2 .0001
0.0 1.0 0.0
결과
x-value y-value y-deriv p-value p-deriv q-value q-deriv
0.000 0.0000 1.0000 1.0000 0.0000 0.0000 0.0000
0.200 0.2003 1.0053 1.0053 0.0793 0.0793 0.7857
0.400 0.4042 1.0418 1.0418 0.3095 0.3095 1.5013
0.600 0.6210 1.1380 1.1380 0.6733 0.6733 2.1208
8.15
subroutine dots(t,x,f)
real x(10),f(10)
real k,m
f(1)=x(2)
f(2)=16*cos(8*t)-64*x(1)
return
end
결과
t-value x-value x-deriv p-value p-deriv
0.000 0.0000 0.0000 0.0000 16.0000
0.200 0.1999 0.9529 0.9529 -13.2617
0.400 -0.0233 -3.2529 -3.2529 -14.4786
0.600 -0.5977 -0.5762 -0.5762 39.6522
0.800 0.0932 6.4729 6.4729 9.9240
1.000 0.9894 -0.1746 -0.1746 -65.6465
8.17
c simulataneous differential equations
c solving with modified euler method
external fxp,fyp
open(6,file='bnd17.out',status='old')
c (tl,tu): independent variable bounary value
c (xl,xu): dependent variable initial value
c (ch1,ch2):asumed derivertive value
c h interval increment value
c fxp:function subroutine supplid by user dx/dt=y
c fyp:function subroutine supplied by user dy/dt
tl=0
tu=1.
xl=0
xu=1.9
ch1=1.
ch2=1.50
h=0.1
y0=ch1
r=xu
t0=tl
x0=xl
y0=ch1
tol=0.000001
call euler(t0,tu,h,x0,y0,fxp,fyp,r1,tol)
dch=100
drr=100
while(dch.gt.tol.and.drr.gt.tol) do
t0=tl
x0=xl
y0=ch2
call euler(t0,tu,h,x0,y0,fxp,fyp,r2,tol)
ch= ch1+(ch2-ch1)/(r2-r1)*(r-r1)
ch1=ch2
ch2=ch
dch=abs(ch1-ch2)
drr=abs(r1-r2)
r1=r2
endwhile
stop
end
subroutine euler(t0,tl, h,x0,y0,fxp,fyp,xc,tol)
write(*,15)
15 format(9x,'x',9x,'y',9x,'p')
write(*,25)t0,x0,y0
while(t0.le.tl)do
25 format(5x,6f10.4)
t1=t0+h
xdot=fxp(t0,x0,y0)
ydot=fyp(t0,x0,y0)
xp=x0+h*xdot
yp=y0+h*ydot
dx=10.
dy=10.
while(dx.gt.tol.and.dy.gt.tol)do
xc=x0+(xdot+fxp(t1,xp,yp))*h/2.
yc=y0+(ydot+fyp(t1,xp,yp))*h/2.
dx=abs(xc-xp)
dy=abs(yc-yp)
xp=xc
yp=yc
endwhile
t0=t1
x0=xc
y0=yc
write(*,25)t0,x0,y0
endwhile
return
end
function fxp(x,y,p)
fxp=p
return
end
function fyp(x,y,p)
fyp=4.2*x+ 3*y-x*p
return
end
x y y'
0.0000 0.0000 1.0000
0.1000 0.1000 1.0310
0.2000 0.2077 1.1238
0.3000 0.3279 1.2787
0.4000 0.4666 1.4958
0.5000 0.6301 1.7750
0.6000 0.8247 2.1163
0.7000 1.0565 2.5198
0.8000 1.3318 2.9855
0.9000 1.6567 3.5132
1.0000 2.0375 4.1031
x y y'
0.0000 0.0000 1.5000
0.1000 0.1500 1.5360
0.2000 0.3090 1.6437
0.3000 0.4824 1.8236
0.4000 0.6773 2.0757
0.5000 0.9011 2.4000
0.6000 1.1609 2.7964
0.7000 1.4640 3.2650
0.8000 1.8175 3.8057
0.9000 2.2287 4.4186
1.0000 2.7048 5.1036
x y y'
0.0000 0.0000 0.8970
0.1000 0.0897 0.9269
0.2000 0.1869 1.0166
0.3000 0.2960 1.1664
0.4000 0.4232 1.3763
0.5000 0.5743 1.6462
0.6000 0.7554 1.9762
0.7000 0.9725 2.3663
0.8000 1.2317 2.8164
0.9000 1.5388 3.3267
1.0000 1.9000 3.8969
8.18 답: y
0 0
л/8 0.3851
л/4 0.7108
3л/8 0.9268
л/2 1
k(3,i)=h*f(i)
40 xn(i)=tx(i)+k(3,i)
call dots(tn+h,xn,f)
do 50 i=1,n
50 k(4,i)=h*f(i)
do 60 i=1,n
sk=k(1,i)+2*k(2,i)+2*k(3,i)+k(4,i)
60 xn(i)=tx(i)+sk/6
do 70 i=1,n
70 tx(i)=xn(i)
80 tn=tn+h
return
end
subroutine dots(t,x,f)
real x(10),f(10)
f(1)=x(2)
f(2)=x(3)
f(3)=t+2*x(1)+t*f(1)-t*f(2)
return
end
data : 03xypq
0.0 0.6 0.2 .0001
0.0 1.0 0.0
결과
x-value y-value y-deriv p-value p-deriv q-value q-deriv
0.000 0.0000 1.0000 1.0000 0.0000 0.0000 0.0000
0.200 0.2003 1.0053 1.0053 0.0793 0.0793 0.7857
0.400 0.4042 1.0418 1.0418 0.3095 0.3095 1.5013
0.600 0.6210 1.1380 1.1380 0.6733 0.6733 2.1208
8.15
subroutine dots(t,x,f)
real x(10),f(10)
real k,m
f(1)=x(2)
f(2)=16*cos(8*t)-64*x(1)
return
end
결과
t-value x-value x-deriv p-value p-deriv
0.000 0.0000 0.0000 0.0000 16.0000
0.200 0.1999 0.9529 0.9529 -13.2617
0.400 -0.0233 -3.2529 -3.2529 -14.4786
0.600 -0.5977 -0.5762 -0.5762 39.6522
0.800 0.0932 6.4729 6.4729 9.9240
1.000 0.9894 -0.1746 -0.1746 -65.6465
8.17
c simulataneous differential equations
c solving with modified euler method
external fxp,fyp
open(6,file='bnd17.out',status='old')
c (tl,tu): independent variable bounary value
c (xl,xu): dependent variable initial value
c (ch1,ch2):asumed derivertive value
c h interval increment value
c fxp:function subroutine supplid by user dx/dt=y
c fyp:function subroutine supplied by user dy/dt
tl=0
tu=1.
xl=0
xu=1.9
ch1=1.
ch2=1.50
h=0.1
y0=ch1
r=xu
t0=tl
x0=xl
y0=ch1
tol=0.000001
call euler(t0,tu,h,x0,y0,fxp,fyp,r1,tol)
dch=100
drr=100
while(dch.gt.tol.and.drr.gt.tol) do
t0=tl
x0=xl
y0=ch2
call euler(t0,tu,h,x0,y0,fxp,fyp,r2,tol)
ch= ch1+(ch2-ch1)/(r2-r1)*(r-r1)
ch1=ch2
ch2=ch
dch=abs(ch1-ch2)
drr=abs(r1-r2)
r1=r2
endwhile
stop
end
subroutine euler(t0,tl, h,x0,y0,fxp,fyp,xc,tol)
write(*,15)
15 format(9x,'x',9x,'y',9x,'p')
write(*,25)t0,x0,y0
while(t0.le.tl)do
25 format(5x,6f10.4)
t1=t0+h
xdot=fxp(t0,x0,y0)
ydot=fyp(t0,x0,y0)
xp=x0+h*xdot
yp=y0+h*ydot
dx=10.
dy=10.
while(dx.gt.tol.and.dy.gt.tol)do
xc=x0+(xdot+fxp(t1,xp,yp))*h/2.
yc=y0+(ydot+fyp(t1,xp,yp))*h/2.
dx=abs(xc-xp)
dy=abs(yc-yp)
xp=xc
yp=yc
endwhile
t0=t1
x0=xc
y0=yc
write(*,25)t0,x0,y0
endwhile
return
end
function fxp(x,y,p)
fxp=p
return
end
function fyp(x,y,p)
fyp=4.2*x+ 3*y-x*p
return
end
x y y'
0.0000 0.0000 1.0000
0.1000 0.1000 1.0310
0.2000 0.2077 1.1238
0.3000 0.3279 1.2787
0.4000 0.4666 1.4958
0.5000 0.6301 1.7750
0.6000 0.8247 2.1163
0.7000 1.0565 2.5198
0.8000 1.3318 2.9855
0.9000 1.6567 3.5132
1.0000 2.0375 4.1031
x y y'
0.0000 0.0000 1.5000
0.1000 0.1500 1.5360
0.2000 0.3090 1.6437
0.3000 0.4824 1.8236
0.4000 0.6773 2.0757
0.5000 0.9011 2.4000
0.6000 1.1609 2.7964
0.7000 1.4640 3.2650
0.8000 1.8175 3.8057
0.9000 2.2287 4.4186
1.0000 2.7048 5.1036
x y y'
0.0000 0.0000 0.8970
0.1000 0.0897 0.9269
0.2000 0.1869 1.0166
0.3000 0.2960 1.1664
0.4000 0.4232 1.3763
0.5000 0.5743 1.6462
0.6000 0.7554 1.9762
0.7000 0.9725 2.3663
0.8000 1.2317 2.8164
0.9000 1.5388 3.3267
1.0000 1.9000 3.8969
8.18 답: y
0 0
л/8 0.3851
л/4 0.7108
3л/8 0.9268
л/2 1
추천자료
Operating System Concept(공룡책) 운영체제 연습문제 정답 1장 ~ 13장
데이터베이스 시스템총론 (3판/이재호 저) 5장 연습문제 풀이
데이터베이스 시스템총론(3판/이재호 저) 7장 연습문제 풀이
데이터베이스 시스템총론 (3판/이재호 저) 6장 연습문제 풀이
데이터베이스 시스템총론(3판/이재호 저) 9장 연습문제 풀이
데이터베이스 시스템총론(3판/이재호 저) 10장 연습문제 풀이
수문학 구미서관 (이재수 저) 제10장 연습문제풀이(홀수)
수문학 구미서관 (이재수 저) 10장 연습문제(홀수) 풀이
William Stallings - Operating systems - Chapter8 연습문제 풀이
William Stallings - Operating systems - Chapter7 연습문제 풀이
William Stallings - Operating systems - Chapter6 연습문제 풀이
토질역학(구미서관)-8장 레포트 연습문제
천인국 C언어로 쉽게 풀어쓴 자료구조 2장 연습문제 정답 chapter2