//Example 15.26 //Multi Valued Method //Page no. 553 clc;clear;close; deff('y=f1(x,y)','y=2*x^2-y') h=0.1;x=0;y=-1; deff('y=f2(x,y)','y=4*x-f1(x,y)') deff('y=f3(x,y)','y=4-f2(x,y)') B=[1,1,1,1;0,1,2,3;0,0,1,3;0,0,0,1]; y0=[y;h*f1(x,y);h^2*f2(x,y)/2;h^3*f3(x,y)/6] y01=y0; r=[0;1;3/4;1/6] disp(r,'If r = ') printf('\n\n-------------------------------------------------------------------------\nx = 0\t\t\tx = 0.1\t\t\t\tx = 0.2\n\t') for i=1:2 y11=B*y01 s(i)=h*(f1(x+h,y11(1)))-y11(2) y1=y11+s(i)*r if i==2 then break end y2=y1; y22=y11; y01=y1 end printf('\t (s = %.5g)\t\t (s = %.9f)\n-------------------------------------------------------------------------\n Y0\t\t Y`i\t\t Y1\t\t Y`2\t\t Y2\n-------------------------------------------------------------------------\n',s(1),s(2)) for i=1:4 printf('%.5f \t%.5f \t%.5f \t%.5f \t%.5f\n',y0(i),y22(i),y2(i),y11(i),y1(i)) end y0=[y;h*f1(x,y);h^2*f2(x,y)/2;h^3*f3(x,y)/6] y01=y0; r=[5/12;1;3/4;1/6] disp(r,'If r = ') printf('\n\n-------------------------------------------------------------------------\nx = 0\t\t\tx = 0.1\t\t\t\tx = 0.2\n\t') for i=1:2 y11=B*y01 s(i)=h*(f1(x+h,y11(1)))-y11(2) y1=y11+s(i)*r if i==2 then break end y2=y1; y22=y11; y01=y1 end printf('\t (s = %.5g)\t\t (s = %.9f)\n-------------------------------------------------------------------------\n Y0\t\t Y`i\t\t Y1\t\t Y`2\t\t Y2\n-------------------------------------------------------------------------\n',s(1),s(2)) for i=1:4 printf('%.5f \t%.5f \t%.5f \t%.5f \t%.5f\n',y0(i),y22(i),y2(i),y11(i),y1(i)) end