clc
clear all
format long
global N m  t x0  q alpha GAMMA shape B
alpha=1/3;
q=1/8;
K=10^4; 
 GAMMA=Gamma_q(q,alpha,K);
G_a=Gamma_q(q,-alpha,K);
G_1a=Gamma_q(q,1-alpha,K);
x0=0.0001;
t(1)=0;
N=10;
shape=1000;
m=5;
for i=2:N+1   
    t(i)=q^(N+1-i);
end
t=t';
N=length(t);

landa0(1)=0.001;
for i=2:N
    landa0(i)=0;
end
fun=@equation;
landa = fsolve(fun,landa0);
% %%%%% Aproximated solution %%%%%%
x(1)=x0;
for i=2:N
    x(i)=0;
    for j=1:N
    x(i)=x(i)+landa(j)*B(i,j,1);
    end
   
end
%%%%%%%%% EXACT SOLUTION %%%%%%%%
alpha=13/6;
G1=Gamma_q(q,alpha,K);
alpha=11/6;
G2=Gamma_q(q,alpha,K);
for i=1:N
    x_exact(i)=((G1)/(G2))*t(i)^(7/6)+x0;
end
Mean=0;
for i=1:N
    error(i)=abs(x(i)-x_exact(i));
end
error'
max(error)
