Hi,

I have an error how can I fix the error. Thank you.

Matrix_Fred:=proc(N,d,lambda)

local Kernel,K,Fredholm,phi,MatA,eq2,eq3,eq4,Vct_basis,fct,sys,M,b,M1,Vect_beta,W,i,beta,alpha,eq5,eq6,x,Subs1,Fredholm_stencil,Stencil,w,V,sys1,sys2,Subs2,sys3,Sol_phi;

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

Kernel:=(x,y)->ln(abs(x-y));

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);

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

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

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

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

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

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

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

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

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

for i from 1 to d+1 do

beta[i,n]:=Vect_beta[i];

end do;

x:=m*h;

for i from 1 to d+1 do

alpha[m,n,i]:=unapply(beta[i,n],n,m);

end do;

eq5:=lhs(eq2)=sum(rhs(eq4), n=-N..N-d);

eq6:=subs(x=m*h,subs(lhs(eq5)=rhs(eq5) ,Fredholm)):

Subs1 :=[seq(phi(m*h)=phi[m], m=-N..N)];

Fredholm_stencil:=subs(Subs1,eq6):

Stencil[1] := unapply(Fredholm_stencil,m,lambda,phi,f);

sys1 := [seq(Stencil[1](m,lambda,phi,f),m=-N..N)]:

sys2:=subs(Subs1,sys1):

Subs2:=[seq(f(m*h)=f[m], m=-N..N)]:

sys3:=subs(Subs2,sys2):

Sol_phi := [seq(phi[i],i=-N..N)]; # The unknown vector must be computed.

MatA := GenerateMatrix(convert(sys3,list),Sol_phi)[1];

return MatA;

end proc:

d:=1; N:=2; lambda:=3/Pi;

Matrix_Fred(N,d,lambda);

1

2

3

--

Pi

Error, (in rtable/Power) singular matrix