If Else For End End: Function
If Else For End End: Function
x=poly(0,'x')
function [ll]=fact(r)
f=1
if(r==0)
f=1
else
for i=r:-1:1
f=f*i
end
end
ll=f
endfunction
in=input("Enter the value :")
for j=0:in
p=0
for m=0:20
a=fact(m)
b=fact(m+j)
c=2^(2*m+j)
p=p+((((-1)^m)/(a*b*c))*x.^((2*m)+j))
end
disp(p)
X=[0:0.01:10]
d=horner(p,X)
plot(d)
xgrid()
end
nter the value :3
2 4 6 8 10 12 14 16 18 20 22
24
26 28 30 32 34 36 38 40
3 5 7 9 11 13 15 17 19 21 23
25
0.5x - 0.0625x + 0.0026042x - 0.0000543x + 0.0000007x - 5.651D-09x + 3.364D-11x - 1.502D-13x +
5.214D-16x - 1.448D-18x + 3.292D-21x - 6.235D-24x + 9.992D-27x
27 29 31 33 35 37 39 41
2 4 6 8 10 12 14 16 18 20 22 24
26 28 30 32 34 36 38 40 42
3 5 7 9 11 13 15 17 19 21 23
25
27 29 31 33 35 37 39 41 43