# Question:Procedure called in another procedure

## Question:Procedure called in another procedure

Maple 2022

In my code, why  does InitState(5,5) return only one element of the vector while Coherent(5) returns 5 elements of the vector?

 > restart;
 > with(LinearAlgebra):
 >
 > Coherent := proc({zeta:=1,phi:=Pi/2},n_max) local alpha,i,ICs:  #alpha := sqrt(zeta)*exp(I*phi):  ICs := Vector(n_max,i->evalc(evalf(exp(-zeta/2)/sqrt((i-1)!))*(sqrt(zeta)*exp(I*phi))^(i-1)),datatype=complex[8]); end proc: Projectile := proc({L:=1,sigma:=0.01,beta:=0.02,k0:=-5*Pi},n_max) local x0,g,c,v,ICs,j:   x0 := evalf(beta*L);   g := unapply(exp(-(x-x0)^2/2/sigma^2),x);   c := evalf(int(g(x)^2,x=-L/2..L/2,numeric=true));     v:=Vector(n_max,datatype=complex[8]);   for j from 1 to n_max do:      if (is(j,odd)) then  v[j]:= evalc[8](evalf(Int(cos(Pi*j*x/L)*g(x)*cos(k0*x),x=-L/2..L/2,method=_d01akc))+ I*evalf(Int(cos(Pi*j*x/L)*g(x)*sin(k0*x),x=-L/2..L/2,method=_d01akc)));       else v[j]:= evalc[8](evalf(Int(sin(Pi*j*x/L)*g(x)*cos(k0*x),x=-L/2..L/2,method=_d01akc))+ I*evalf(Int(sin(Pi*j*x/L)*g(x)*sin(k0*x),x=-L/2..L/2,method=_d01akc)));      end if:   end do:  ICs :=evalf[8](sqrt(2/L*c))*v; end proc: InitState := proc({zeta:=1,phi:=Pi/2,L:=1,sigma:=0.01,beta:=0.02,k0:=-5*Pi},d1,d2) local Z0: z1 := Coherent(zeta,phi,d1); #Z0:= MatrixMatrixMultiply(Coherent(zeta,phi,d1),Transpose(Projectile(L,sigma,beta,k0,d2))): end proc:
 > InitState(5,5); Coherent(5);
 (1)