//Euler's Formula
deff('g=f(x,y)','g=2*y+x')
xo=input("Enter initial value of xo: ")
yo=input("Enter the value of yo: ")
h=input("Enter value of h: ")
xn=input("Enter Final value of xn: ")
n=(xn-xo)/h
for i=1:n
y1=yo+h*f(xo,yo)
xo=xo+h
disp([xo y1])
yo=y1
end
Output
-->exec('D:\Scilab prog by me\Euler''s.sce', -1)
Enter initial value of xo: 0
Enter the value of yo: 1
Enter value of h: 0.1
Enter Final value of xn: 0.3
0.1 1.2
0.2 1.45
0.3 1.76
deff('g=f(x,y)','g=2*y+x')
xo=input("Enter initial value of xo: ")
yo=input("Enter the value of yo: ")
h=input("Enter value of h: ")
xn=input("Enter Final value of xn: ")
n=(xn-xo)/h
for i=1:n
y1=yo+h*f(xo,yo)
xo=xo+h
disp([xo y1])
yo=y1
end
Output
-->exec('D:\Scilab prog by me\Euler''s.sce', -1)
Enter initial value of xo: 0
Enter the value of yo: 1
Enter value of h: 0.1
Enter Final value of xn: 0.3
0.1 1.2
0.2 1.45
0.3 1.76
No comments:
Post a Comment