summaryrefslogtreecommitdiff
path: root/1332/CH15/EX15.19/15_19.sce
blob: 92732a7f52794480a5255edd4b64f4f34f059f8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//Example 15.19
//Runge Kutta Fehlberg Method
//Page no. 535
clc;clear;close;
deff('y=f(x,y)','y=x-y')
y=1;x=1;h=0.1;
K1=h*f(x,y);
K2=h*f(x+h/4,y+K1/4);
K3=h*f(x+3*h/8,y+3*(K1+3*K2)/32);
K4=h*f(x+12*h/13,y+1932*K1/2197-7200*K2/2197+7296*K3/2197);
K5=h*f(x+h,y+439*K1/216-8*K2+3680*K3/513-845*K4/4104)
K6=h*f(x+h/2,y-8*K1/27+2*K2-3544*K3/2565+1859*K4/4104-11*K5/40)
disp(K6,'K6 =',K5,'K5 =',K4,'K4 =',K3,'K3 =',K2,'K2 =',K1,'K1 =')
y1=y+(25*K1/216+1408*K3/2565+2197*K4/4104-K5/5)
y11=y+(16*K1/135+6656*K3/12825+28561*K4/56430-9*K5/50+2*K6/55)
printf('\ny(1.1) = %.9f\n\n',y1)
printf('\ny~(1.1) = %.9f\n\n',y11)