Hi, My goal is to compute the coefficient beta_i, so i will solve a system and get the coefficient beta_i. But my code return an error. Any help please. Many thinks

coef_approx:=proc(a,N,i,d)

local Fredholm,eq2,eq3,Vct_basis,fct,sys,eq4,M,w,b,M1,V,Vect_beta,h,x,phi,Kernel,lambda;

# Fredholm Integral equation

Fredholm:=phi(x)=f(x)+lambda*int(Kernel(x,y)*phi(y),y=-a..a);

# stepsize

h:=a/N;

# First Approximation of integral

eq2:=int(Kernel(x,y)*phi(y),y=-a..a)=sum(int(Kernel(x,y)*phi(y),y=n*h..(n+d)*h),n=-N..N-d);

#Approximate the integral (Method used)

eq3:=phi->int(Kernel(x,y)*phi(y),y=n*h..(n+d)*h)=add(beta[i]*phi((n+i-1)*h),i=1..d+1):

eq4:=int(Kernel(x,y)*phi(y),y=n*h..(n+d)*h)=add(alpha[i](n,m)*phi((n+i-1)*h),i=1..d+1);

# Fct used to compute the coeffcient beta[i]

Vct_basis:=[seq(x^i,i=0..d+1)]:

fct:=[seq(unapply(Vct_basis[i],x),i=1..d+2)];

# system of equation must be solved

sys:=[seq(eq3(fct[i]),i=1..d+1)]:

x:='x';

x:=m*h:

w := [seq(beta[i],i=1..d+1)];

M,b := GenerateMatrix(sys,w);

M1:=-M: V:=-b:

Vect_beta:=(M1)^(-1).V:

return Vect_beta;

end proc;