blob: ec1387d75d8a76f4455a3e599afc905169912490 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
//Example 15.9
//Trapezium Method
//Page no. 516
clc;clear;close;
deff('y=f(x,y)','y=x*y^2')
y=1;
h=0.2;
y2=poly(0,'y2')
for i=1:2
x=(i-1)*h;
x1=x+h
y1=roots(-y2+y+h*(f(x,y)+f(x1,y2))/2)
printf('\n Y(%i) = %g or %g\n',i,y1(1),y1(2))
end
|