Question: A function depends on t in a procedure

restart;
with(LinearAlgebra):

C:=proc(k,M) local N,P,m,L,T,j,Ld,n,i; 
N:=2^(k-1)*M:
P[0]:= t -> 1:
P[1]:= t -> t:
for m from 2 to M-1 do
   P[m]:= unapply(expand((2*m-1)*t*P[m-1](t)/m - (m-1)*P[m-2](t)/m), t)
end do: 
L:=proc(n,m) local a,b; 
  a := (2*n-2)/2^k; 
  b := 2*n/2^k; 
  return piecewise(a <= t and t <= b, P[m](2^k*t-2*n+1)*sqrt(((m+1)/2)*2^k))
end proc:
T := Vector(N):
for j from 1 to N do T[j] := (j-1/2)/N end do; 
Ld := unapply(Vector(N),t):
for n from 1 to 2^(k-1) do 
  for m from 0 to M-1 do
i := n+2^(k-1)*m:
Ld(t)[i] := L(n,m)
     end do
end do:

return Ld(t):  
end proc:
A:=t->C(2,3);
A(0);
A(0.5);
A(0.3);

Ld is piecewise function depends on t. I want to calculate Ld(0)=A(0), Ld(0.5)=A(0.5) etc.  

What is the problem?

 

Please Wait...