Question: Maple error?

The following program was created to determine a Hermite polynomial. Can anyone see where the error lies? Thanks!

 

restart; f:=x-> (x*(cos(x)))- ((x*x(sin(x/2))));
                 f := x -> x cos(x) - x x(sin(1/2 x))


                              fp := D(f)

> hermite:=proc(Lone::list, Ltwo::list, evaluator) description "This is a procedure which, when given two lists of nodes and their respective function values, returns a Hermite polynomial";
> local L1,L2,xV,y,z,k,L,P,n,f,p, i,nset,m,polyL,polyone,poly, polytwo, est; p:=D(f);
> while (nops(Lone)=nops(Ltwo)) do L1:=Lone; L2:=Ltwo; z:=evaluator;
> n:=nops(L1)-1;
> for k from 0 to n do
> xV||k:=L1[K+1];
> end do;
> nset:={$1..n+1};
> m:=0;
> for k from 1 to n+1 do for i in nset minus {k} do
> m:=m+1;
> y[m,k]:= (x-xV||(i-1))/(xV||(k-1)-xV||(i-1));
> end do;
> L[n,k]:=expand(product(y[s,k],s=1..m));
> m:=0;
> end do;
> polyL:=sum(L2[s]*L[n,s], s=1..n+1);
> polyone:=sum(L2[s]*L[n,s]*L[n,s]* (1-2(x-L1[s])*D(L[n,s])), s=1..n+1);
> polytwo:=sum((x-L1[s])*D(L[n,s])*D(L[n,s]*p(L1[s])), s=1..n+1);
> poly:= expand(polyone+polytwo);
> est:=evalf(subs(x=z,poly));
> print (est);
> print (`\n\nThe Hermite polynomial is:`\);
> return poly;
> end do;
> print ('Error');
> end:
>
> hermite ([.5,3,6.5],[f(.5),f(3),f(6.5)],3);
Error, (in hermite) numeric exception: division by zero

 

Please Wait...